standard-changelog
Advanced tools
Comparing version 1.0.13 to 1.0.14
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="1.0.14"></a> | ||
## [1.0.14](https://github.com/conventional-changelog/conventional-changelog/compare/standard-changelog@1.0.13...standard-changelog@1.0.14) (2018-03-22) | ||
**Note:** Version bump only for package standard-changelog | ||
<a name="1.0.13"></a> | ||
@@ -8,0 +16,0 @@ ## [1.0.13](https://github.com/conventional-changelog/conventional-changelog/compare/standard-changelog@1.0.12...standard-changelog@1.0.13) (2018-02-24) |
94
cli.js
#!/usr/bin/env node | ||
'use strict'; | ||
var addStream = require('add-stream'); | ||
var chalk = require('chalk'); | ||
var standardChangelog = require('./'); | ||
var fs = require('fs'); | ||
var meow = require('meow'); | ||
var tempfile = require('tempfile'); | ||
var _ = require('lodash'); | ||
var resolve = require('path').resolve; | ||
var Readable = require('stream').Readable; | ||
var rimraf = require('rimraf'); | ||
'use strict' | ||
var addStream = require('add-stream') | ||
var chalk = require('chalk') | ||
var standardChangelog = require('./') | ||
var fs = require('fs') | ||
var meow = require('meow') | ||
var tempfile = require('tempfile') | ||
var _ = require('lodash') | ||
var resolve = require('path').resolve | ||
var Readable = require('stream').Readable | ||
var rimraf = require('rimraf') | ||
@@ -74,10 +74,10 @@ var cli = meow(` | ||
} | ||
}); | ||
}) | ||
var flags = cli.flags; | ||
var infile = flags.infile; | ||
var sameFile = flags.sameFile; | ||
var outfile = sameFile ? (flags.outfile || infile) : flags.outfile; | ||
var append = flags.append; | ||
var releaseCount = flags.firstRelease ? 0 : flags.releaseCount; | ||
var flags = cli.flags | ||
var infile = flags.infile | ||
var sameFile = flags.sameFile | ||
var outfile = sameFile ? (flags.outfile || infile) : flags.outfile | ||
var append = flags.append | ||
var releaseCount = flags.firstRelease ? 0 : flags.releaseCount | ||
@@ -92,17 +92,17 @@ var options = _.omit({ | ||
lernaPackage: flags.lernaPackage | ||
}, _.isUndefined); | ||
}, _.isUndefined) | ||
if (flags.verbose) { | ||
options.warn = console.warn.bind(console); | ||
options.warn = console.warn.bind(console) | ||
} | ||
var templateContext; | ||
var templateContext | ||
function outputError(err) { | ||
function outputError (err) { | ||
if (flags.verbose) { | ||
console.error(chalk.grey(err.stack)); | ||
console.error(chalk.grey(err.stack)) | ||
} else { | ||
console.error(chalk.red(err.toString())); | ||
console.error(chalk.red(err.toString())) | ||
} | ||
process.exit(1); | ||
process.exit(1) | ||
} | ||
@@ -112,24 +112,24 @@ | ||
if (flags.context) { | ||
templateContext = require(resolve(process.cwd(), flags.context)); | ||
templateContext = require(resolve(process.cwd(), flags.context)) | ||
} | ||
} catch (err) { | ||
outputError(err); | ||
outputError(err) | ||
} | ||
var changelogStream = standardChangelog(options, templateContext, flags.commitPath ? {path: flags.commitPath} : {}) | ||
.on('error', function(err) { | ||
outputError(err); | ||
}); | ||
.on('error', function (err) { | ||
outputError(err) | ||
}) | ||
standardChangelog.createIfMissing(infile); | ||
standardChangelog.createIfMissing(infile) | ||
var readStream = null; | ||
var readStream = null | ||
if (releaseCount !== 0) { | ||
readStream = fs.createReadStream(infile) | ||
.on('error', function(err) { | ||
outputError(err); | ||
}); | ||
.on('error', function (err) { | ||
outputError(err) | ||
}) | ||
} else { | ||
readStream = new Readable(); | ||
readStream.push(null); | ||
readStream = new Readable() | ||
readStream.push(null) | ||
} | ||
@@ -142,7 +142,7 @@ | ||
})) | ||
.on('finish', function() { | ||
standardChangelog.checkpoint('appended changes to %s', [outfile]); | ||
}); | ||
.on('finish', function () { | ||
standardChangelog.checkpoint('appended changes to %s', [outfile]) | ||
}) | ||
} else { | ||
var tmp = tempfile(); | ||
var tmp = tempfile() | ||
@@ -152,10 +152,10 @@ changelogStream | ||
.pipe(fs.createWriteStream(tmp)) | ||
.on('finish', function() { | ||
.on('finish', function () { | ||
fs.createReadStream(tmp) | ||
.pipe(fs.createWriteStream(outfile)) | ||
.on('finish', function() { | ||
standardChangelog.checkpoint('output changes to %s', [outfile]); | ||
rimraf.sync(tmp); | ||
}); | ||
}); | ||
.on('finish', function () { | ||
standardChangelog.checkpoint('output changes to %s', [outfile]) | ||
rimraf.sync(tmp) | ||
}) | ||
}) | ||
} |
46
index.js
@@ -1,34 +0,34 @@ | ||
'use strict'; | ||
'use strict' | ||
var conventionalChangelogCore = require('conventional-changelog-core'); | ||
var angular = require('conventional-changelog-angular'); | ||
var fs = require('fs'); | ||
var accessSync = require('fs-access').sync; | ||
var chalk = require('chalk'); | ||
var figures = require('figures'); | ||
var sprintf = require('sprintf'); | ||
var conventionalChangelogCore = require('conventional-changelog-core') | ||
var angular = require('conventional-changelog-angular') | ||
var fs = require('fs') | ||
var accessSync = require('fs-access').sync | ||
var chalk = require('chalk') | ||
var figures = require('figures') | ||
var sprintf = require('sprintf') | ||
function conventionalChangelog(options, context, gitRawCommitsOpts, parserOpts, writerOpts) { | ||
options = options || {}; | ||
options.config = angular; | ||
return conventionalChangelogCore(options, context, gitRawCommitsOpts, parserOpts, writerOpts); | ||
function conventionalChangelog (options, context, gitRawCommitsOpts, parserOpts, writerOpts) { | ||
options = options || {} | ||
options.config = angular | ||
return conventionalChangelogCore(options, context, gitRawCommitsOpts, parserOpts, writerOpts) | ||
} | ||
conventionalChangelog.createIfMissing = function(infile) { | ||
conventionalChangelog.createIfMissing = function (infile) { | ||
try { | ||
accessSync(infile, fs.F_OK); | ||
accessSync(infile, fs.F_OK) | ||
} catch (err) { | ||
if (err.code === 'ENOENT') { | ||
conventionalChangelog.checkpoint('created %s', [infile]); | ||
fs.writeFileSync(infile, '\n', 'utf-8'); | ||
conventionalChangelog.checkpoint('created %s', [infile]) | ||
fs.writeFileSync(infile, '\n', 'utf-8') | ||
} | ||
} | ||
}; | ||
} | ||
conventionalChangelog.checkpoint = function(msg, args) { | ||
console.info(chalk.green(figures.tick) + ' ' + sprintf(msg, args.map(function(arg) { | ||
return chalk.bold(arg); | ||
}))); | ||
}; | ||
conventionalChangelog.checkpoint = function (msg, args) { | ||
console.info(chalk.green(figures.tick) + ' ' + sprintf(msg, args.map(function (arg) { | ||
return chalk.bold(arg) | ||
}))) | ||
} | ||
module.exports = conventionalChangelog; | ||
module.exports = conventionalChangelog |
{ | ||
"name": "standard-changelog", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "Generate a changelog from git metadata with Angular commit convention", | ||
@@ -29,3 +29,3 @@ "bugs": { | ||
"conventional-changelog-angular": "^1.6.6", | ||
"conventional-changelog-core": "^2.0.5", | ||
"conventional-changelog-core": "^2.0.6", | ||
"figures": "^1.5.0", | ||
@@ -45,3 +45,3 @@ "fs-access": "^1.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'" | ||
@@ -48,0 +48,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
12291