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: allows to use semver strictly on versions less than 1.0.0 #780

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mimarec
Copy link

@mimarec mimarec commented Jul 8, 2021

This PR allows to follow the convention established by SEMVER for the version increment regardless of whether it is a stable version or not (equal or higher than 1.0.0).

In order to follow this convention the strict-semver property is added to the initial configuration.

const defaults = {
  infile: 'CHANGELOG.md',
  firstRelease: false,
  sign: false,
  noVerify: false,
  commitAll: false,
  silent: false,
  tagPrefix: 'v',
  scripts: {},
  skip: {},
  dryRun: false,
  strictSemver: false,
  gitTagFallback: true,
  preset: require.resolve('conventional-changelog-conventionalcommits')
}

By default this property will have value false to maintain the current behavior which is described in this section #347 #308 #310

The value of strict-semver is evaluated in the bump.js file to determine whether to strictly follow semver or to apply the current behavior.

if (typeof presetOptions === 'object') {
    if (semver.lt(currentVersion, '1.0.0') && !args.strictSemver) presetOptions.preMajor = true
}

You can set this property as follows:

  1. Set the strict-semver property to standard-version stanza in your package.json(assuming your project is JavaScript).
  2. Place the strict-semver property in a .versionrc, .versionrc.json or .versionrc.js.

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

Successfully merging this pull request may close these issues.

1 participant