Skip to content

Commit 2159074

Browse files
committed
update
1 parent 58e112d commit 2159074

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cli/src/npm-client.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,13 +448,23 @@ export async function packageDeprecate(
448448
options?: { dryRun?: boolean; registry?: string },
449449
): Promise<NpmExecResult> {
450450
validatePackageName(pkg)
451+
452+
const reasonText = reason.trim()
453+
454+
if (!reasonText) {
455+
throw new Error('Deprecation reason must not be empty')
456+
}
457+
451458
const target = version ? `${pkg}@${version}` : pkg
452459
const args = ['deprecate', target, reason]
460+
453461
if (options?.dryRun) {
454462
args.push('--dry-run')
455463
}
464+
456465
if (options?.registry?.trim()) {
457466
args.push('--registry', options.registry.trim())
458467
}
468+
459469
return execNpm(args, { otp })
460470
}

0 commit comments

Comments
 (0)