Skip to content

Commit 22fa2f7

Browse files
authored
Fixes publishing scoped packages to third-party registries (#439)
* Allows explicitly pass both the registry and the ident * Bumps the versions
1 parent 50c1262 commit 22fa2f7

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

packages/plugin-npm-cli/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"yup": "^0.27.0"
1515
},
1616
"version": "2.0.0-rc.1",
17+
"nextVersion": {
18+
"semver": "2.0.0-rc.2",
19+
"nonce": "2965736026974261"
20+
},
1721
"repository": {
1822
"type": "git",
1923
"url": "ssh://git@github.com/yarnpkg/berry.git"

packages/plugin-npm-cli/sources/commands/npm/publish.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export default class NpmPublishCommand extends BaseCommand {
6363
const registryData = await npmHttpUtils.get(npmHttpUtils.getIdentUrl(ident), {
6464
configuration,
6565
registry,
66+
ident,
6667
json: true,
6768
});
6869

packages/plugin-npm/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
"semver": "^5.6.0"
1010
},
1111
"version": "2.0.0-rc.1",
12+
"nextVersion": {
13+
"semver": "2.0.0-rc.2",
14+
"nonce": "5986557666077751"
15+
},
1216
"repository": {
1317
"type": "git",
1418
"url": "ssh://git@github.com/yarnpkg/berry.git"

packages/plugin-npm/sources/npmHttpUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type AuthOptions = {
1818

1919
type RegistryOptions = {
2020
ident: Ident,
21-
registry?: void,
21+
registry?: string,
2222
} | {
2323
ident?: void,
2424
registry: string;
@@ -35,7 +35,7 @@ export function getIdentUrl(ident: Ident) {
3535
}
3636

3737
export async function get(path: string, {configuration, headers, ident, authType, registry, ...rest}: Options) {
38-
if (ident)
38+
if (ident && typeof registry === `undefined`)
3939
registry = npmConfigUtils.getScopeRegistry(ident.scope, {configuration});
4040
if (ident && ident.scope && typeof authType === `undefined`)
4141
authType = AuthType.BEST_EFFORT;
@@ -51,7 +51,7 @@ export async function get(path: string, {configuration, headers, ident, authType
5151
}
5252

5353
export async function put(path: string, body: httpUtils.Body, {configuration, headers, ident, authType = AuthType.ALWAYS_AUTH, registry, ...rest}: Options) {
54-
if (ident)
54+
if (ident && typeof registry === `undefined`)
5555
registry = npmConfigUtils.getScopeRegistry(ident.scope, {configuration});
5656

5757
if (typeof registry !== `string`)

packages/yarnpkg-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "2.0.0-rc.3",
44
"nextVersion": {
55
"semver": "2.0.0-rc.4",
6-
"nonce": "6374202412274785"
6+
"nonce": "1053386781220579"
77
},
88
"main": "./sources/index.ts",
99
"bin": {

0 commit comments

Comments
 (0)