Skip to content

Commit 303396e

Browse files
committed
feat: support npm publish with correct publishConfig#registry in package.json
close #1271
1 parent c11391b commit 303396e

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

packages/cli/src/commands/publish/npm-utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ interface PublishOptions {
1616
publishDir: string;
1717
access: AccessType;
1818
tag: string;
19+
registry?: string;
1920
}
2021

2122
const npmRequestLimit = pLimit(40);
@@ -169,6 +170,10 @@ async function internalPublish(
169170
let publishFlags = opts.access ? ["--access", opts.access] : [];
170171
publishFlags.push("--tag", opts.tag);
171172

173+
if (opts.registry) {
174+
publishFlags.push("--registry", opts.registry);
175+
}
176+
172177
if ((await twoFactorState.isRequired) && !isCI) {
173178
let otpCode = await getOtpCode(twoFactorState);
174179
publishFlags.push("--otp", otpCode);

packages/cli/src/commands/publish/publishPackages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ async function publishAPackage(
135135
: pkg.dir,
136136
access: publishConfig?.access || access,
137137
tag,
138+
registry: publishConfig?.registry,
138139
},
139140
twoFactorState
140141
);

0 commit comments

Comments
 (0)