Skip to content

Commit 3cb7465

Browse files
haraldFevocateur
authored andcommittedNov 27, 2018
fix(publish): Ignore non-release tags when detecting from-git (#1782)
1 parent 7ee05d7 commit 3cb7465

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed
 

Diff for: ‎commands/publish/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class PublishCommand extends Command {
212212
}
213213

214214
if (this.project.isIndependent()) {
215-
return taggedPackageNames.map(name => this.packageGraph.get(name));
215+
return taggedPackageNames.map(name => this.packageGraph.get(name)).filter(name => name !== undefined);
216216
}
217217

218218
return getTaggedPackages(this.packageGraph, this.project.rootPath, this.execOpts);

Diff for: ‎integration/lerna-publish-custom-tag.test.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"use strict";
2+
3+
const path = require("path");
4+
5+
const cliRunner = require("@lerna-test/cli-runner");
6+
const gitTag = require("@lerna-test/git-tag");
7+
const cloneFixture = require("@lerna-test/clone-fixture")(
8+
path.resolve(__dirname, "../commands/publish/__tests__")
9+
);
10+
11+
// stabilize changelog commit SHA and datestamp
12+
expect.addSnapshotSerializer(require("@lerna-test/serialize-changelog"));
13+
14+
const env = {
15+
// never actually upload when calling `npm publish`
16+
npm_config_dry_run: true,
17+
// skip npm package validation, none of the stubs are real
18+
LERNA_INTEGRATION: "SKIP",
19+
};
20+
21+
test("lerna publish from-git handles custom tags", async () => {
22+
const { cwd } = await cloneFixture("independent");
23+
24+
await gitTag(cwd, "some-unrelated-tag");
25+
26+
const args = ["publish", "--yes", "from-git"];
27+
28+
const { stdout } = await cliRunner(cwd, env)(...args);
29+
expect(stdout).toMatchInlineSnapshot("", ``);
30+
});

0 commit comments

Comments
 (0)
Please sign in to comment.