Skip to content

Commit e1b5780

Browse files
authored
fix: bin now enforces Node.js > 4 (conventional-changelog#274)
1 parent 1d46627 commit e1b5780

File tree

5 files changed

+32
-32
lines changed

5 files changed

+32
-32
lines changed

bin/cli.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env node
2-
var standardVersion = require('../index')
3-
var cmdParser = require('../command')
42

53
/* istanbul ignore if */
6-
if (process.version.match(/v(\d+)\./)[1] < 4) {
7-
console.error('standard-version: Node v4 or greater is required. `standard-version` did not run.')
4+
if (process.version.match(/v(\d+)\./)[1] < 6) {
5+
console.error('standard-version: Node v6 or greater is required. `standard-version` did not run.')
86
} else {
7+
const standardVersion = require('../index')
8+
const cmdParser = require('../command')
99
standardVersion(cmdParser.argv)
1010
.catch(() => {
1111
process.exit(1)

lib/lifecycles/changelog.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ function outputChangelog (args, newVersion) {
2828
}
2929
var content = ''
3030
var context
31-
if (args.dryRun) context = {version: newVersion}
31+
if (args.dryRun) context = { version: newVersion }
3232
var changelogStream = conventionalChangelog({
3333
preset: 'angular',
3434
tagPrefix: args.tagPrefix
35-
}, context, {merges: null})
35+
}, context, { merges: null })
3636
.on('error', function (err) {
3737
return reject(err)
3838
})

lib/run-exec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = function (args, cmd) {
1212
printError(args, stderr || err.message)
1313
return reject(err)
1414
} else if (stderr) {
15-
printError(args, stderr, {level: 'warn', color: 'yellow'})
15+
printError(args, stderr, { level: 'warn', color: 'yellow' })
1616
}
1717
return resolve(stdout)
1818
})

package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@
3838
},
3939
"homepage": "https://github.com/conventional-changelog/standard-version#readme",
4040
"dependencies": {
41-
"chalk": "^1.1.3",
42-
"conventional-changelog": "^1.1.0",
43-
"conventional-recommended-bump": "^1.0.0",
41+
"chalk": "^2.4.1",
42+
"conventional-changelog": "^3.0.5",
43+
"conventional-recommended-bump": "^4.0.4",
4444
"dotgitignore": "^1.0.3",
45-
"figures": "^1.5.0",
45+
"figures": "^2.0.0",
4646
"fs-access": "^1.0.0",
4747
"semver": "^5.1.0",
48-
"yargs": "^8.0.1"
48+
"yargs": "^12.0.2"
4949
},
5050
"devDependencies": {
5151
"chai": "^3.5.0",
5252
"coveralls": "^3.0.1",
5353
"mocha": "^5.2.0",
54-
"mock-git": "^1.0.2",
54+
"mock-git": "^1.0.3",
5555
"mockery": "^2.0.0",
56-
"nyc": "^11.0.2",
57-
"shelljs": "^0.7.3",
58-
"standard": "^11.0.1"
56+
"nyc": "^13.1.0",
57+
"shelljs": "^0.7.8",
58+
"standard": "^12.0.1"
5959
}
6060
}

