MCPcopy Create free account
hub / github.com/decaporg/decap-cms / parseArgs

Function parseArgs

scripts/verify-published-packages.mjs:64–89  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

62}
63
64function parseArgs(argv) {
65 const options = {
66 registry: DEFAULT_REGISTRY,
67 allowMissing: false,
68 expectTag: null,
69 allowUnattested: new Set(),
70 };
71
72 for (const arg of argv) {
73 if (arg === '--allow-missing') {
74 options.allowMissing = true;
75 } else if (arg.startsWith('--registry=')) {
76 options.registry = arg.slice('--registry='.length);
77 } else if (arg.startsWith('--expect-tag=')) {
78 options.expectTag = arg.slice('--expect-tag='.length) || null;
79 } else if (arg.startsWith('--allow-unattested=')) {
80 for (const name of arg.slice('--allow-unattested='.length).split(',')) {
81 if (name) options.allowUnattested.add(name);
82 }
83 } else {
84 throw new Error(`Unknown argument: ${arg}`);
85 }
86 }
87
88 return { ...options, registry: options.registry.replace(/\/+$/, '') };
89}
90
91/**
92 * Every non-private package in the pnpm workspace, i.e. exactly the set that

Callers 1

mainFunction · 0.70

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected