Skip to content

Commit 7eb5ac9

Browse files
committed
fix(versioner): validate registry flag
1 parent 85a0689 commit 7eb5ac9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/versioner/src/versioner.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,12 @@ const publish = async (cwd: string) => {
162162
);
163163
}
164164

165-
const registry = (argv.registry || DEFAULT_NPM_REGISTRY).replace(/\/+$/, '');
165+
const registryOverride = typeof argv.registry === 'string' ? argv.registry.trim() : null;
166+
if (registryOverride != null && registryOverride.length === 0) {
167+
throw new TypeError(`--registry must be a non-empty string (e.g. "${DEFAULT_NPM_REGISTRY}")`);
168+
}
169+
170+
const registry = (registryOverride || DEFAULT_NPM_REGISTRY).replace(/\/+$/, '');
166171

167172
log.info(chalk`\n{cyan Publishing to registry}`);
168173
log.info(chalk`{grey Registry:} ${registry}`);

0 commit comments

Comments
 (0)