Socket
Socket
Sign inDemoInstall

standard-version

Package Overview
Dependencies
Maintainers
4
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

standard-version - npm Package Compare versions

Comparing version 4.0.0-0 to 4.0.0-1

8

CHANGELOG.md

@@ -5,4 +5,4 @@ # Change Log

<a name="4.0.0-0"></a>
# [4.0.0-0](https://github.com/conventional-changelog/standard-version/compare/v3.0.0...v4.0.0-0) (2016-11-26)
<a name="4.0.0-1"></a>
# [4.0.0-1](https://github.com/conventional-changelog/standard-version/compare/v3.0.0...v4.0.0-1) (2016-11-27)

@@ -13,2 +13,3 @@

* include merge commits in the changelog ([#139](https://github.com/conventional-changelog/standard-version/issues/139)) ([b6e1562](https://github.com/conventional-changelog/standard-version/commit/b6e1562))
* should print message before we bump version ([2894bbc](https://github.com/conventional-changelog/standard-version/commit/2894bbc))
* support a wording change made to git status in git v2.9.1 ([#140](https://github.com/conventional-changelog/standard-version/issues/140)) ([80004ec](https://github.com/conventional-changelog/standard-version/commit/80004ec))

@@ -19,2 +20,4 @@

* add support for bumping version # in bower.json ([#148](https://github.com/conventional-changelog/standard-version/issues/148)) ([b788c5f](https://github.com/conventional-changelog/standard-version/commit/b788c5f))
* make tag prefix configurable ([#143](https://github.com/conventional-changelog/standard-version/issues/143)) ([70b20c8](https://github.com/conventional-changelog/standard-version/commit/70b20c8))
* support releasing a custom version, including pre-releases ([#129](https://github.com/conventional-changelog/standard-version/issues/129)) ([068008d](https://github.com/conventional-changelog/standard-version/commit/068008d))

@@ -28,3 +31,2 @@

<a name="3.0.0"></a>

@@ -31,0 +33,0 @@ # [3.0.0](https://github.com/conventional-changelog/standard-version/compare/v2.3.0...v3.0.0) (2016-10-06)

@@ -7,3 +7,3 @@ var defaults = require('./defaults')

alias: 'r',
describe: 'Specify the release type manually. like npm version xxx with limited choices',
describe: 'Specify the release type manually (like npm version <major|minor|patch>)',
requiresArg: true,

@@ -67,2 +67,9 @@ string: true,

})
.option('tag-prefix', {
alias: 't',
describe: 'Set a custom prefix for the git tag to be created',
type: 'string',
default: defaults.tagPrefix,
global: true
})
.version()

@@ -69,0 +76,0 @@ .alias('version', 'v')

@@ -8,3 +8,4 @@ {

"commitAll": false,
"silent": false
"silent": false,
"tagPrefix": "v"
}

@@ -18,3 +18,2 @@ var conventionalRecommendedBump = require('conventional-recommended-bump')

var defaults = require('./defaults')
var args = objectAssign({}, defaults, argv)

@@ -33,7 +32,3 @@

newVersion = semver.inc(pkg.version, releaseType, args.prerelease)
checkpoint(args, 'bumping version in package.json from %s to %s', [pkg.version, newVersion])
pkg.version = newVersion
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf-8')
updateConfigs(args, newVersion)
} else {

@@ -57,2 +52,33 @@ checkpoint(args, 'skip version bump on first release', [], chalk.red(figures.cross))

/**
* attempt to update the version # in a collection of common config
* files, e.g., package.json, bower.json.
*
* @param argv config object
* @param newVersion version # to update to.
* @return {string}
*/
var configsToUpdate = {}
function updateConfigs (args, newVersion) {
configsToUpdate[path.resolve(process.cwd(), './package.json')] = false
configsToUpdate[path.resolve(process.cwd(), './bower.json')] = false
Object.keys(configsToUpdate).forEach(function (configPath) {
try {
var stat = fs.lstatSync(configPath)
if (stat.isFile()) {
var config = require(configPath)
var filename = path.basename(configPath)
checkpoint(args, 'bumping version in ' + filename + ' from %s to %s', [config.version, newVersion])
config.version = newVersion
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8')
// flag any config files that we modify the version # for
// as having been updated.
configsToUpdate[configPath] = true
}
} catch (err) {
if (err.code !== 'ENOENT') console.warn(err.message)
}
})
}
function getReleaseType (prerelease, expectedReleaseType, currentVersion) {

@@ -166,3 +192,2 @@ if (isString(prerelease)) {

// Exec given cmd and handle possible errors
exec(cmd, function (err, stdout, stderr) {

@@ -185,10 +210,15 @@ // If exec returns content in stderr, but no error, print it as a warning

var verify = argv.verify === false || argv.n ? '--no-verify ' : ''
if (!argv.firstRelease) {
msg += ' and %s'
args.unshift('package.json')
}
var toAdd = ''
// commit any of the config files that we've updated
// the version # for.
Object.keys(configsToUpdate).forEach(function (p) {
if (configsToUpdate[p]) {
msg += ' and %s'
args.unshift(path.basename(p))
toAdd += ' ' + path.relative(process.cwd(), p)
}
})
checkpoint(argv, msg, args)
handledExec(argv, 'git add package.json ' + argv.infile, cb, function () {
handledExec(argv, 'git commit ' + verify + (argv.sign ? '-S ' : '') + (argv.commitAll ? '' : ('package.json ' + argv.infile)) + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', cb, function () {
handledExec(argv, 'git add' + toAdd + ' ' + argv.infile, cb, function () {
handledExec(argv, 'git commit ' + verify + (argv.sign ? '-S ' : '') + (argv.commitAll ? '' : (argv.infile + toAdd)) + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', cb, function () {
cb()

@@ -211,3 +241,3 @@ })

checkpoint(argv, 'tagging release %s', [newVersion])
handledExec(argv, 'git tag ' + tagOption + 'v' + newVersion + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', cb, function () {
handledExec(argv, 'git tag ' + tagOption + argv.tagPrefix + newVersion + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', cb, function () {
var message = 'git push --follow-tags origin master'

@@ -214,0 +244,0 @@ if (pkgPrivate !== true) message += '; npm publish'

{
"name": "standard-version",
"version": "4.0.0-0",
"version": "4.0.0-1",
"description": "replacement for `npm version` with automatic CHANGELOG generation",

@@ -5,0 +5,0 @@ "bin": "bin/cli.js",

@@ -26,5 +26,5 @@ # Standard Version

1. bumps the version in _package.json_ (based on your commit history)
1. bumps the version in _package.json/bower.json_ (based on your commit history)
2. uses [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) to update _CHANGELOG.md_
3. commits _package.json_ and _CHANGELOG.md_
3. commits _package.json (et al.)_ and _CHANGELOG.md_
4. tags a new release

@@ -81,3 +81,3 @@

This will tag a release **without bumping the version in package.json**.
This will tag a release **without bumping the version in package.json (_et al._)**.

@@ -84,0 +84,0 @@ When ready, push the git tag and `npm publish` your first release. \o/

@@ -52,2 +52,8 @@ /* global describe it beforeEach afterEach */

function writeBowerJson (version, option) {
option = option || {}
var bower = objectAssign(option, { version: version })
fs.writeFileSync('bower.json', JSON.stringify(bower), 'utf-8')
}
function writeGitPreCommitHook () {

@@ -156,3 +162,3 @@ fs.writeFileSync('.git/hooks/pre-commit', '#!/bin/sh\necho "precommit ran"\nexit 1', 'utf-8')

})
captured[captured.length - 3].should.deep.equal(['commit', '-S', 'package.json', 'CHANGELOG.md', '-m', 'chore(release): 1.0.1'])
captured[captured.length - 3].should.deep.equal(['commit', '-S', 'CHANGELOG.md', 'package.json', '-m', 'chore(release): 1.0.1'])
captured[captured.length - 2].should.deep.equal(['tag', '-s', 'v1.0.1', '-m', 'chore(release): 1.0.1'])

@@ -485,2 +491,20 @@

})
describe('bower.json support', function () {
beforeEach(function () {
writeBowerJson('1.0.0')
})
it('bumps verson # in bower.json', function (done) {
commit('feat: first commit')
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
commit('feat: new feature!')
require('./index')({silent: true}, function (err) {
if (err) return done(err)
JSON.parse(fs.readFileSync('package.json', 'utf-8')).version.should.equal('1.1.0')
getPackageVersion().should.equal('1.1.0')
done()
})
})
})
})
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc