Skip to content

Commit

Permalink
fix(publish) Pass only the project scope to libnpmpublish (#1985)
Browse files Browse the repository at this point in the history
Fixes #1968
  • Loading branch information
armandocanals authored and evocateur committed Mar 22, 2019
1 parent 5001301 commit 4e3f8d8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions utils/npm-publish/__tests__/npm-publish.test.js
Expand Up @@ -32,7 +32,7 @@ describe("npm-publish", () => {
const tarFilePath = "/tmp/test-1.10.100.tgz";
const rootPath = path.normalize("/test");
const pkg = new Package(
{ name: "test", version: "1.10.100" },
{ name: "@scope/test", version: "1.10.100" },
path.join(rootPath, "npmPublish/test"),
rootPath
);
Expand All @@ -49,8 +49,8 @@ describe("npm-publish", () => {
mockTarData,
expect.figgyPudding({
dryRun: false,
projectScope: "test",
tag: "published-tag",
projectScope: "@scope",
})
);
});
Expand Down Expand Up @@ -127,7 +127,7 @@ describe("npm-publish", () => {

it("calls publish lifecycles", async () => {
const aFiggyPudding = expect.figgyPudding({
projectScope: "test",
projectScope: "@scope",
});

await npmPublish(pkg, tarFilePath);
Expand Down
5 changes: 4 additions & 1 deletion utils/npm-publish/npm-publish.js
Expand Up @@ -7,6 +7,7 @@ const pify = require("pify");
const readJSON = require("read-package-json");
const figgyPudding = require("figgy-pudding");
const runLifecycle = require("@lerna/run-lifecycle");
const npa = require("npm-package-arg");

module.exports = npmPublish;

Expand All @@ -30,8 +31,10 @@ const PublishConfig = figgyPudding(
);

function npmPublish(pkg, tarFilePath, _opts) {
const { scope } = npa(pkg.name);
// pass only the package scope to libnpmpublish
const opts = PublishConfig(_opts, {
projectScope: pkg.name,
projectScope: scope,
});

opts.log.verbose("publish", pkg.name);
Expand Down
3 changes: 2 additions & 1 deletion utils/npm-publish/package.json
@@ -1,6 +1,6 @@
{
"name": "@lerna/npm-publish",
"version": "3.13.0",
"version": "3.13.1",
"description": "An internal Lerna tool",
"keywords": [
"lerna",
Expand Down Expand Up @@ -35,6 +35,7 @@
"figgy-pudding": "^3.5.1",
"fs-extra": "^7.0.0",
"libnpmpublish": "^1.1.1",
"npm-package-arg": "^6.1.0",
"npmlog": "^4.1.2",
"pify": "^3.0.0",
"read-package-json": "^2.0.13"
Expand Down

0 comments on commit 4e3f8d8

Please sign in to comment.