Skip to content

Commit

Permalink
fix(publish): Ignore non-release tags when detecting from-git (#1782)
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldF authored and evocateur committed Nov 27, 2018
1 parent 7ee05d7 commit 3cb7465
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion commands/publish/index.js
Expand Up @@ -212,7 +212,7 @@ class PublishCommand extends Command {
}

if (this.project.isIndependent()) {
return taggedPackageNames.map(name => this.packageGraph.get(name));
return taggedPackageNames.map(name => this.packageGraph.get(name)).filter(name => name !== undefined);
}

return getTaggedPackages(this.packageGraph, this.project.rootPath, this.execOpts);
Expand Down
30 changes: 30 additions & 0 deletions integration/lerna-publish-custom-tag.test.js
@@ -0,0 +1,30 @@
"use strict";

const path = require("path");

const cliRunner = require("@lerna-test/cli-runner");
const gitTag = require("@lerna-test/git-tag");
const cloneFixture = require("@lerna-test/clone-fixture")(
path.resolve(__dirname, "../commands/publish/__tests__")
);

// stabilize changelog commit SHA and datestamp
expect.addSnapshotSerializer(require("@lerna-test/serialize-changelog"));

const env = {
// never actually upload when calling `npm publish`
npm_config_dry_run: true,
// skip npm package validation, none of the stubs are real
LERNA_INTEGRATION: "SKIP",
};

test("lerna publish from-git handles custom tags", async () => {
const { cwd } = await cloneFixture("independent");

await gitTag(cwd, "some-unrelated-tag");

const args = ["publish", "--yes", "from-git"];

const { stdout } = await cliRunner(cwd, env)(...args);
expect(stdout).toMatchInlineSnapshot("", ``);
});

0 comments on commit 3cb7465

Please sign in to comment.