conventional-changelog-cli
Advanced tools
Comparing version 0.0.1 to 1.0.0
@@ -0,1 +1,28 @@ | ||
<a name="1.0.0"></a> | ||
# [1.0.0](https://github.com/stevemao/conventional-changelog-cli/compare/v0.0.1...v1.0.0) (2016-02-05) | ||
### Bug Fixes | ||
* **infile:** do not print the latest release twice if infile ENOENT ([e664087](https://github.com/stevemao/conventional-changelog-cli/commit/e664087)) | ||
### Features | ||
* **flags:** add config and remove uncommon ones ([abc2b83](https://github.com/stevemao/conventional-changelog-cli/commit/abc2b83)) | ||
* **help:** improve the flag names and add more descriptions ([f59d6d9](https://github.com/stevemao/conventional-changelog-cli/commit/f59d6d9)) | ||
* **infile:** warn if infile does not exist ([443eb64](https://github.com/stevemao/conventional-changelog-cli/commit/443eb64)) | ||
* add --output-unreleased ([d479ff4](https://github.com/stevemao/conventional-changelog-cli/commit/d479ff4)) | ||
### BREAKING CHANGES | ||
* help: `overwrite` is now called `same-file`. | ||
Fixes https://github.com/ajoslin/conventional-changelog/issues/100 | ||
* flags: `--git-raw-commits-opts`, `--parser-opts` and `--writer-opts` are removed as they are considered uncommon, use `--config` is easier as people can write all options within one file and they can learn from existing presets. | ||
Fixes https://github.com/ajoslin/conventional-changelog/issues/100 | ||
<a name="0.0.1"></a> | ||
@@ -2,0 +29,0 @@ ## 0.0.1 (2016-01-30) |
79
cli.js
@@ -17,17 +17,34 @@ #!/usr/bin/env node | ||
'Example', | ||
' conventional-changelog -i CHANGELOG.md --overwrite', | ||
' conventional-changelog -i CHANGELOG.md --same-file', | ||
'', | ||
'Options', | ||
' -i, --infile Read the CHANGELOG from this file', | ||
' -o, --outfile Write the CHANGELOG to this file. If unspecified, it prints to stdout', | ||
' -w, --overwrite Overwrite the infile', | ||
' -p, --preset Name of the preset you want to use', | ||
'', | ||
' -o, --outfile Write the CHANGELOG to this file', | ||
' If unspecified, it prints to stdout', | ||
'', | ||
' -s, --same-file Outputting to the infile so you don\'t need to specify the same file as outfile', | ||
'', | ||
' -p, --preset Name of the preset you want to use. Must be one of the following:', | ||
' angular, atom, codemirror, ember, eslint, express, jquery, jscs or jshint', | ||
'', | ||
' -k, --pkg A filepath of where your package.json is located', | ||
' -a, --append Should the generated block be appended', | ||
' Default is the closest package.json from cwd', | ||
'', | ||
' -a, --append Should the newer release be appended to the older release', | ||
' Default: false', | ||
'', | ||
' -r, --release-count How many releases to be generated from the latest', | ||
' If 0, the whole changelog will be regenerated and the outfile will be overwritten', | ||
' Default: 1', | ||
'', | ||
' -u, --output-unreleased Output unreleased changelog', | ||
'', | ||
' -v, --verbose Verbose output', | ||
' -c, --context A filepath of a javascript that is used to define template variables', | ||
' --git-raw-commits-opts A filepath of a javascript that is used to define git-raw-commits options', | ||
' --parser-opts A filepath of a javascript that is used to define conventional-commits-parser options', | ||
' --writer-opts A filepath of a javascript that is used to define conventional-changelog-writer options' | ||
' Default: false', | ||
'', | ||
' -n, --config A filepath of your config script', | ||
' This value is ignored if preset is specified', | ||
'', | ||
' -c, --context A filepath of a json that is used to define template variables' | ||
] | ||
@@ -38,3 +55,3 @@ }, { | ||
o: 'outfile', | ||
w: 'overwrite', | ||
s: 'sameFile', | ||
p: 'preset', | ||
@@ -44,3 +61,5 @@ k: 'pkg', | ||
r: 'releaseCount', | ||
u: 'outputUnreleased', | ||
v: 'verbose', | ||
n: 'config', | ||
c: 'context' | ||
@@ -53,3 +72,3 @@ } | ||
var outfile = flags.outfile; | ||
var overwrite = flags.overwrite; | ||
var sameFile = flags.sameFile; | ||
var append = flags.append; | ||
@@ -59,8 +78,8 @@ var releaseCount = flags.releaseCount; | ||
if (infile && infile === outfile) { | ||
overwrite = true; | ||
} else if (overwrite) { | ||
sameFile = true; | ||
} else if (sameFile) { | ||
if (infile) { | ||
outfile = infile; | ||
} else { | ||
console.error('Nothing to overwrite'); | ||
console.error('infile must be provided if same-file flag presents.'); | ||
process.exit(1); | ||
@@ -76,3 +95,4 @@ } | ||
append: append, | ||
releaseCount: releaseCount | ||
releaseCount: releaseCount, | ||
outputUnreleased: flags.outputUnreleased | ||
}, _.isUndefined); | ||
@@ -85,5 +105,2 @@ | ||
var templateContext; | ||
var gitRawCommitsOpts; | ||
var parserOpts; | ||
var writerOpts; | ||
@@ -97,13 +114,5 @@ var outStream; | ||
if (flags.gitRawCommitsOpts) { | ||
gitRawCommitsOpts = require(resolve(process.cwd(), flags.gitRawCommitsOpts)); | ||
if (flags.config) { | ||
options.config = require(resolve(process.cwd(), flags.config)); | ||
} | ||
if (flags.parserOpts) { | ||
parserOpts = require(resolve(process.cwd(), flags.parserOpts)); | ||
} | ||
if (flags.writerOpts) { | ||
writerOpts = require(resolve(process.cwd(), flags.writerOpts)); | ||
} | ||
} catch (err) { | ||
@@ -114,3 +123,3 @@ console.error('Failed to get file. ' + err); | ||
var changelogStream = conventionalChangelog (options, templateContext, gitRawCommitsOpts, parserOpts, writerOpts) | ||
var changelogStream = conventionalChangelog(options, templateContext) | ||
.on('error', function (err) { | ||
@@ -127,3 +136,3 @@ if (flags.verbose) { | ||
if (outfile) { | ||
outStream = fs.createWriteStream (outfile); | ||
outStream = fs.createWriteStream(outfile); | ||
} else { | ||
@@ -140,6 +149,12 @@ outStream = process.stdout; | ||
.on('error', function () { | ||
noInputFile(); | ||
if (flags.verbose) { | ||
console.warn('infile does not exist.'); | ||
} | ||
if (sameFile) { | ||
noInputFile(); | ||
} | ||
}); | ||
if (overwrite) { | ||
if (sameFile) { | ||
if (options.append) { | ||
@@ -146,0 +161,0 @@ changelogStream |
{ | ||
"name": "conventional-changelog-cli", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Generate a changelog from git metadata", | ||
@@ -34,7 +34,7 @@ "homepage": "https://github.com/stevemao/conventional-changelog-cli", | ||
"nyc": "^5.0.1", | ||
"shelljs": "^0.5.3" | ||
"shelljs": "^0.6.0" | ||
}, | ||
"dependencies": { | ||
"add-stream": "^1.0.0", | ||
"conventional-changelog": "^0.5.3", | ||
"conventional-changelog": "^1.0.0", | ||
"lodash": "^4.1.0", | ||
@@ -46,3 +46,3 @@ "meow": "^3.7.0", | ||
"test": "nyc mocha --timeout 30000 && npm run-script lint", | ||
"lint": "jshint *.js --exclude node_modules && jscs *.js", | ||
"lint": "jshint test *.js --exclude node_modules && jscs test *.js", | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls" | ||
@@ -49,0 +49,0 @@ }, |
@@ -1,2 +0,5 @@ | ||
# conventional-changelog-cli [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url] | ||
# conventional-changelog-cli | ||
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url] | ||
> Generate a changelog from git metadata | ||
@@ -10,3 +13,3 @@ | ||
$ cd my-project | ||
$ conventional-changelog -p angular -i CHANGELOG.md -w | ||
$ conventional-changelog -p angular -i CHANGELOG.md -s | ||
``` | ||
@@ -19,3 +22,3 @@ | ||
```sh | ||
$ conventional-changelog -p angular -i CHANGELOG.md -w -r 0 | ||
$ conventional-changelog -p angular -i CHANGELOG.md -s -r 0 | ||
``` | ||
@@ -25,7 +28,9 @@ | ||
All available command line parameters can be listed using [CLI](#cli) : `conventional-changelog --help`. | ||
All available command line parameters can be listed using CLI: `conventional-changelog --help`. | ||
**Hint:** You can alias your command or add it to your package.json. EG: `"changelog": "conventional-changelog -p angular -i CHANGELOG.md -w -r 0"`. | ||
**Hint:** You can alias your command or add it to your package.json. EG: `"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"`. | ||
To fully customize the tool, please checkout [conventional-changelog](https://github.com/ajoslin/conventional-changelog) and [conventional-changelog-core](https://github.com/stevemao/conventional-changelog-core) docs. You can find more details there. | ||
## Recommended workflow | ||
@@ -66,2 +71,3 @@ | ||
- [conventional-changelog](https://github.com/ajoslin/conventional-changelog) - API of this module | ||
- [conventional-github-releaser](https://github.com/stevemao/conventional-github-releaser) - Make a new GitHub release from git metadata | ||
@@ -76,3 +82,3 @@ - [conventional-recommended-bump](https://github.com/stevemao/conventional-recommended-bump) - Get a recommended version bump based on conventional commits | ||
MIT © [Steve Mao]() | ||
MIT © [Steve Mao](https://github.com/stevemao) | ||
@@ -79,0 +85,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
12618
168
0
89
4
+ Addedconventional-changelog@1.1.24(transitive)
+ Addedconventional-changelog-angular@1.6.6(transitive)
+ Addedconventional-changelog-atom@0.2.8(transitive)
+ Addedconventional-changelog-codemirror@0.3.8(transitive)
+ Addedconventional-changelog-core@2.0.11(transitive)
+ Addedconventional-changelog-ember@0.3.12(transitive)
+ Addedconventional-changelog-eslint@1.0.9(transitive)
+ Addedconventional-changelog-express@0.3.6(transitive)
+ Addedconventional-changelog-jquery@0.1.0(transitive)
+ Addedconventional-changelog-jscs@0.1.0(transitive)
+ Addedconventional-changelog-jshint@0.3.8(transitive)
+ Addedconventional-changelog-preset-loader@1.1.8(transitive)
+ Addedconventional-changelog-writer@3.0.9(transitive)
+ Addedconventional-commits-filter@1.1.6(transitive)
+ Addedconventional-commits-parser@2.1.7(transitive)
+ Addeddateformat@3.0.3(transitive)
+ Addedget-pkg-repo@1.4.0(transitive)
+ Addedgit-raw-commits@1.3.6(transitive)
+ Addedgit-remote-origin-url@2.0.0(transitive)
+ Addedgitconfiglocal@1.0.0(transitive)
+ Addedini@1.3.8(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedlodash.template@4.5.0(transitive)
+ Addedlodash.templatesettings@4.2.0(transitive)
+ Addedparse-github-repo-url@1.4.1(transitive)
+ Addedsplit2@2.2.0(transitive)
- Removedconventional-changelog@0.5.3(transitive)
- Removedconventional-changelog-writer@0.4.2(transitive)
- Removedconventional-commits-filter@0.1.1(transitive)
- Removedconventional-commits-parser@0.1.2(transitive)
- Removeddateformat@1.0.12(transitive)
- Removedget-pkg-repo@0.1.0(transitive)
- Removedgit-raw-commits@0.1.2(transitive)
- Removedlodash@3.10.1(transitive)
- Removedlodash._basecopy@3.0.1(transitive)
- Removedlodash._basetostring@3.0.1(transitive)
- Removedlodash._basevalues@3.0.0(transitive)
- Removedlodash._getnative@3.9.1(transitive)
- Removedlodash._isiterateecall@3.0.9(transitive)
- Removedlodash._root@3.0.1(transitive)
- Removedlodash.escape@3.2.0(transitive)
- Removedlodash.isarguments@3.1.0(transitive)
- Removedlodash.isarray@3.0.4(transitive)
- Removedlodash.keys@3.1.2(transitive)
- Removedlodash.restparam@3.6.1(transitive)
- Removedlodash.template@3.6.2(transitive)
- Removedlodash.templatesettings@3.1.1(transitive)
- Removedsplit2@1.1.1(transitive)