test.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,20 @@ function execCliAsync (argString) {
4343

4444
function writePackageJson (version, option) {
4545
option = option || {}
46-
var pkg = Object.assign(option, {version: version})
46+
var pkg = Object.assign(option, { version: version })
4747
fs.writeFileSync('package.json', JSON.stringify(pkg), 'utf-8')
4848
delete require.cache[require.resolve(path.join(process.cwd(), 'package.json'))]
4949
}
5050

5151
function writeBowerJson (version, option) {
5252
option = option || {}
53-
var bower = Object.assign(option, {version: version})
53+
var bower = Object.assign(option, { version: version })
5454
fs.writeFileSync('bower.json', JSON.stringify(bower), 'utf-8')
5555
}
5656

5757
function writeManifestJson (version, option) {
5858
option = option || {}
59-
var manifest = Object.assign(option, {version: version})
59+
var manifest = Object.assign(option, { version: version })
6060
fs.writeFileSync('manifest.json', JSON.stringify(manifest), 'utf-8')
6161
}
6262

@@ -607,7 +607,7 @@ describe('cli', function () {
607607
})
608608

609609
it('does not display `npm publish` if the package is private', function () {
610-
writePackageJson('1.0.0', {private: true})
610+
writePackageJson('1.0.0', { private: true })
611611

612612
var result = execCli()
613613
result.code.should.equal(0)
@@ -666,7 +666,7 @@ describe('standard-version', function () {
666666

667667
describe('with mocked conventionalRecommendedBump', function () {
668668
beforeEach(function () {
669-
mockery.enable({warnOnUnregistered: false, useCleanCache: true})
669+
mockery.enable({ warnOnUnregistered: false, useCleanCache: true })
670670
mockery.registerMock('conventional-recommended-bump', function (_, cb) {
671671
cb(new Error('bump err'))
672672
})
@@ -682,7 +682,7 @@ describe('standard-version', function () {
682682
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
683683
commit('feat: new feature!')
684684

685-
require('./index')({silent: true})
685+
require('./index')({ silent: true })
686686
.catch((err) => {
687687
err.message.should.match(/bump err/)
688688
done()
@@ -692,9 +692,9 @@ describe('standard-version', function () {
692692

693693
describe('with mocked conventionalChangelog', function () {
694694
beforeEach(function () {
695-
mockery.enable({warnOnUnregistered: false, useCleanCache: true})
695+
mockery.enable({ warnOnUnregistered: false, useCleanCache: true })
696696
mockery.registerMock('conventional-changelog', function () {
697-
var readable = new stream.Readable({objectMode: true})
697+
var readable = new stream.Readable({ objectMode: true })
698698
readable._read = function () {
699699
}
700700
setImmediate(readable.emit.bind(readable), 'error', new Error('changelog err'))
@@ -712,7 +712,7 @@ describe('standard-version', function () {
712712
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
713713
commit('feat: new feature!')
714714

715-
require('./index')({silent: true})
715+
require('./index')({ silent: true })
716716
.catch((err) => {
717717
err.message.should.match(/changelog err/)
718718
return done()
@@ -725,7 +725,7 @@ describe('standard-version', function () {
725725
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
726726
commit('feat: new feature!')
727727

728-
require('./index')({silent: true})
728+
require('./index')({ silent: true })
729729
.then(() => {
730730
// check last commit message
731731
shell.exec('git log --oneline -n1').stdout.should.match(/chore\(release\): 1\.1\.0/)
@@ -738,7 +738,7 @@ describe('standard-version', function () {
738738
describe('without a package file to bump', function () {
739739
it('should exit with error', function () {
740740
shell.rm('package.json')
741-
return require('./index')({silent: true})
741+
return require('./index')({ silent: true })
742742
.catch((err) => {
743743
err.message.should.equal('no package file found')
744744
})
@@ -754,7 +754,7 @@ describe('standard-version', function () {
754754
commit('feat: first commit')
755755
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
756756
commit('feat: new feature!')
757-
return require('./index')({silent: true})
757+
return require('./index')({ silent: true })
758758
.then(() => {
759759
JSON.parse(fs.readFileSync('bower.json', 'utf-8')).version.should.equal('1.1.0')
760760
getPackageVersion().should.equal('1.1.0')
@@ -771,7 +771,7 @@ describe('standard-version', function () {
771771
commit('feat: first commit')
772772
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
773773
commit('feat: new feature!')
774-
return require('./index')({silent: true})
774+
return require('./index')({ silent: true })
775775
.then(() => {
776776
JSON.parse(fs.readFileSync('manifest.json', 'utf-8')).version.should.equal('1.1.0')
777777
getPackageVersion().should.equal('1.1.0')
@@ -788,7 +788,7 @@ describe('standard-version', function () {
788788
commit('feat: first commit')
789789
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
790790
commit('feat: new feature!')
791-
require('./index')({silent: true})
791+
require('./index')({ silent: true })
792792
.then(() => {
793793
JSON.parse(fs.readFileSync('npm-shrinkwrap.json', 'utf-8')).version.should.equal('1.1.0')
794794
getPackageVersion().should.equal('1.1.0')
@@ -807,7 +807,7 @@ describe('standard-version', function () {
807807
commit('feat: first commit')
808808
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
809809
commit('feat: new feature!')
810-
return require('./index')({silent: true})
810+
return require('./index')({ silent: true })
811811
.then(() => {
812812
JSON.parse(fs.readFileSync('package-lock.json', 'utf-8')).version.should.equal('1.1.0')
813813
getPackageVersion().should.equal('1.1.0')
@@ -871,7 +871,7 @@ describe('standard-version', function () {
871871
commit('feat: first commit')
872872
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
873873
commit('feat: new feature!')
874-
return require('./index')({silent: true})
874+
return require('./index')({ silent: true })
875875
.then(() => {
876876
JSON.parse(fs.readFileSync('bower.json', 'utf-8')).version.should.equal('1.0.0')
877877
getPackageVersion().should.equal('1.1.0')

0 commit comments

Comments
 (0)