@commitlint/cli
Advanced tools
Comparing version 3.2.0 to 4.0.0
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
<a name="4.0.0"></a> | ||
# [4.0.0](https://github.com/marionebl/commitlint/compare/v3.2.0...v4.0.0) (2017-10-04) | ||
### Features | ||
* enable alternative config formats ([#83](https://github.com/marionebl/commitlint/issues/83)) ([91968b8](https://github.com/marionebl/commitlint/commit/91968b8)), closes [#73](https://github.com/marionebl/commitlint/issues/73) | ||
### BREAKING CHANGES | ||
* discontinue support of conventional-changelog-lintrc | ||
* test: make git setup reliable | ||
<a name="3.2.0"></a> | ||
@@ -7,0 +25,0 @@ # 3.2.0 (2017-09-05) |
15
cli.js
@@ -26,6 +26,7 @@ #!/usr/bin/env node | ||
const configuration = { | ||
string: ['from', 'to', 'extends', 'parser-preset'], | ||
string: ['cwd', 'from', 'to', 'extends', 'parser-preset'], | ||
boolean: ['edit', 'help', 'version', 'quiet', 'color'], | ||
alias: { | ||
c: 'color', | ||
d: 'cwd', | ||
e: 'edit', | ||
@@ -42,2 +43,3 @@ f: 'from', | ||
color: 'toggle colored output', | ||
cwd: 'directory to execute in', | ||
edit: 'read last commit message found in ./git/COMMIT_EDITMSG', | ||
@@ -48,6 +50,8 @@ extends: 'array of shareable configurations to extend', | ||
quiet: 'toggle console output', | ||
'parser-preset': 'configuration preset to use for conventional-commits-parser' | ||
'parser-preset': | ||
'configuration preset to use for conventional-commits-parser' | ||
}, | ||
default: { | ||
color: true, | ||
cwd: process.cwd(), | ||
edit: false, | ||
@@ -73,3 +77,3 @@ from: null, | ||
const load = seed => core.load(seed); | ||
const load = (seed, opts) => core.load(seed, opts); | ||
@@ -82,3 +86,3 @@ function main(options) { | ||
const range = pick(flags, 'edit', 'from', 'to'); | ||
const input = fromStdin ? stdin() : core.read(range); | ||
const input = fromStdin ? stdin() : core.read(range, {cwd: flags.cwd}); | ||
const fmt = new chalk.constructor({enabled: flags.color}); | ||
@@ -89,3 +93,3 @@ | ||
messages.map(commit => { | ||
return load(getSeed(flags)) | ||
return load(getSeed(flags), {cwd: flags.cwd}) | ||
.then(loaded => { | ||
@@ -136,3 +140,2 @@ const parserOpts = selectParserOpts(loaded.parserPreset); | ||
function selectParserOpts(parserPreset) { | ||
@@ -139,0 +142,0 @@ if (typeof parserPreset !== 'object') { |
@@ -34,3 +34,3 @@ import path from 'path'; | ||
return result; | ||
} | ||
}; | ||
}; | ||
@@ -44,4 +44,8 @@ | ||
test('should throw when called without [input]', t => { | ||
t.throws(cli()(), /Expected a raw commit/); | ||
test('should throw when called without [input]', async t => { | ||
const dir = tmp.dirSync().name; | ||
await init(dir); | ||
await t.throws(cli([], {cwd: dir})(), /Expected a raw commit/); | ||
await rm([dir])(); | ||
}); | ||
@@ -78,7 +82,15 @@ | ||
test('should fail for input from stdin with rule from js', async t => { | ||
const dir = tmp.dirSync().name; | ||
await init(dir); | ||
await sander.copydir(EXTENDS_ROOT).to(dir); | ||
const actual = await t.throws( | ||
cli(['--extends', './extended'], {cwd: EXTENDS_ROOT})('foo: bar') | ||
cli(['--extends', './extended'], {cwd: dir})('foo: bar') | ||
); | ||
t.true(includes(actual.stdout, 'type must not be one of [foo]')); | ||
t.is(actual.code, 1); | ||
await rm([dir])(); | ||
}); | ||
@@ -131,7 +143,9 @@ | ||
const cwd = PARSER_PRESET; | ||
const actual = await t.throws(cli([], {cwd})('type(scope)-ticket subject')); | ||
const actual = await t.throws(cli([], {cwd})('type(scope)-ticket subject')); | ||
t.true(includes(actual.stdout, 'message may not be empty [subject-empty]')); | ||
await cli(['--parser-preset', './parser-preset'], {cwd})('type(scope)-ticket subject'); | ||
await cli(['--parser-preset', './parser-preset'], {cwd})( | ||
'type(scope)-ticket subject' | ||
); | ||
}); | ||
@@ -149,3 +163,7 @@ | ||
function pkg(cwd) { | ||
return sander.writeFile(cwd, 'package.json', JSON.stringify({scripts: {commitmsg: `${CLI} -e`}})); | ||
return sander.writeFile( | ||
cwd, | ||
'package.json', | ||
JSON.stringify({scripts: {commitmsg: `${CLI} -e`}}) | ||
); | ||
} |
{ | ||
"name": "@commitlint/cli", | ||
"version": "3.2.0", | ||
"version": "4.0.0", | ||
"description": "Lint your commit messages", | ||
@@ -56,3 +56,3 @@ "bin": { | ||
"dependencies": { | ||
"@commitlint/core": "^3.2.0", | ||
"@commitlint/core": "^4.0.0", | ||
"babel-polyfill": "^6.23.0", | ||
@@ -59,0 +59,0 @@ "chalk": "^2.0.1", |
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
16607
318
+ Added@commitlint/core@4.3.0(transitive)
+ Added@marionebl/conventional-commits-parser@3.0.0(transitive)
+ Added@marionebl/git-raw-commits@1.2.0(transitive)
+ Added@marionebl/sander@0.6.1(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcosmiconfig@3.1.0(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedis-directory@0.3.1(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedparse-json@3.0.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removed@commitlint/core@3.2.0(transitive)
- Removedany-promise@1.3.0(transitive)
- Removedarrify@1.0.1(transitive)
- Removedcamelcase@4.1.0(transitive)
- Removedcamelcase-keys@4.2.0(transitive)
- Removedconventional-commits-parser@1.3.0(transitive)
- Removeddecamelize-keys@1.1.1(transitive)
- Removeddeep-extend@0.6.0(transitive)
- Removedfranc@2.0.0(transitive)
- Removedgit-raw-commits@1.3.6(transitive)
- Removedimport-from@2.1.0(transitive)
- Removedindent-string@3.2.0(transitive)
- Removedini@1.3.8(transitive)
- Removedis-plain-obj@1.1.0(transitive)
- Removedjson-parse-better-errors@1.0.2(transitive)
- Removedload-json-file@4.0.0(transitive)
- Removedmap-obj@2.0.0(transitive)
- Removedmeow@4.0.1(transitive)
- Removedminimist-options@3.0.2(transitive)
- Removedmz@2.7.0(transitive)
- Removedn-gram@0.1.2(transitive)
- Removedparse-json@4.0.0(transitive)
- Removedpath-type@3.0.0(transitive)
- Removedpify@3.0.0(transitive)
- Removedpos@0.4.2(transitive)
- Removedquick-lru@1.1.0(transitive)
- Removedrc@1.2.8(transitive)
- Removedread-pkg@3.0.0(transitive)
- Removedread-pkg-up@3.0.0(transitive)
- Removedredent@2.0.0(transitive)
- Removedstrip-bom@3.0.0(transitive)
- Removedstrip-indent@2.0.0(transitive)
- Removedstrip-json-comments@2.0.1(transitive)
- Removedthenify@3.3.1(transitive)
- Removedthenify-all@1.6.0(transitive)
- Removedtrigram-utils@0.1.1(transitive)
- Removedtrim-newlines@2.0.0(transitive)
Updated@commitlint/core@^4.0.0