Socket
Socket
Sign inDemoInstall

standard-version

Package Overview
Dependencies
173
Maintainers
4
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.1 to 7.0.0

defaults.js

25

CHANGELOG.md

@@ -5,2 +5,27 @@ # Changelog

## [7.0.0](https://github.com/conventional-changelog/standard-version/compare/v6.0.1...v7.0.0) (2019-07-30)
### ⚠ BREAKING CHANGES
* we were accepting .version.json as a config file, rather than .versionrc.json
### Bug Fixes
* **bump:** transmit tag prefix argument to conventionalRecommendedBump ([#393](https://github.com/conventional-changelog/standard-version/issues/393)) ([8205222](https://github.com/conventional-changelog/standard-version/commit/8205222))
* **cli:** display only one, correct default for --preset flag ([#377](https://github.com/conventional-changelog/standard-version/issues/377)) ([d17fc81](https://github.com/conventional-changelog/standard-version/commit/d17fc81))
* **commit:** don't try to process and add changelog if skipped ([#318](https://github.com/conventional-changelog/standard-version/issues/318)) ([3e4fdec](https://github.com/conventional-changelog/standard-version/commit/3e4fdec))
* **deps:** update dependency conventional-changelog-config-spec to v2 ([#352](https://github.com/conventional-changelog/standard-version/issues/352)) ([f586844](https://github.com/conventional-changelog/standard-version/commit/f586844))
* **deps:** update dependency conventional-recommended-bump to v6 ([#417](https://github.com/conventional-changelog/standard-version/issues/417)) ([4c5cad1](https://github.com/conventional-changelog/standard-version/commit/4c5cad1))
* **deps:** update dependency find-up to v4 ([#355](https://github.com/conventional-changelog/standard-version/issues/355)) ([73b35f8](https://github.com/conventional-changelog/standard-version/commit/73b35f8))
* **deps:** update dependency find-up to v4.1.0 ([#383](https://github.com/conventional-changelog/standard-version/issues/383)) ([b621a4a](https://github.com/conventional-changelog/standard-version/commit/b621a4a))
* **deps:** update dependency git-semver-tags to v3 ([#418](https://github.com/conventional-changelog/standard-version/issues/418)) ([1ce3f4a](https://github.com/conventional-changelog/standard-version/commit/1ce3f4a))
* **deps:** update dependency semver to v6.3.0 ([#366](https://github.com/conventional-changelog/standard-version/issues/366)) ([cd866c7](https://github.com/conventional-changelog/standard-version/commit/cd866c7))
* **deps:** update dependency yargs to v13.3.0 ([#401](https://github.com/conventional-changelog/standard-version/issues/401)) ([3d0e8c7](https://github.com/conventional-changelog/standard-version/commit/3d0e8c7))
* adds support for `releaseCommitMessageFormat` ([#351](https://github.com/conventional-changelog/standard-version/issues/351)) ([a7133cc](https://github.com/conventional-changelog/standard-version/commit/a7133cc))
* stop suggesting npm publish if package.json was not updated ([#319](https://github.com/conventional-changelog/standard-version/issues/319)) ([a5ac845](https://github.com/conventional-changelog/standard-version/commit/a5ac845))
* Updates package.json to _actual_ supported (tested) NodeJS versions. ([#379](https://github.com/conventional-changelog/standard-version/issues/379)) ([15eec8a](https://github.com/conventional-changelog/standard-version/commit/15eec8a))
* **deps:** update dependency yargs to v13.2.4 ([#356](https://github.com/conventional-changelog/standard-version/issues/356)) ([00b2ce6](https://github.com/conventional-changelog/standard-version/commit/00b2ce6))
* update config file name in command based on README.md ([#357](https://github.com/conventional-changelog/standard-version/issues/357)) ([ce44dd2](https://github.com/conventional-changelog/standard-version/commit/ce44dd2))
### [6.0.1](https://github.com/conventional-changelog/standard-version/compare/v6.0.0...v6.0.1) (2019-05-05)

@@ -7,0 +32,0 @@

14

command.js

@@ -5,3 +5,3 @@ const findUp = require('find-up')

const configPath = findUp.sync(['.versionrc', '.version.json'])
const configPath = findUp.sync(['.versionrc', '.versionrc.json'])
const config = configPath ? JSON.parse(readFileSync(configPath)) : {}

@@ -30,6 +30,5 @@ const spec = require('conventional-changelog-config-spec')

.option('message', {
alias: 'm',
describe: 'Commit message, replaces %s with new version',
type: 'string',
default: defaults.message
alias: ['m'],
describe: '[DEPRECATED] Commit message, replaces %s with new version.\nThis option will be removed in the next major version, please use --releaseCommitMessageFormat.',
type: 'string'
})

@@ -100,3 +99,3 @@ .option('first-release', {

default: defaults.preset,
describe: 'Commit message guideline preset (default: angular)'
describe: 'Commit message guideline preset'
})

@@ -138,4 +137,1 @@ .check((argv) => {

module.exports = yargs
// TODO: yargs should be populated with keys/descriptions from
// https://github.com/conventional-changelog/conventional-changelog-config-spec

@@ -11,2 +11,18 @@ const bump = require('./lib/lifecycles/bump')

module.exports = function standardVersion (argv) {
/**
* `--message` (`-m`) support will be removed in the next major version.
*/
const message = argv.m || argv.message
if (message) {
/**
* The `--message` flag uses `%s` for version substitutions, we swap this
* for the substitution defined in the config-spec for future-proofing upstream
* handling.
*/
argv.releaseCommitMessageFormat = message.replace(/%s/g, '{{currentTag}}')
if (!argv.silent) {
console.warn('[standard-version]: --message (-m) will be removed in the next major release. Use --releaseCommitMessageFormat.')
}
}
let pkg

@@ -13,0 +29,0 @@ bump.pkgFiles.forEach((filename) => {

@@ -1,10 +0,4 @@

const util = require('util')
module.exports = function (rawMsg, newVersion) {
const message = String(rawMsg)
const matchCount = (message.match(/%s/g) || []).length
const args = Array(1 + matchCount)
args[0] = message
args.fill(newVersion, 1, args.length)
return util.format.apply(util, args)
return message.replace(/{{currentTag}}/g, newVersion)
}

@@ -146,3 +146,4 @@ 'use strict'

preset: presetOptions,
path: args.path
path: args.path,
tagPrefix: args.tagPrefix
}, function (err, release) {

@@ -166,6 +167,4 @@ if (err) return reject(err)

const dotgit = DotGitignore()
Bump.pkgFiles.concat(Bump.lockFiles).forEach((filename) => {
configsToUpdate[path.resolve(process.cwd(), filename)] = false
})
Object.keys(configsToUpdate).forEach(function (configPath) {
Bump.pkgFiles.concat(Bump.lockFiles).forEach(function (filename) {
let configPath = path.resolve(process.cwd(), filename)
try {

@@ -179,3 +178,2 @@ if (dotgit.ignore(configPath)) return

let config = JSON.parse(data)
let filename = path.basename(configPath)
checkpoint(args, 'bumping version in ' + filename + ' from %s to %s', [config.version, newVersion])

@@ -186,3 +184,3 @@ config.version = newVersion

// as having been updated.
configsToUpdate[configPath] = true
configsToUpdate[filename] = true
}

@@ -189,0 +187,0 @@ } catch (err) {

@@ -12,3 +12,3 @@ const bump = require('../lifecycles/bump')

.then((message) => {
if (message && message.length) args.message = message
if (message && message.length) args.releaseCommitMessageFormat = message
return execCommit(args, newVersion)

@@ -23,12 +23,21 @@ })

let msg = 'committing %s'
let paths = [args.infile]
let paths = []
let verify = args.verify === false || args.n ? '--no-verify ' : ''
let toAdd = ''
// only start with a pre-populated paths list when CHANGELOG processing is not skipped
if (!args.skip.changelog) {
paths = [args.infile]
toAdd += ' ' + args.infile
}
// commit any of the config files that we've updated
// the version # for.
Object.keys(bump.getUpdatedConfigs()).forEach(function (p) {
if (bump.getUpdatedConfigs()[p]) {
paths.unshift(p)
toAdd += ' ' + path.relative(process.cwd(), p)
// account for multiple files in the output message
if (paths.length > 1) {
msg += ' and %s'
paths.unshift(path.basename(p))
toAdd += ' ' + path.relative(process.cwd(), p)
}

@@ -43,6 +52,12 @@ })

checkpoint(args, msg, paths)
return runExec(args, 'git add' + toAdd + ' ' + args.infile)
// nothing to do, exit without commit anything
if (args.skip.changelog && args.skip.bump && toAdd.length === 0) {
return Promise.resolve()
}
return runExec(args, 'git add' + toAdd)
.then(() => {
return runExec(args, 'git commit ' + verify + (args.sign ? '-S ' : '') + (args.commitAll ? '' : (args.infile + toAdd)) + ' -m "' + formatCommitMessage(args.message, newVersion) + '"')
return runExec(args, 'git commit ' + verify + (args.sign ? '-S ' : '') + (args.commitAll ? '' : (toAdd)) + ' -m "' + formatCommitMessage(args.releaseCommitMessageFormat, newVersion) + '"')
})
}

@@ -0,1 +1,2 @@

const bump = require('../lifecycles/bump')
const chalk = require('chalk')

@@ -27,7 +28,7 @@ const checkpoint = require('../checkpoint')

checkpoint(args, 'tagging release %s%s', [args.tagPrefix, newVersion])
return runExec(args, 'git tag ' + tagOption + args.tagPrefix + newVersion + ' -m "' + formatCommitMessage(args.message, newVersion) + '"')
return runExec(args, 'git tag ' + tagOption + args.tagPrefix + newVersion + ' -m "' + formatCommitMessage(args.releaseCommitMessageFormat, newVersion) + '"')
.then(() => runExec('', 'git rev-parse --abbrev-ref HEAD'))
.then((currentBranch) => {
let message = 'git push --follow-tags origin ' + currentBranch.trim()
if (pkgPrivate !== true) {
if (pkgPrivate !== true && bump.getUpdatedConfigs()['package.json']) {
message += ' && npm publish'

@@ -34,0 +35,0 @@ if (args.prerelease !== undefined) {

{
"name": "standard-version",
"version": "6.0.1",
"version": "7.0.0",
"description": "replacement for `npm version` with automatic CHANGELOG generation",

@@ -22,3 +22,3 @@ "bin": "bin/cli.js",

"engines": {
"node": ">=4.0"
"node": ">=8.0"
},

@@ -43,5 +43,5 @@ "keywords": [

"chalk": "2.4.2",
"conventional-changelog": "3.1.8",
"conventional-changelog-config-spec": "1.0.0",
"conventional-recommended-bump": "5.0.0",
"conventional-changelog": "3.1.9",
"conventional-changelog-config-spec": "2.0.0",
"conventional-recommended-bump": "6.0.0",
"detect-indent": "6.0.0",

@@ -51,24 +51,24 @@ "detect-newline": "3.0.0",

"figures": "3.0.0",
"find-up": "3.0.0",
"find-up": "4.1.0",
"fs-access": "1.0.1",
"git-semver-tags": "2.0.2",
"semver": "6.0.0",
"git-semver-tags": "3.0.0",
"semver": "6.3.0",
"stringify-package": "1.0.0",
"yargs": "13.2.2"
"yargs": "13.3.0"
},
"devDependencies": {
"chai": "4.2.0",
"coveralls": "3.0.3",
"eslint": "5.16.0",
"coveralls": "3.0.5",
"eslint": "6.1.0",
"eslint-config-standard": "12.0.0",
"eslint-plugin-import": "2.17.2",
"eslint-plugin-node": "9.0.1",
"eslint-plugin-promise": "4.1.1",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-node": "9.1.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.0",
"mocha": "6.1.4",
"mocha": "6.2.0",
"mock-git": "2.0.0",
"mockery": "2.1.0",
"nyc": "14.1.0",
"nyc": "14.1.1",
"shelljs": "0.8.3"
}
}

@@ -77,3 +77,3 @@ # Standard Version

Any of the command line paramters accepted by `standard-version` can instead
be provided via configuration.
be provided via configuration. Please refer to the [conventional-changelog-config-spec](https://github.com/conventional-changelog/conventional-changelog-config-spec/) for details on available configuration options.

@@ -104,2 +104,4 @@ ### Customizing CHANGELOG Generation

> **NOTE:** To pass nested configurations to the CLI without defining them in the `package.json` use dot notation as the parameters `e.g. --skip.changelog`.
### First Release

@@ -356,9 +358,9 @@

[`semantic-release`](https://github.com/semantic-release/semantic-release) is a fully automated library/system for versioning, changelog generation, git tagging, and publishing to the npm registry.
[`semantic-release`](https://github.com/semantic-release/semantic-release) is described as:
`standard-version` is different because it handles the versioning, changelog generation, and git tagging for you **without** automatic pushing (to GitHub) or publishing (to an npm registry). Use of `standard-version` only affects your local git repo - it doesn't affect remote resources at all. After you run `standard-version`, you still have the ability to review things and correct mistakes if you want to.
> semantic-release automates the whole package release workflow including: determining the next version number, generating the release notes and publishing the package.
They are both based on the same foundation of structured commit messages (using [Angular format](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md)), but `standard-version` is a good choice for folks who are not yet comfortable letting publishes go out automatically. In this way, you can view `standard-version` as an incremental step to adopting `semantic-release`.
While both are based on the same foundation of structured commit messages, `standard-version` takes a different approach by handling versioning, changelog generation, and git tagging for you **without** automatic pushing (to GitHub) or publishing (to an npm registry). Use of `standard-version` only affects your local git repo - it doesn't affect remote resources at all. After you run `standard-version`, you can review your release state, correct mistakes and follow the release strategy that makes the most sense for your codebase.
We think they are both fantastic tools, and we encourage folks to use `semantic-release` instead of `standard-version` if it makes sense for them.
We think they are both fantastic tools, and we encourage folks to use `semantic-release` instead of `standard-version` if it makes sense for their use-case.

@@ -365,0 +367,0 @@ ### Should I always squash commits when merging PRs?

@@ -112,10 +112,10 @@ /* global describe it beforeEach afterEach */

describe('format-commit-message', function () {
it('works for no %s', function () {
it('works for no {{currentTag}}', function () {
formatCommitMessage('chore(release): 1.0.0', '1.0.0').should.equal('chore(release): 1.0.0')
})
it('works for one %s', function () {
formatCommitMessage('chore(release): %s', '1.0.0').should.equal('chore(release): 1.0.0')
it('works for one {{currentTag}}', function () {
formatCommitMessage('chore(release): {{currentTag}}', '1.0.0').should.equal('chore(release): 1.0.0')
})
it('works for two %s', function () {
formatCommitMessage('chore(release): %s \n\n* CHANGELOG: https://github.com/conventional-changelog/standard-version/blob/v%s/CHANGELOG.md', '1.0.0').should.equal('chore(release): 1.0.0 \n\n* CHANGELOG: https://github.com/conventional-changelog/standard-version/blob/v1.0.0/CHANGELOG.md')
it('works for two {{currentTag}}', function () {
formatCommitMessage('chore(release): {{currentTag}} \n\n* CHANGELOG: https://github.com/conventional-changelog/standard-version/blob/v{{currentTag}}/CHANGELOG.md', '1.0.0').should.equal('chore(release): 1.0.0 \n\n* CHANGELOG: https://github.com/conventional-changelog/standard-version/blob/v1.0.0/CHANGELOG.md')
})

@@ -153,2 +153,20 @@ })

})
it('skipping changelog will not create a changelog file', function () {
writePackageJson('1.0.0')
commit('feat: first commit')
return execCliAsync('--skip.changelog true')
.then(function () {
getPackageVersion().should.equal('1.1.0')
let fileNotFound = false
try {
fs.readFileSync('CHANGELOG.md', 'utf-8')
} catch (err) {
fileNotFound = true
}
fileNotFound.should.equal(true)
})
})
})

@@ -194,3 +212,3 @@

content = content.replace(/patch release [0-9a-f]{6,8}/g, 'patch release ABCDEFXY').replace(/\([0-9]{4}-[0-9]{2}-[0-9]{2}\)/g, '(YYYY-MM-DD)')
content.should.equal('# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n\n### [1.0.2](/compare/v1.0.1...v1.0.2) (YYYY-MM-DD)\n\n\n### Bug Fixes\n\n* another patch release ABCDEFXY\n\n\n\n### [1.0.1](/compare/v1.0.0...v1.0.1) (YYYY-MM-DD)\n\n\n### Bug Fixes\n\n* patch release ABCDEFXY\n')
content.should.equal('# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n\n### [1.0.2](/compare/v1.0.1...v1.0.2) (YYYY-MM-DD)\n\n\n### Bug Fixes\n\n* another patch release ABCDEFXY\n\n### [1.0.1](/compare/v1.0.0...v1.0.1) (YYYY-MM-DD)\n\n\n### Bug Fixes\n\n* patch release ABCDEFXY\n')
})

@@ -397,2 +415,17 @@

describe('precommit hook', function () {
it('should run the precommit hook when provided via .versionrc.json (#371)', function () {
fs.writeFileSync('.versionrc.json', JSON.stringify({
'scripts': {
'precommit': 'node scripts/precommit'
}
}), 'utf-8')
writeHook('precommit')
fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')
commit('feat: first commit')
let result = execCli()
result.code.should.equal(0)
result.stderr.should.match(/precommit ran/)
})
it('should run the precommit hook when provided', function () {

@@ -1037,2 +1070,9 @@ writePackageJson('1.0.0', {

})
it('does not display `npm publish` if there is no package.json', function () {
shell.rm('package.json')
const result = execCli()
result.code.should.equal(0)
result.stdout.should.not.match(/npm publish/)
})
})

@@ -1053,2 +1093,44 @@

})
it('reads config from .versionrc.json', function () {
// write configuration that overrides default issue
// URL format.
fs.writeFileSync('.versionrc.json', JSON.stringify({
issueUrlFormat: 'http://www.foo.com/{{id}}'
}), 'utf-8')
commit('feat: another commit addresses issue #1')
execCli()
// CHANGELOG should have the new issue URL format.
const content = fs.readFileSync('CHANGELOG.md', 'utf-8')
content.should.include('http://www.foo.com/1')
})
it('.versionrc : releaseCommitMessageFormat', function () {
// write configuration that overrides default issue
// URL format.
fs.writeFileSync('.versionrc', JSON.stringify({
releaseCommitMessageFormat: 'This commit represents release: {{currentTag}}'
}), 'utf-8')
commit('feat: another commit addresses issue #1')
execCli()
shell.exec('git log --oneline -n1').should.include('This commit represents release: 1.1.0')
})
it('--releaseCommitMessageFormat', function () {
commit('feat: another commit addresses issue #1')
execCli('--releaseCommitMessageFormat="{{currentTag}} is the version."')
shell.exec('git log --oneline -n1').should.include('1.1.0 is the version.')
})
it('[LEGACY] supports --message (and single %s replacement)', function () {
commit('feat: another commit addresses issue #1')
execCli('--message="V:%s"')
shell.exec('git log --oneline -n1').should.include('V:1.1.0')
})
it('[LEGACY] supports -m (and multiple %s replacements)', function () {
commit('feat: another commit addresses issue #1')
execCli('--message="V:%s is the %s."')
shell.exec('git log --oneline -n1').should.include('V:1.1.0 is the 1.1.0.')
})
})

@@ -1055,0 +1137,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc