diff --git a/bin/cli.js b/bin/cli.js index 70ef2d652..d430c823b 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -1,11 +1,11 @@ #!/usr/bin/env node -var standardVersion = require('../index') -var cmdParser = require('../command') /* istanbul ignore if */ -if (process.version.match(/v(\d+)\./)[1] < 4) { - console.error('standard-version: Node v4 or greater is required. `standard-version` did not run.') +if (process.version.match(/v(\d+)\./)[1] < 6) { + console.error('standard-version: Node v6 or greater is required. `standard-version` did not run.') } else { + const standardVersion = require('../index') + const cmdParser = require('../command') standardVersion(cmdParser.argv) .catch(() => { process.exit(1) diff --git a/lib/lifecycles/changelog.js b/lib/lifecycles/changelog.js index 136f8301a..084914d11 100644 --- a/lib/lifecycles/changelog.js +++ b/lib/lifecycles/changelog.js @@ -28,11 +28,11 @@ function outputChangelog (args, newVersion) { } var content = '' var context - if (args.dryRun) context = {version: newVersion} + if (args.dryRun) context = { version: newVersion } var changelogStream = conventionalChangelog({ preset: 'angular', tagPrefix: args.tagPrefix - }, context, {merges: null}) + }, context, { merges: null }) .on('error', function (err) { return reject(err) }) diff --git a/lib/run-exec.js b/lib/run-exec.js index 4ce3cb09f..ffcd17d46 100644 --- a/lib/run-exec.js +++ b/lib/run-exec.js @@ -12,7 +12,7 @@ module.exports = function (args, cmd) { printError(args, stderr || err.message) return reject(err) } else if (stderr) { - printError(args, stderr, {level: 'warn', color: 'yellow'}) + printError(args, stderr, { level: 'warn', color: 'yellow' }) } return resolve(stdout) }) diff --git a/package.json b/package.json index ae7e75fb6..8b8a58944 100644 --- a/package.json +++ b/package.json @@ -38,23 +38,23 @@ }, "homepage": "https://github.com/conventional-changelog/standard-version#readme", "dependencies": { - "chalk": "^1.1.3", - "conventional-changelog": "^1.1.0", - "conventional-recommended-bump": "^1.0.0", + "chalk": "^2.4.1", + "conventional-changelog": "^3.0.5", + "conventional-recommended-bump": "^4.0.4", "dotgitignore": "^1.0.3", - "figures": "^1.5.0", + "figures": "^2.0.0", "fs-access": "^1.0.0", "semver": "^5.1.0", - "yargs": "^8.0.1" + "yargs": "^12.0.2" }, "devDependencies": { "chai": "^3.5.0", "coveralls": "^3.0.1", "mocha": "^5.2.0", - "mock-git": "^1.0.2", + "mock-git": "^1.0.3", "mockery": "^2.0.0", - "nyc": "^11.0.2", - "shelljs": "^0.7.3", - "standard": "^11.0.1" + "nyc": "^13.1.0", + "shelljs": "^0.7.8", + "standard": "^12.0.1" } } diff --git a/test.js b/test.js index 31b696531..b0d9e82d0 100644 --- a/test.js +++ b/test.js @@ -43,20 +43,20 @@ function execCliAsync (argString) { function writePackageJson (version, option) { option = option || {} - var pkg = Object.assign(option, {version: version}) + var pkg = Object.assign(option, { version: version }) fs.writeFileSync('package.json', JSON.stringify(pkg), 'utf-8') delete require.cache[require.resolve(path.join(process.cwd(), 'package.json'))] } function writeBowerJson (version, option) { option = option || {} - var bower = Object.assign(option, {version: version}) + var bower = Object.assign(option, { version: version }) fs.writeFileSync('bower.json', JSON.stringify(bower), 'utf-8') } function writeManifestJson (version, option) { option = option || {} - var manifest = Object.assign(option, {version: version}) + var manifest = Object.assign(option, { version: version }) fs.writeFileSync('manifest.json', JSON.stringify(manifest), 'utf-8') } @@ -607,7 +607,7 @@ describe('cli', function () { }) it('does not display `npm publish` if the package is private', function () { - writePackageJson('1.0.0', {private: true}) + writePackageJson('1.0.0', { private: true }) var result = execCli() result.code.should.equal(0) @@ -666,7 +666,7 @@ describe('standard-version', function () { describe('with mocked conventionalRecommendedBump', function () { beforeEach(function () { - mockery.enable({warnOnUnregistered: false, useCleanCache: true}) + mockery.enable({ warnOnUnregistered: false, useCleanCache: true }) mockery.registerMock('conventional-recommended-bump', function (_, cb) { cb(new Error('bump err')) }) @@ -682,7 +682,7 @@ describe('standard-version', function () { shell.exec('git tag -a v1.0.0 -m "my awesome first release"') commit('feat: new feature!') - require('./index')({silent: true}) + require('./index')({ silent: true }) .catch((err) => { err.message.should.match(/bump err/) done() @@ -692,9 +692,9 @@ describe('standard-version', function () { describe('with mocked conventionalChangelog', function () { beforeEach(function () { - mockery.enable({warnOnUnregistered: false, useCleanCache: true}) + mockery.enable({ warnOnUnregistered: false, useCleanCache: true }) mockery.registerMock('conventional-changelog', function () { - var readable = new stream.Readable({objectMode: true}) + var readable = new stream.Readable({ objectMode: true }) readable._read = function () { } setImmediate(readable.emit.bind(readable), 'error', new Error('changelog err')) @@ -712,7 +712,7 @@ describe('standard-version', function () { shell.exec('git tag -a v1.0.0 -m "my awesome first release"') commit('feat: new feature!') - require('./index')({silent: true}) + require('./index')({ silent: true }) .catch((err) => { err.message.should.match(/changelog err/) return done() @@ -725,7 +725,7 @@ describe('standard-version', function () { shell.exec('git tag -a v1.0.0 -m "my awesome first release"') commit('feat: new feature!') - require('./index')({silent: true}) + require('./index')({ silent: true }) .then(() => { // check last commit message shell.exec('git log --oneline -n1').stdout.should.match(/chore\(release\): 1\.1\.0/) @@ -738,7 +738,7 @@ describe('standard-version', function () { describe('without a package file to bump', function () { it('should exit with error', function () { shell.rm('package.json') - return require('./index')({silent: true}) + return require('./index')({ silent: true }) .catch((err) => { err.message.should.equal('no package file found') }) @@ -754,7 +754,7 @@ describe('standard-version', function () { commit('feat: first commit') shell.exec('git tag -a v1.0.0 -m "my awesome first release"') commit('feat: new feature!') - return require('./index')({silent: true}) + return require('./index')({ silent: true }) .then(() => { JSON.parse(fs.readFileSync('bower.json', 'utf-8')).version.should.equal('1.1.0') getPackageVersion().should.equal('1.1.0') @@ -771,7 +771,7 @@ describe('standard-version', function () { commit('feat: first commit') shell.exec('git tag -a v1.0.0 -m "my awesome first release"') commit('feat: new feature!') - return require('./index')({silent: true}) + return require('./index')({ silent: true }) .then(() => { JSON.parse(fs.readFileSync('manifest.json', 'utf-8')).version.should.equal('1.1.0') getPackageVersion().should.equal('1.1.0') @@ -788,7 +788,7 @@ describe('standard-version', function () { 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}) + require('./index')({ silent: true }) .then(() => { JSON.parse(fs.readFileSync('npm-shrinkwrap.json', 'utf-8')).version.should.equal('1.1.0') getPackageVersion().should.equal('1.1.0') @@ -807,7 +807,7 @@ describe('standard-version', function () { commit('feat: first commit') shell.exec('git tag -a v1.0.0 -m "my awesome first release"') commit('feat: new feature!') - return require('./index')({silent: true}) + return require('./index')({ silent: true }) .then(() => { JSON.parse(fs.readFileSync('package-lock.json', 'utf-8')).version.should.equal('1.1.0') getPackageVersion().should.equal('1.1.0') @@ -871,7 +871,7 @@ describe('standard-version', function () { commit('feat: first commit') shell.exec('git tag -a v1.0.0 -m "my awesome first release"') commit('feat: new feature!') - return require('./index')({silent: true}) + return require('./index')({ silent: true }) .then(() => { JSON.parse(fs.readFileSync('bower.json', 'utf-8')).version.should.equal('1.0.0') getPackageVersion().should.equal('1.1.0')