Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(conventional-commits): Add conventional prerelease/graduation #1991

Merged
merged 6 commits into from May 11, 2019

Conversation

erquhart
Copy link
Contributor

@erquhart erquhart commented Mar 15, 2019

Description

Provides --conventional-commits recommended bumps for prerelease packages. Ensures that the current prerelease version, as well as the eventual graduated version, are semver compliant based on the commit messages of contained changes. When additional prereleases occur and the current prerelease base version is already adequate, the numeric prerelease identifier is incremented.

Prerelease bump logic is best illustrated in related tests:

it("stable + fix/minor/major => prepatch/preminor/premajor", async () => {
// default initial version is "1.0.0"
expect(await recommend("fix: changed")).toBe("1.0.1-beta.0");
expect(await recommend("feat: changed")).toBe("1.1.0-beta.0");
expect(await recommend("feat: changed\n\nBREAKING CHANGE: changed")).toBe("2.0.0-beta.0");
});
it("prepatch + fix/minor/major => prerelease/preminor/premajor", async () => {
expect(await recommend("fix: changed", { initVersion: "1.0.1-beta.0" })).toBe("1.0.1-beta.1");
expect(await recommend("feat: changed")).toBe("1.1.0-beta.0");
expect(await recommend("feat: changed\n\nBREAKING CHANGE: changed")).toBe("2.0.0-beta.0");
});
it("preminor + fix/minor/major => prerelease/prerelease/premajor", async () => {
expect(await recommend("fix: changed", { initVersion: "1.1.0-beta.0" })).toBe("1.1.0-beta.1");
expect(await recommend("feat: changed")).toBe("1.1.0-beta.1");
expect(await recommend("feat: changed\n\nBREAKING CHANGE: changed")).toBe("2.0.0-beta.0");
});
it("premajor + fix/minor/major => prerelease", async () => {
expect(await recommend("fix: changed", { initVersion: "2.0.0-beta.0" })).toBe("2.0.0-beta.1");
expect(await recommend("feat: changed")).toBe("2.0.0-beta.1");
expect(await recommend("feat: changed\n\nBREAKING CHANGE: changed")).toBe("2.0.0-beta.1");
});

Updates --conventional-commits to keep prereleased packages in prerelease and stable packages out of prerelease, but still providing semver bumps as expected.

Flags for use with --conventional-commits:

--conventional-prerelease
Releases all unreleased changes to pre(patch/minor/major/release) by prefixing the recommendation from conventional-changelog. Optionally accepts specific packages, in which case unspecified packages with changes present will be processed as they normally would using --conventional-commits.

--conventional-graduate
Graduates all prereleased packages, whether the current HEAD has been released or not. Similar to --force-publish, but ignores non-prerelease packages (unless they depend on a package that is being graduated). If unreleased changes are present, and the base version is inadequate for those changes, eg. features in a prepatch, the resulting package version(s) will reflect the recommended bump from conventional-commits. Optionally accepts specific packages, in which case unspecified packages will be processed as they normally would using --conventional-commits.

Flags for use with or without --conventional-commits:

--pre-dist-tag
Works identically to --dist-tag, except only applies for packages being released with a prerelease version. Necessary for proper npm dist tagging with independent versioning, where prerelease and stable versions may be released at once, and require different tags. Can be combined with --dist-tag.

Motivation and Context

Fixes #1433 by providing a predictable, CI compatible approach to prerelease publishing for projects using conventional commits, including those using independent or fixed versioning. My immediate context is a desire to publish beta releases from master every time a new PR is merged.

Fixes #1675 by using checkWorkingTree.uncommittedChanges directly in the version command script when --force-publish (or --conventional-graduate) is set.

How Has This Been Tested?

  • Covered all changes with integration and unit tests.
  • Running production prereleases/releases of netlify-cms using a published testing fork of this PR (@erquhart/lerna).

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@erquhart erquhart force-pushed the conventional-commits-prerelease branch 4 times, most recently from c78d9a0 to eeaabaf Compare March 19, 2019 22:34
@erquhart erquhart changed the title Add conventional commits prerelease versioning feat(conventional-commits): Add conventional prerelease/graduation Mar 20, 2019
@erquhart erquhart force-pushed the conventional-commits-prerelease branch 5 times, most recently from 04bcc3b to 2ba19b5 Compare March 21, 2019 02:23
@erquhart erquhart marked this pull request as ready for review March 21, 2019 02:25
@pantoninho
Copy link

pantoninho commented Mar 21, 2019

You sir, have made my day. Can’t wait to try this out.

Wonderful job!

@erquhart erquhart force-pushed the conventional-commits-prerelease branch 2 times, most recently from 35c42bd to 72f922a Compare March 21, 2019 14:41
@@ -346,6 +377,7 @@ class VersionCommand extends Command {
changelogPreset,
rootPath,
tagPrefix: this.tagPrefix,
prereleaseId: getPrereleaseId(node),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic determining whether to prerelease stable packages (shouldPrerelease) or graduate prereleasePackages (shouldGraduate) is encapsulated here so that ConventionalCommitUtilties.recommendVersion is only reacting to the presence or absence of prereleaseId.

@@ -35,8 +49,15 @@ function recommendVersion(pkg, type, { changelogPreset, rootPath, tagPrefix }) {
// we still need to bump _something_ because lerna saw a change here
const releaseType = data.releaseType || "patch";

log.verbose(type, "increment %s by %s", pkg.version, releaseType);
resolve(semver.inc(pkg.version, releaseType));
if (prereleaseId) {
Copy link
Contributor Author

@erquhart erquhart Mar 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prereleaseId both activates prerelease recommendations and provides the prerelease ID to be used. This function doesn't know why it's prereleasing, just whether to do it or not.

let candidates;
// --conventional-commits --conventional-graduate
if (useConventionalGraduate) {
if (forced.has("*")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If --conventional-graduate is different from --force-publish in that it only impacts packages that are in prerelease and never affects packages that are not in any way. This is why we don't set all packages as candidates here as we do with --force-publish.


module.exports = collectPackages;

function collectPackages(packages, { isCandidate = () => true, onInclude } = {}) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This felt like a smart abstraction as prerelease functionality introduced a need to collect dependents from outside of collect-updates. Tests were added for the new function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!


module.exports = getPackagesForOption;

function getPackagesForOption(option) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed getForcedPackages to this more generic function for use with options besided --force-publish.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call

const { forcePublish, conventionalCommits, conventionalGraduate } = this.options;
const checkUncommittedOnly = forcePublish || (conventionalCommits && conventionalGraduate);
const check = checkUncommittedOnly ? checkWorkingTree.throwIfUncommitted : checkWorkingTree;
tasks.unshift(() => check(this.execOpts));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These four lines are the fix for #1675.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrm, ok, this is confusing when conflated with the rest of the logic. I'd prefer this was in a separate PR for clarity.

Copy link
Contributor Author

@erquhart erquhart Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR isn't complete without these four lines - graduation of prereleases is facilitated by passing --conventional-graduate, and that fails without this fix. It just so happens that this same issue is also a known bug for --force-publish.

@erquhart
Copy link
Contributor Author

--conventional-graduate in action with a released HEAD (okay there was one commit added but it was a chore that didn't touch these packages!):

$ run-s "publish:version --conventional-graduate"
$ lerna version --no-push --conventional-graduate
lerna notice cli v3.14.1
lerna WARN conventional-graduate all packages

Changes:
 - netlify-cms-backend-bitbucket: 2.2.0-beta.0 => 2.2.0
 - netlify-cms-backend-git-gateway: 2.3.0-beta.0 => 2.3.0
 - netlify-cms-backend-github: 2.3.0-beta.0 => 2.3.0
 - netlify-cms-backend-gitlab: 2.2.0-beta.0 => 2.2.0
 - netlify-cms-backend-test: 2.1.0-beta.0 => 2.1.0
 - netlify-cms-core: 2.9.0-beta.0 => 2.9.0
 - netlify-cms-editor-component-image: 2.3.0-beta.0 => 2.3.0
 - netlify-cms-lib-auth: 2.1.0-beta.0 => 2.1.0
 - netlify-cms-lib-util: 2.2.0-beta.0 => 2.2.0
 - netlify-cms-media-library-cloudinary: 1.2.0-beta.0 => 1.2.0
 - netlify-cms-media-library-uploadcare: 0.4.0-beta.0 => 0.4.0
 - netlify-cms-ui-default: 2.5.0-beta.0 => 2.5.0
 - netlify-cms-widget-boolean: 2.1.0-beta.0 => 2.1.0
 - netlify-cms-widget-date: 2.2.0-beta.0 => 2.2.0
 - netlify-cms-widget-datetime: 2.1.0-beta.0 => 2.1.0
 - netlify-cms-widget-file: 2.3.0-beta.0 => 2.3.0
 - netlify-cms-widget-image: 2.2.0-beta.0 => 2.2.0
 - netlify-cms-widget-list: 2.2.0-beta.0 => 2.2.0
 - netlify-cms-widget-map: 1.2.0-beta.0 => 1.2.0
 - netlify-cms-widget-markdown: 2.3.0-beta.0 => 2.3.0
 - netlify-cms-widget-number: 2.2.0-beta.0 => 2.2.0
 - netlify-cms-widget-object: 2.1.0-beta.0 => 2.1.0
 - netlify-cms-widget-relation: 2.2.0-beta.0 => 2.2.0
 - netlify-cms-widget-select: 2.3.0-beta.0 => 2.3.0
 - netlify-cms-widget-string: 2.1.0-beta.0 => 2.1.0
 - netlify-cms-widget-text: 2.1.0-beta.0 => 2.1.0
 - netlify-cms: 2.7.0-beta.0 => 2.7.0

? Are you sure you want to create these versions? (ynH)

@evocateur
Copy link
Member

@erquhart This is exciting, I will have time to review soon!

@erquhart
Copy link
Contributor Author

erquhart commented Mar 29, 2019

Update: still working great in production. We now have a workflow of prereleasing to @beta, and always doing one final prerelease before graduating to stable, so that beta channel users always have the latest stable changes when available.

Recent dry run showing graduations after a few rounds of prerelease:

Latest commit (Lerna release)

$ git log -1
commit 002b8b43459a319f1ddff40816891aef272c7eed (HEAD -> master, tag: netlify-cms@2.9.0-beta.1, tag: netlify-cms-app@2.9.0-beta.1, upstream/master, upstream/H
Author: Shawn Erquhart <shawn@erquh.art>
Date:   Fri Mar 29 12:54:48 2019 -0400

    chore(release): publish

     - netlify-cms-app@2.9.0-beta.1
     - netlify-cms@2.9.0-beta.1

Dry run of lerna version --conventional-commits --conventional-graduate with released HEAD

$ lerna version --no-push --conventional-graduate --no-git-tag-version
lerna notice cli v3.14.1
lerna WARN conventional-graduate all packages
lerna WARN version Skipping working tree validation, proceed at your own risk

Changes:
 - netlify-cms-app: 2.9.0-beta.1 => 2.9.0
 - netlify-cms-backend-bitbucket: 2.3.1-beta.1 => 2.3.1
 - netlify-cms-backend-git-gateway: 2.4.1-beta.1 => 2.4.1
 - netlify-cms-backend-github: 2.4.1-beta.1 => 2.4.1
 - netlify-cms-backend-gitlab: 2.3.1-beta.1 => 2.3.1
 - netlify-cms-backend-test: 2.2.1-beta.1 => 2.2.1
 - netlify-cms-core: 2.10.1-beta.2 => 2.10.1
 - netlify-cms-default-exports: 2.2.1-beta.2 => 2.2.1
 - netlify-cms-editor-component-image: 2.4.1-beta.1 => 2.4.1
 - netlify-cms-lib-auth: 2.2.1-beta.1 => 2.2.1
 - netlify-cms-lib-util: 2.3.1-beta.1 => 2.3.1
 - netlify-cms-media-library-cloudinary: 1.3.1-beta.1 => 1.3.1
 - netlify-cms-media-library-uploadcare: 0.5.1-beta.1 => 0.5.1
 - netlify-cms-ui-default: 2.6.1-beta.1 => 2.6.1
 - netlify-cms-widget-boolean: 2.2.1-beta.2 => 2.2.1
 - netlify-cms-widget-date: 2.3.1-beta.2 => 2.3.1
 - netlify-cms-widget-datetime: 2.2.1-beta.2 => 2.2.1
 - netlify-cms-widget-file: 2.4.1-beta.2 => 2.4.1
 - netlify-cms-widget-image: 2.3.1-beta.2 => 2.3.1
 - netlify-cms-widget-list: 2.3.1-beta.2 => 2.3.1
 - netlify-cms-widget-map: 1.3.1-beta.2 => 1.3.1
 - netlify-cms-widget-markdown: 2.4.1-beta.2 => 2.4.1
 - netlify-cms-widget-number: 2.3.1-beta.2 => 2.3.1
 - netlify-cms-widget-object: 2.2.1-beta.2 => 2.2.1
 - netlify-cms-widget-relation: 2.3.1-beta.2 => 2.3.1
 - netlify-cms-widget-select: 2.4.1-beta.2 => 2.4.1
 - netlify-cms-widget-string: 2.2.1-beta.2 => 2.2.1
 - netlify-cms-widget-text: 2.2.1-beta.2 => 2.2.1
 - netlify-cms: 2.9.0-beta.1 => 2.9.0

? Are you sure you want to create these versions? (ynH)

Note the differences in bump level, some patch, some minor, varying prerelease increment, all graduated to the proper version.

Copy link
Member

@evocateur evocateur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, made it part-way through, this is a really big PR.

My initial concerns are mostly around the conflation of the "allow forcing publish on a release-tagged commit" and the prerelease graduation logic. I'll have to finish the review later.

const distTag = getDistTag(pkg.get("publishConfig"));
const preDistTag = this.getPreDistTag(pkg);
const distTag = preDistTag || getDistTag(pkg.get("publishConfig"));
opts.tag = preDistTag || opts.tag;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really shouldn't be mutating the outer opts.tag inside the mapper. The only value that matters here is distTag, the parameter passed to npmDistTag.add(), opts.tag should never be considered when the underlying code executes (it's always overwritten by the parameter here).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I wasn't understanding that the config snapshot should continue to show the dist-tag and ignore pre-dist-tag (as they can be used together).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix: 850bc22

if (!this.options.preDistTag) {
return;
}
const isPrerelease = (semver.prerelease(pkg.version) || []).shift();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is lifted from here, I'd rather not duplicate it.

Suggested change
const isPrerelease = (semver.prerelease(pkg.version) || []).shift();
const isPrerelease = this.packageGraph.get(pkg.name).prereleaseId;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that prereleaseId can now change, but we're currently setting it as a static value. I was considering addressing this but wanted to limit PR scope creep wherever possible. I'll update packageGraph to use a getter for prereleaseId.

Copy link
Contributor Author

@erquhart erquhart Apr 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we're working with a Package, not a PackageGraphNode - the version isn't up to date in the graph when we need to get the preDistTag, so have to determine prereleaseId from the Package instances in the mapper.

Considering that this logic was already duplicated here (and in the related test), I'll just separate out the logic itself. It should probably be tested directly anyway, critical little bit of logic here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix: 70fb630

@@ -48,6 +48,9 @@ expect.addSnapshotSerializer(require("@lerna-test/serialize-git-sha"));

describe("VersionCommand", () => {
describe("normal mode", () => {
beforeEach(() => {
checkWorkingTree.mockReset();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? We are already clearing mocks after every test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resetting removes mock implementations (clearing doesn't). This shouldn't have been necessary since mockImplementationOnce is being used, a second look revealed that I shouldn't be mocking an implementation for an error that is not expected. Fixed.

Copy link
Contributor Author

@erquhart erquhart Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix: 4fa9017

const testDir = await initFixture("normal");
await lernaVersion(testDir)("--force-publish");

expect.assertions(0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this take make an active assertion, such as expect().not.toThrow(). Also, unclear why this test is in this PR?

Copy link
Contributor Author

@erquhart erquhart Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding why this test is here, it's because --force-publish happened to be fixed here. Will address assertion style.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making sure this particular call doesn't throw is just a bad approach in general. Going to test for a positive outcome instead.

Copy link
Contributor Author

@erquhart erquhart Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix: 4fa9017

const { forcePublish, conventionalCommits, conventionalGraduate } = this.options;
const checkUncommittedOnly = forcePublish || (conventionalCommits && conventionalGraduate);
const check = checkUncommittedOnly ? checkWorkingTree.throwIfUncommitted : checkWorkingTree;
tasks.unshift(() => check(this.execOpts));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrm, ok, this is confusing when conflated with the rest of the logic. I'd prefer this was in a separate PR for clarity.

@erquhart
Copy link
Contributor Author

erquhart commented Apr 2, 2019

@evocateur I added commits to close the first round of review, replied to each of your actionable comments with commit links. I know the difficulty of reviewing a large changeset like this, especially from a new contributor. Hope it helps!


function prereleaseIdFromVersion(version) {
return (semver.prerelease(version) || []).shift();
}
Copy link
Contributor Author

@erquhart erquhart Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this feels a bit like overkill, but I really couldn't find a better path that fits existing code org patterns in the repo. This (ridiculously simple) logic is reused in different verticals across the codebase, like core and command, so it couldn't be dropped in an existing common lib. If you're up for adding a lib directory at the top level for little bits like this, I'm happy to drop this commit and add one that does that instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, this is great!

@erquhart erquhart force-pushed the conventional-commits-prerelease branch from a9ba5df to 4fa9017 Compare April 2, 2019 01:57
Copy link
Member

@evocateur evocateur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for your patience, and thanks a ton for this PR!


module.exports = collectPackages;

function collectPackages(packages, { isCandidate = () => true, onInclude } = {}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!


module.exports = getPackagesForOption;

function getPackagesForOption(option) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call


function prereleaseIdFromVersion(version) {
return (semver.prerelease(version) || []).shift();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, this is great!

"version": "7.2.2",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.2.2.tgz",
"integrity": "sha512-59vB0RWt09cAct5EIe58+NzGP4TFSD3Bz//2/ELy3ZeTeKF6VTD1AXlH8BGGbCX0PuobZBsIzO7IAI9PH67eKw==",
"version": "7.3.4",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure why there are so many diffs in the lockfile, but if it isn't conflicting, I'm fine with it.

@@ -154,6 +155,14 @@ lerna publish --canary --preid next
When run with this flag, `lerna publish --canary` will increment `premajor`, `preminor`, `prepatch`, or `prerelease` semver
bumps using the specified [prerelease identifier](http://semver.org/#spec-item-9).

### `--pre-dist-tag <tag>`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any of these flags documented in the yargs command builder for publish: https://github.com/lerna/lerna/blob/master/commands/publish/command.js

I suppose it's not vital, since yargs seems perfectly happy to consume them implicitly...

@evocateur evocateur force-pushed the conventional-commits-prerelease branch from 4fa9017 to 05e0fd7 Compare May 11, 2019 00:41
@evocateur
Copy link
Member

That was a fun rebase (my own fault)

@evocateur evocateur merged commit 5d84b61 into lerna:master May 11, 2019
@erquhart erquhart deleted the conventional-commits-prerelease branch May 15, 2019 17:59
@erquhart
Copy link
Contributor Author

Thank for getting it in!

@inside
Copy link

inside commented May 23, 2019

Hi,

I believe the behavior of --conventional-commits is now a breaking change and has to be used in conjunction with --conventional-graduate to keep the same behavior as before. Example:

% npx lerna -v 
3.13.4
% npx lerna version --no-push
...debug stripped...
Changes:
- @foo/bar: 1.0.0-rc.0 => 1.0.0
% npx lerna -v
3.14.1
% npx lerna version --no-push
...debug stripped...
Changes:
- @foo/bar: 1.0.0-rc.0 => 1.0.0-rc.1

If you guys can tell me if I'm missing something in the way semver works, thanks 👍

@erquhart
Copy link
Contributor Author

Conventional commits didn't really have any logical or intentional behavior for prereleases, so it's fair to say that using --conventional-commits on a prerelease was not supported prior to 3.14.0. If someone was using that flag against a prerelease before prerelease support was added, what resulted was unintentional on the part of Lerna. So if you happened to be depending on that unintentional functionality, it will feel like a breaking change, but the change didn't break any documented functionality of Lerna.

But to your immediate point, yes, to duplicate the result of --conventional-commits from before prerelease support was added, you'll need to add the --conventional-graduate flag.

@evocateur
Copy link
Member

Wait, --conventional-graduate is necessary to preserve 1.0.0-rc.0 -> 1.0.0-rc.1? That seems backwards, I would expect --conventional-prerelease to do that...

@erquhart
Copy link
Contributor Author

erquhart commented May 23, 2019

No, --conventional-commits preserves the prerelease by itself, without any other flags - it keeps prerelease packages in prerelease and non-prerelease packages out of prerelease. Adding --conventional-prerelease only impacts non-prerelease packages, moving them into prerelease. --conventional-graduate moves all packages out of prerelease, which used to be the only behavior with the --conventional-commits flag.

@inside
Copy link

inside commented May 24, 2019

Thank you @erquhart it makes sense to me now! 😄

@acao
Copy link

acao commented Dec 17, 2019

does anyone have this working in CI? I keep getting a prompts even with --yes. about to open a bug

@erquhart
Copy link
Contributor Author

I've used in CI in the past without issue, been doing it manually the last few months, though. Maybe something changed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants