standard-version
Advanced tools
Comparing version 9.1.1 to 9.2.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [9.2.0](https://www.github.com/conventional-changelog/standard-version/compare/v9.1.1...v9.2.0) (2021-04-06) | ||
### Features | ||
* allows seperate prefixTag version sequences ([#573](https://www.github.com/conventional-changelog/standard-version/issues/573)) ([3bbba02](https://www.github.com/conventional-changelog/standard-version/commit/3bbba025057ba40c3e15880fede2af851841165b)) | ||
### [9.1.1](https://www.github.com/conventional-changelog/standard-version/compare/v9.1.0...v9.1.1) (2021-02-06) | ||
@@ -7,0 +14,0 @@ |
@@ -59,3 +59,3 @@ const bump = require('./lib/lifecycles/bump') | ||
} else if (args.gitTagFallback) { | ||
version = await latestSemverTag() | ||
version = await latestSemverTag(args.tagPrefix) | ||
} else { | ||
@@ -62,0 +62,0 @@ throw new Error('no package file found') |
const gitSemverTags = require('git-semver-tags') | ||
const semver = require('semver') | ||
module.exports = function () { | ||
module.exports = function (tagPrefix = undefined) { | ||
return new Promise((resolve, reject) => { | ||
gitSemverTags(function (err, tags) { | ||
gitSemverTags({ tagPrefix }, function (err, tags) { | ||
if (err) return reject(err) | ||
else if (!tags.length) return resolve('1.0.0') | ||
// Respect tagPrefix | ||
tags = tags.map(tag => tag.replace(new RegExp('^' + tagPrefix), '')) | ||
// ensure that the largest semver tag is at the head. | ||
@@ -10,0 +12,0 @@ tags = tags.map(tag => { return semver.clean(tag) }) |
{ | ||
"name": "standard-version", | ||
"version": "9.1.1", | ||
"version": "9.2.0", | ||
"description": "replacement for `npm version` with automatic CHANGELOG generation", | ||
@@ -11,2 +11,3 @@ "bin": "bin/cli.js", | ||
"test:unit": "mocha --exclude test/git.spec.js", | ||
"coverage": "nyc report --reporter=lcov", | ||
"release": "bin/cli.js" | ||
@@ -58,3 +59,2 @@ }, | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.1.0", | ||
"eslint": "^7.14.0", | ||
@@ -65,6 +65,6 @@ "eslint-config-standard": "^16.0.2", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"mocha": "^8.0.0", | ||
"mock-fs": "^4.12.0", | ||
"mocha": "^8.2.1", | ||
"mock-fs": "^4.13.0", | ||
"mockery": "^2.1.0", | ||
"nyc": "^14.1.1", | ||
"nyc": "^15.1.0", | ||
"shelljs": "^0.8.4", | ||
@@ -71,0 +71,0 @@ "std-mocks": "^1.0.1" |
@@ -7,3 +7,3 @@ # Standard Version | ||
[![NPM version](https://img.shields.io/npm/v/standard-version.svg)](https://www.npmjs.com/package/standard-version) | ||
[![Coverage Status](https://coveralls.io/repos/conventional-changelog/standard-version/badge.svg?branch=)](https://coveralls.io/r/conventional-changelog/standard-version?branch=master) | ||
[![codecov](https://codecov.io/gh/conventional-changelog/standard-version/branch/master/graph/badge.svg?token=J7zMN7vTTd)](https://codecov.io/gh/conventional-changelog/standard-version) | ||
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) | ||
@@ -271,9 +271,22 @@ [![Community slack](http://devtoolscommunity.herokuapp.com/badge.svg)](http://devtoolscommunity.herokuapp.com) | ||
If you want to commit generated artifacts in the release commit (e.g. [#96](https://github.com/conventional-changelog/standard-version/issues/96)), you can use the `--commit-all` or `-a` flag. You will need to stage the artifacts you want to commit, so your `release` command could look like this: | ||
If you want to commit generated artifacts in the release commit, you can use the `--commit-all` or `-a` flag. You will need to stage the artifacts you want to commit, so your `release` command could look like this: | ||
```json | ||
"prerelease": "webpack -p --bail", | ||
"release": "git add <file(s) to commit> && standard-version -a" | ||
{ | ||
"standard-version": { | ||
"scripts": { | ||
"prerelease": "webpack -p --bail && git add <file(s) to commit>" | ||
} | ||
} | ||
} | ||
``` | ||
```json | ||
{ | ||
"scripts": { | ||
"release": "standard-version -a" | ||
} | ||
} | ||
``` | ||
### Dry Run Mode | ||
@@ -301,4 +314,6 @@ | ||
If you do not want to have any tag prefix you can use the `-t` flag without value. | ||
If you do not want to have any tag prefix you can use the `-t` flag and provide it with an **empty string** as value. | ||
> Note: simply -t or --tag-prefix without any value will fallback to the default 'v' | ||
### CLI Help | ||
@@ -361,5 +376,3 @@ | ||
2. Specify the `bumpFile` "`updater`", this is _how_ the file will be bumped. | ||
a. If you're using a common type, you can use one of `standard-version`'s built-in `updaters` by specifying a `type`. | ||
b. If your using an less-common version file, you can create your own `updater`. | ||
@@ -366,0 +379,0 @@ |
@@ -69,3 +69,3 @@ /* global describe it beforeEach afterEach */ | ||
mockery.registerMock('git-semver-tags', function (cb) { | ||
mockery.registerMock('git-semver-tags', function (_, cb) { | ||
if (tags instanceof Error) cb(tags) | ||
@@ -107,2 +107,25 @@ else cb(null, tags || []) | ||
describe('tagPrefix', () => { | ||
// TODO: Use unmocked git-semver-tags and stage a git environment | ||
it('will add prefix onto tag based on version from package', async function () { | ||
writePackageJson('1.2.0') | ||
mock({ bump: 'minor', tags: ['p-v1.2.0'] }) | ||
await exec('--tag-prefix p-v') | ||
shell.exec('git tag').stdout.should.match(/p-v1\.3\.0/) | ||
}) | ||
it('will add prefix onto tag via when gitTagFallback is true and no package [cli]', async function () { | ||
shell.rm('package.json') | ||
mock({ bump: 'minor', tags: ['android/production/v1.2.0', 'android/production/v1.0.0'] }) | ||
await exec('--tag-prefix android/production/v') | ||
shell.exec('git tag').stdout.should.match(/android\/production\/v1\.3\.0/) | ||
}) | ||
it('will add prefix onto tag via when gitTagFallback is true and no package [options]', async function () { | ||
mock({ bump: 'minor', tags: ['android/production/v1.2.0', 'android/production/v1.0.0'] }) | ||
await exec({ tagPrefix: 'android/production/v', packageFiles: [] }) | ||
shell.exec('git tag').stdout.should.match(/android\/production\/v1\.3\.0/) | ||
}) | ||
}) | ||
it('formats the commit and tag messages appropriately', async function () { | ||
@@ -109,0 +132,0 @@ mock({ bump: 'minor', tags: ['v1.0.0'] }) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128398
12
1980
469