conventional-changelog-cli
Advanced tools
Comparing version 1.3.16 to 1.3.17
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="1.3.17"></a> | ||
## [1.3.17](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-cli@1.3.16...conventional-changelog-cli@1.3.17) (2018-03-22) | ||
**Note:** Version bump only for package conventional-changelog-cli | ||
<a name="1.3.16"></a> | ||
@@ -8,0 +16,0 @@ ## [1.3.16](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-cli@1.3.15...conventional-changelog-cli@1.3.16) (2018-03-03) |
112
cli.js
#!/usr/bin/env node | ||
'use strict'; | ||
'use strict' | ||
var addStream = require('add-stream'); | ||
var conventionalChangelog = require('conventional-changelog'); | ||
var fs = require('fs'); | ||
var meow = require('meow'); | ||
var tempfile = require('tempfile'); | ||
var _ = require('lodash'); | ||
var resolve = require('path').resolve; | ||
var addStream = require('add-stream') | ||
var conventionalChangelog = require('conventional-changelog') | ||
var fs = require('fs') | ||
var meow = require('meow') | ||
var tempfile = require('tempfile') | ||
var _ = require('lodash') | ||
var resolve = require('path').resolve | ||
@@ -25,3 +25,3 @@ var cli = meow(` | ||
-s, --same-file Outputting to the infile so you don\'t need to specify the same file as outfile | ||
-s, --same-file Outputting to the infile so you don't need to specify the same file as outfile | ||
@@ -88,20 +88,20 @@ -p, --preset Name of the preset you want to use. Must be one of the following: | ||
} | ||
}); | ||
}) | ||
var config; | ||
var flags = cli.flags; | ||
var infile = flags.infile; | ||
var outfile = flags.outfile; | ||
var sameFile = flags.sameFile; | ||
var append = flags.append; | ||
var releaseCount = flags.releaseCount; | ||
var config | ||
var flags = cli.flags | ||
var infile = flags.infile | ||
var outfile = flags.outfile | ||
var sameFile = flags.sameFile | ||
var append = flags.append | ||
var releaseCount = flags.releaseCount | ||
if (infile && infile === outfile) { | ||
sameFile = true; | ||
sameFile = true | ||
} else if (sameFile) { | ||
if (infile) { | ||
outfile = infile; | ||
outfile = infile | ||
} else { | ||
console.error('infile must be provided if same-file flag presents.'); | ||
process.exit(1); | ||
console.error('infile must be provided if same-file flag presents.') | ||
process.exit(1) | ||
} | ||
@@ -119,31 +119,31 @@ } | ||
lernaPackage: flags.lernaPackage | ||
}, _.isUndefined); | ||
}, _.isUndefined) | ||
if (flags.verbose) { | ||
options.debug = console.info.bind(console); | ||
options.warn = console.warn.bind(console); | ||
options.debug = console.info.bind(console) | ||
options.warn = console.warn.bind(console) | ||
} | ||
var templateContext; | ||
var templateContext | ||
var outStream; | ||
var outStream | ||
try { | ||
if (flags.context) { | ||
templateContext = require(resolve(process.cwd(), flags.context)); | ||
templateContext = require(resolve(process.cwd(), flags.context)) | ||
} | ||
if (flags.config) { | ||
config = require(resolve(process.cwd(), flags.config)); | ||
options.config = config; | ||
config = require(resolve(process.cwd(), flags.config)) | ||
options.config = config | ||
} else { | ||
config = {}; | ||
config = {} | ||
} | ||
} catch (err) { | ||
console.error('Failed to get file. ' + err); | ||
process.exit(1); | ||
console.error('Failed to get file. ' + err) | ||
process.exit(1) | ||
} | ||
var gitRawCommitsOpts = _.merge({}, config.gitRawCommitsOpts || {}); | ||
if (flags.commitPath) gitRawCommitsOpts.path = flags.commitPath; | ||
var gitRawCommitsOpts = _.merge({}, config.gitRawCommitsOpts || {}) | ||
if (flags.commitPath) gitRawCommitsOpts.path = flags.commitPath | ||
@@ -153,18 +153,18 @@ var changelogStream = conventionalChangelog(options, templateContext, gitRawCommitsOpts, config.parserOpts, config.writerOpts) | ||
if (flags.verbose) { | ||
console.error(err.stack); | ||
console.error(err.stack) | ||
} else { | ||
console.error(err.toString()); | ||
console.error(err.toString()) | ||
} | ||
process.exit(1); | ||
}); | ||
process.exit(1) | ||
}) | ||
function noInputFile() { | ||
function noInputFile () { | ||
if (outfile) { | ||
outStream = fs.createWriteStream(outfile); | ||
outStream = fs.createWriteStream(outfile) | ||
} else { | ||
outStream = process.stdout; | ||
outStream = process.stdout | ||
} | ||
changelogStream | ||
.pipe(outStream); | ||
.pipe(outStream) | ||
} | ||
@@ -176,9 +176,9 @@ | ||
if (flags.verbose) { | ||
console.warn('infile does not exist.'); | ||
console.warn('infile does not exist.') | ||
} | ||
if (sameFile) { | ||
noInputFile(); | ||
noInputFile() | ||
} | ||
}); | ||
}) | ||
@@ -190,5 +190,5 @@ if (sameFile) { | ||
flags: 'a' | ||
})); | ||
})) | ||
} else { | ||
var tmp = tempfile(); | ||
var tmp = tempfile() | ||
@@ -200,27 +200,27 @@ changelogStream | ||
fs.createReadStream(tmp) | ||
.pipe(fs.createWriteStream(outfile)); | ||
}); | ||
.pipe(fs.createWriteStream(outfile)) | ||
}) | ||
} | ||
} else { | ||
if (outfile) { | ||
outStream = fs.createWriteStream(outfile); | ||
outStream = fs.createWriteStream(outfile) | ||
} else { | ||
outStream = process.stdout; | ||
outStream = process.stdout | ||
} | ||
var stream; | ||
var stream | ||
if (options.append) { | ||
stream = readStream | ||
.pipe(addStream(changelogStream)); | ||
.pipe(addStream(changelogStream)) | ||
} else { | ||
stream = changelogStream | ||
.pipe(addStream(readStream)); | ||
.pipe(addStream(readStream)) | ||
} | ||
stream | ||
.pipe(outStream); | ||
.pipe(outStream) | ||
} | ||
} else { | ||
noInputFile(); | ||
noInputFile() | ||
} |
{ | ||
"name": "conventional-changelog-cli", | ||
"version": "1.3.16", | ||
"version": "1.3.17", | ||
"description": "Generate a changelog from git metadata", | ||
@@ -39,3 +39,3 @@ "bugs": { | ||
"add-stream": "^1.0.0", | ||
"conventional-changelog": "^1.1.18", | ||
"conventional-changelog": "^1.1.19", | ||
"lodash": "^4.2.1", | ||
@@ -47,3 +47,3 @@ "meow": "^4.0.0", | ||
"test": "mocha --timeout 30000 && npm run-script lint", | ||
"lint": "jshint test *.js --exclude node_modules && jscs test *.js", | ||
"lint": "eslint --fix .", | ||
"test-windows": "echo 'make work on windows'" | ||
@@ -50,0 +50,0 @@ }, |
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
21138