Socket
Socket
Sign inDemoInstall

@commitlint/cli

Package Overview
Dependencies
Maintainers
1
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commitlint/cli - npm Package Compare versions

Comparing version 3.1.3 to 3.2.0

fixtures/parser-preset/commitlint.config.js

57

CHANGELOG.md

@@ -6,2 +6,12 @@ # Change Log

<a name="3.2.0"></a>
# 3.2.0 (2017-09-05)
### Features
* add preset parser ([5cd2335](https://github.com/marionebl/commitlint/commit/5cd2335))
<a name="3.1.3"></a>

@@ -54,2 +64,12 @@ ## 3.1.3 (2017-08-21)

<a name="3.1.3"></a>
## 3.1.3 (2017-08-21)
### Bug Fixes
* **core:** determine git root correctly in sub directories ([#64](https://github.com/marionebl/commitlint/issues/64)) ([d594ec4](https://github.com/marionebl/commitlint/commit/d594ec4)), closes [#62](https://github.com/marionebl/commitlint/issues/62)
<a name="3.1.2"></a>

@@ -92,2 +112,12 @@ ## 3.1.2 (2017-08-07)

<a name="3.1.2"></a>
## 3.1.2 (2017-08-07)
<a name="3.1.1"></a>
## 3.1.1 (2017-08-07)
<a name="3.0.4"></a>

@@ -120,2 +150,12 @@ ## 3.0.4 (2017-08-04)

<a name="3.0.4"></a>
## 3.0.4 (2017-08-04)
### Bug Fixes
* **core:** correct type validation message ([09c2b26](https://github.com/marionebl/commitlint/commit/09c2b26))
<a name="3.0.3"></a>

@@ -138,2 +178,7 @@ ## 3.0.3 (2017-07-16)

<a name="3.0.3"></a>
## 3.0.3 (2017-07-16)
<a name="3.0.2"></a>

@@ -151,2 +196,14 @@ ## 3.0.2 (2017-07-11)

<a name="3.0.2"></a>
## 3.0.2 (2017-07-11)
### Bug Fixes
* **cli:** remove destructuring for node 4 support ([fe8caff](https://github.com/marionebl/commitlint/commit/fe8caff))
* ensure node4 compat ([bfeb653](https://github.com/marionebl/commitlint/commit/bfeb653))
<a name="3.0.1"></a>

@@ -153,0 +210,0 @@ ## 3.0.1 (2017-07-11)

33

cli.js

@@ -26,3 +26,3 @@ #!/usr/bin/env node

const configuration = {
string: ['from', 'to', 'extends'],
string: ['from', 'to', 'extends', 'parser-preset'],
boolean: ['edit', 'help', 'version', 'quiet', 'color'],

@@ -37,3 +37,4 @@ alias: {

v: 'version',
x: 'extends'
x: 'extends',
p: 'parser-preset'
},

@@ -46,3 +47,4 @@ description: {

to: 'upper end of the commit range to lint; applies if edit=false',
quiet: 'toggle console output'
quiet: 'toggle console output',
'parser-preset': 'configuration preset to use for conventional-commits-parser'
},

@@ -86,3 +88,7 @@ default: {

return load(getSeed(flags))
.then(opts => core.lint(commit, opts.rules))
.then(loaded => {
const parserOpts = selectParserOpts(loaded.parserPreset);
const opts = parserOpts ? {parserOpts} : undefined;
return core.lint(commit, loaded.rules, opts);
})
.then(report => {

@@ -113,3 +119,5 @@ const formatted = core.format(report, {color: flags.color});

const n = e.filter(i => typeof i === 'string');
return n.length > 0 ? {extends: n} : {};
return n.length > 0
? {extends: n, parserPreset: seed.parserPreset}
: {parserPreset: seed.parserPreset};
}

@@ -127,2 +135,17 @@

function selectParserOpts(parserPreset) {
if (typeof parserPreset !== 'object') {
return undefined;
}
const opts = parserPreset.opts;
if (typeof opts !== 'object') {
return undefined;
}
return opts.parserOpts;
}
// Catch unhandled rejections globally

@@ -129,0 +152,0 @@ process.on('unhandledRejection', (reason, promise) => {

import path from 'path';
import test from 'ava';
import execa from 'execa';
import {includes} from 'lodash';
import {sync as bin} from 'resolve-bin';

@@ -16,2 +17,3 @@ import * as sander from 'sander';

const EMPTY = fix('empty');
const PARSER_PRESET = fix('parser-preset');

@@ -48,3 +50,3 @@ const HUSKY = tmp.dirSync().name;

const actual = await cli([], {cwd: EMPTY})('foo: bar');
t.true(actual.stdout.includes('foo: bar'));
t.true(includes(actual.stdout, 'foo: bar'));
});

@@ -71,3 +73,3 @@

const actual = await t.throws(cli([], {cwd: SIMPLE})('foo: bar'));
t.true(actual.stdout.includes('type must not be one of [foo]'));
t.true(includes(actual.stdout, 'type must not be one of [foo]'));
t.is(actual.code, 1);

@@ -80,3 +82,3 @@ });

);
t.true(actual.stdout.includes('type must not be one of [foo]'));
t.true(includes(actual.stdout, 'type must not be one of [foo]'));
t.is(actual.code, 1);

@@ -128,2 +130,11 @@ });

test('should pick up parser preset', async t => {
const cwd = PARSER_PRESET;
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');
});
async function init(cwd) {

@@ -130,0 +141,0 @@ await git(['init'], {cwd})();

2

help.js

@@ -25,3 +25,3 @@ module.exports = configuration => {

const fs = flags.map(
flag => (flag.length > 1 ? `--${flag}` : `-${flag}`)
flag => (flag.length > 1 ? `--${flag}` : ` -${flag}`)
);

@@ -28,0 +28,0 @@ const ds = defaults ? `, defaults to: ${defaults}` : '';

{
"name": "@commitlint/cli",
"version": "3.1.3",
"version": "3.2.0",
"description": "Lint your commit messages",

@@ -56,3 +56,3 @@ "bin": {

"dependencies": {
"@commitlint/core": "^3.1.3",
"@commitlint/core": "^3.2.0",
"babel-polyfill": "^6.23.0",

@@ -59,0 +59,0 @@ "chalk": "^2.0.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc