From 87782816c1095a1c8470fa2df4dea8c256962a81 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Sat, 14 Oct 2017 12:07:28 +0200 Subject: [PATCH 1/6] style: reformat code From c59b1a9497bc7184a7c973491dfdc962f9bad38a Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Sat, 14 Oct 2017 14:18:17 +0200 Subject: [PATCH 2/6] refactor(cli): use babel for async/await --- @commitlint/cli/cli.test.js | 164 ------------------ .../fixtures/husky/integration/package.json | 7 +- @commitlint/cli/fixtures/husky/package.json | 6 + .../parser-preset/commitlint.config.js | 3 + .../fixtures/parser-preset/parser-preset.js | 4 +- @commitlint/cli/package.json | 31 +++- @commitlint/cli/{ => src}/cli.js | 98 +++++------ @commitlint/cli/src/cli.test.js | 126 ++++++++++++++ @commitlint/cli/{ => src}/help.js | 0 package.json | 26 +-- 10 files changed, 222 insertions(+), 243 deletions(-) delete mode 100644 @commitlint/cli/cli.test.js create mode 100644 @commitlint/cli/fixtures/husky/package.json rename @commitlint/cli/{ => src}/cli.js (67%) create mode 100644 @commitlint/cli/src/cli.test.js rename @commitlint/cli/{ => src}/help.js (100%) diff --git a/@commitlint/cli/cli.test.js b/@commitlint/cli/cli.test.js deleted file mode 100644 index fc54c02496..0000000000 --- a/@commitlint/cli/cli.test.js +++ /dev/null @@ -1,164 +0,0 @@ -import path from 'path'; -import test from 'ava'; -import execa from 'execa'; -import {includes} from 'lodash'; -import {sync as bin} from 'resolve-bin'; -import * as sander from 'sander'; -import stream from 'string-to-stream'; -import tmp from 'tmp'; - -const here = path.join.bind(null, __dirname); -const fix = here.bind(null, 'fixtures'); - -const CLI = here('cli.js'); -const SIMPLE = fix('simple'); -const EXTENDS_ROOT = fix('extends-root'); -const EMPTY = fix('empty'); -const PARSER_PRESET = fix('parser-preset'); - -const HUSKY = tmp.dirSync().name; -const HUSKY_INTEGRATION = path.join(tmp.dirSync().name, 'integration'); - -const exec = (command, args = [], opts = {}) => { - return async (input = '') => { - const c = execa(command, args, { - capture: ['stdout'], - cwd: opts.cwd - }); - stream(input).pipe(c.stdin); - const result = await c; - if (result.code !== 0) { - console.log(result.stderr); - } - return result; - }; -}; - -const cli = exec.bind(null, CLI); -const git = exec.bind(null, 'git'); -const mkdir = exec.bind(null, bin('mkdirp')); -const npm = exec.bind(null, 'npm'); -const rm = exec.bind(null, bin('rimraf')); - -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])(); -}); - -test('should reprint input from stdin', async t => { - const actual = await cli([], {cwd: EMPTY})('foo: bar'); - t.true(includes(actual.stdout, 'foo: bar')); -}); - -test('should produce no success output with --quiet flag', async t => { - const actual = await cli(['--quiet'], {cwd: EMPTY})('foo: bar'); - t.is(actual.stdout, ''); - t.is(actual.stderr, ''); -}); - -test('should produce no success output with -q flag', async t => { - const actual = await cli(['-q'], {cwd: EMPTY})('foo: bar'); - t.is(actual.stdout, ''); - t.is(actual.stderr, ''); -}); - -test('should succeed for input from stdin without rules', async t => { - const actual = await cli([], {cwd: EMPTY})('foo: bar'); - t.is(actual.code, 0); -}); - -test('should fail for input from stdin with rule from rc', async t => { - const actual = await t.throws(cli([], {cwd: SIMPLE})('foo: bar')); - t.true(includes(actual.stdout, 'type must not be one of [foo]')); - t.is(actual.code, 1); -}); - -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: dir})('foo: bar') - ); - - t.true(includes(actual.stdout, 'type must not be one of [foo]')); - t.is(actual.code, 1); - - await rm([dir])(); -}); - -test('should produce no error output with --quiet flag', async t => { - const actual = await t.throws(cli(['--quiet'], {cwd: SIMPLE})('foo: bar')); - t.is(actual.stdout, ''); - t.is(actual.stderr, ''); - t.is(actual.code, 1); -}); - -test('should produce no error output with -q flag', async t => { - const actual = await t.throws(cli(['-q'], {cwd: SIMPLE})('foo: bar')); - t.is(actual.stdout, ''); - t.is(actual.stderr, ''); - t.is(actual.code, 1); -}); - -test('should work with husky commitmsg hook', async () => { - const cwd = HUSKY; - - await init(cwd); - await pkg(cwd); - - await npm(['install', 'husky'], {cwd})(); - await git(['add', 'package.json'], {cwd})(); - await git(['commit', '-m', '"chore: this should work"'], {cwd})(); - - await rm([HUSKY])(); -}); - -test('should work with husky commitmsg hook in sub packages', async () => { - const cwd = HUSKY_INTEGRATION; - const upper = path.dirname(HUSKY_INTEGRATION); - - await mkdir([cwd])(); - await init(upper); - await pkg(cwd); - - await npm(['install', 'husky'], {cwd})(); - await git(['add', 'package.json'], {cwd})(); - - await git(['commit', '-m', '"chore: this should work"'], {cwd})(); - - await rm([upper])(); -}); - -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) { - await git(['init'], {cwd})(); - - return Promise.all([ - git(['config', 'user.email', '"commitlint@gitub.com"'], {cwd})(), - git(['config', 'user.name', '"commitlint"'], {cwd})() - ]); -} - -function pkg(cwd) { - return sander.writeFile( - cwd, - 'package.json', - JSON.stringify({scripts: {commitmsg: `${CLI} -e`}}) - ); -} diff --git a/@commitlint/cli/fixtures/husky/integration/package.json b/@commitlint/cli/fixtures/husky/integration/package.json index d4019a8cc8..3503ac09fa 100644 --- a/@commitlint/cli/fixtures/husky/integration/package.json +++ b/@commitlint/cli/fixtures/husky/integration/package.json @@ -1 +1,6 @@ -{"scripts":{"commitmsg":"commitlint -e"}} \ No newline at end of file +{ + "scripts": {}, + "devDependencies": { + "husky": "0.14.3" + } +} diff --git a/@commitlint/cli/fixtures/husky/package.json b/@commitlint/cli/fixtures/husky/package.json new file mode 100644 index 0000000000..00d6ade81e --- /dev/null +++ b/@commitlint/cli/fixtures/husky/package.json @@ -0,0 +1,6 @@ +{ + "scripts": {}, + "devDependencies": { + "husky": "0.14.3" + } +} diff --git a/@commitlint/cli/fixtures/parser-preset/commitlint.config.js b/@commitlint/cli/fixtures/parser-preset/commitlint.config.js index 77e76648ce..eebcf63055 100644 --- a/@commitlint/cli/fixtures/parser-preset/commitlint.config.js +++ b/@commitlint/cli/fixtures/parser-preset/commitlint.config.js @@ -1,4 +1,7 @@ module.exports = { + parserOpts: { + parserPreset: './parser-preset' + }, rules: { 'type-enum': [2, 'always', ['type']], 'scope-enum': [2, 'always', ['scope']], diff --git a/@commitlint/cli/fixtures/parser-preset/parser-preset.js b/@commitlint/cli/fixtures/parser-preset/parser-preset.js index 26add49abd..17d0241a98 100644 --- a/@commitlint/cli/fixtures/parser-preset/parser-preset.js +++ b/@commitlint/cli/fixtures/parser-preset/parser-preset.js @@ -1,6 +1,6 @@ module.exports = { parserOpts: { - headerPattern: /^(\w*)\((\w*)\)-(\w*)\s(.*)$/, - headerCorrespondence: ['type', 'scope', 'ticket', 'subject'] + headerPattern: /^----(\w*)\((\w*)\):\s(.*)$/, + headerCorrespondence: ['type', 'scope', 'subject'] } }; diff --git a/@commitlint/cli/package.json b/@commitlint/cli/package.json index 7403f8c55c..807add63cf 100644 --- a/@commitlint/cli/package.json +++ b/@commitlint/cli/package.json @@ -3,19 +3,28 @@ "version": "4.2.0", "description": "Lint your commit messages", "bin": { - "commitlint": "cli.js" + "commitlint": "./lib/cli.js" }, "scripts": { - "build": "exit 0", - "clean": "exit 0", - "prepublish": "npm test", + "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", + "clean": "rimraf lib", + "prepublish": "npm run build", "pretest": "dep-check", - "start": "ava --watch --verbose", - "test": "ava $AVA_VERBOSE" + "start": "concurrently \"ava -c 4 --verbose --watch\" \"npm run watch\"", + "test": "ava -c 4 $AVA_VERBOSE", + "watch": "babel src --out-dir lib --watch --source-maps" }, "ava": { "files": [ - "cli.test.js" + "lib/**/*.test.js" + ], + "source": [ + "lib/**/*.js" + ] + }, + "babel": { + "presets": [ + "babel-preset-commitlint" ] }, "xo": false, @@ -41,13 +50,19 @@ }, "license": "MIT", "devDependencies": { + "@commitlint/test": "^4.2.0", "@commitlint/utils": "^4.2.0", "ava": "^0.18.2", + "babel-cli": "^6.26.0", + "babel-preset-commitlint": "^4.2.0", + "babel-register": "^6.26.0", + "concurrently": "^3.5.0", + "cross-env": "^5.0.5", "dependency-check": "^2.9.1", "execa": "^0.7.0", "mkdirp": "^0.5.1", "resolve-bin": "^0.4.0", - "rimraf": "^2.6.1", + "rimraf": "^2.6.2", "sander": "^0.6.0", "string-to-stream": "^1.1.0", "tmp": "0.0.33", diff --git a/@commitlint/cli/cli.js b/@commitlint/cli/src/cli.js similarity index 67% rename from @commitlint/cli/cli.js rename to @commitlint/cli/src/cli.js index 7478e6ce16..0706ff4021 100755 --- a/@commitlint/cli/cli.js +++ b/@commitlint/cli/src/cli.js @@ -1,19 +1,15 @@ #!/usr/bin/env node require('babel-polyfill'); // eslint-disable-line import/no-unassigned-import -// npm modules const core = require('@commitlint/core'); const chalk = require('chalk'); const meow = require('meow'); -const pick = require('lodash').pick; +const {merge, pick} = require('lodash'); const stdin = require('get-stdin'); -const pkg = require('./package'); +const pkg = require('../package'); const help = require('./help'); -/** - * Behavioural rules - */ const rules = { fromStdin: (input, flags) => input.length === 0 && @@ -72,59 +68,61 @@ const cli = meow( configuration ); -const load = (seed, opts) => core.load(seed, opts); - -function main(options) { - normalizeOptions(options); +main(cli).catch(err => + setTimeout(() => { + if (err.type === pkg.name) { + process.exit(1); + } + throw err; + }) +); +async function main(options) { const raw = options.input; - const flags = options.flags; + const flags = normalizeFlags(options.flags); const fromStdin = rules.fromStdin(raw, flags); const range = pick(flags, 'edit', 'from', 'to'); - const input = fromStdin ? stdin() : core.read(range, {cwd: flags.cwd}); const fmt = new chalk.constructor({enabled: flags.color}); - return input.then(raw => (Array.isArray(raw) ? raw : [raw])).then(messages => - Promise.all( - messages.map(commit => { - return load(getSeed(flags), {cwd: flags.cwd}) - .then(loaded => { - const parserOpts = selectParserOpts(loaded.parserPreset); - const opts = parserOpts ? {parserOpts} : undefined; - return core.lint(commit, loaded.rules, opts); - }) - .then(report => { - const formatted = core.format(report, {color: flags.color}); - - if (!flags.quiet) { - console.log( - `${fmt.grey('⧗')} input: ${fmt.bold(commit.split('\n')[0])}` - ); - console.log(formatted.join('\n')); - } - - if (report.errors.length > 0) { - const error = new Error(formatted[formatted.length - 1]); - error.type = pkg.name; - throw error; - } - return console.log(''); - }); - }) - ) + const input = await (fromStdin + ? stdin() + : core.read(range, {cwd: flags.cwd})); + const messages = Array.isArray(input) ? input : [input]; + + return Promise.all( + messages.map(async message => { + const loaded = await core.load(getSeed(flags), {cwd: flags.cwd}); + const parserOpts = selectParserOpts(loaded.parserPreset); + const opts = parserOpts ? {parserOpts} : undefined; + const report = await core.lint(message, loaded.rules, opts); + const formatted = core.format(report, {color: flags.color}); + + if (!flags.quiet) { + console.log( + `${fmt.grey('⧗')} input: ${fmt.bold(message.split('\n')[0])}` + ); + console.log(formatted.join('\n')); + } + + if (report.errors.length > 0) { + const error = new Error(formatted[formatted.length - 1]); + error.type = pkg.name; + throw error; + } + console.log(''); + }) ); } -function normalizeOptions(options) { - const flags = options.flags; - +function normalizeFlags(flags) { // The `edit` flag is either a boolean or a string but we are only allowed // to specify one of them in minimist if (flags.edit === '') { - flags.edit = true; - flags.e = true; + return merge({}, flags, {edit: true, e: true}); } + + return flags; } function getSeed(seed) { @@ -135,16 +133,6 @@ function getSeed(seed) { : {parserPreset: seed.parserPreset}; } -// Start the engine -main(cli).catch(err => - setTimeout(() => { - if (err.type === pkg.name) { - process.exit(1); - } - throw err; - }) -); - function selectParserOpts(parserPreset) { if (typeof parserPreset !== 'object') { return undefined; diff --git a/@commitlint/cli/src/cli.test.js b/@commitlint/cli/src/cli.test.js new file mode 100644 index 0000000000..b314f00607 --- /dev/null +++ b/@commitlint/cli/src/cli.test.js @@ -0,0 +1,126 @@ +import path from 'path'; +import {git} from '@commitlint/test'; +import test from 'ava'; +import execa from 'execa'; +import {merge} from 'lodash'; +import * as sander from 'sander'; +import stream from 'string-to-stream'; + +const bin = path.join(__dirname, './cli.js'); + +const cli = (args, options) => { + return (input = '') => { + const c = execa(bin, args, { + capture: ['stdout'], + cwd: options.cwd, + env: options.env + }); + stream(input).pipe(c.stdin); + return c.catch(err => err); + }; +}; + +test('should throw when called without [input]', async t => { + const cwd = await git.bootstrap('fixtures/empty'); + const actual = await cli([], {cwd})(); + t.is(actual.code, 1); +}); + +test('should reprint input from stdin', async t => { + const cwd = await git.bootstrap('fixtures/empty'); + const actual = await cli([], {cwd})('foo: bar'); + t.true(actual.stdout.includes('foo: bar')); +}); + +test('should produce no success output with --quiet flag', async t => { + const cwd = await git.bootstrap('fixtures/empty'); + const actual = await cli(['--quiet'], {cwd})('foo: bar'); + t.is(actual.stdout, ''); + t.is(actual.stderr, ''); +}); + +test('should produce no success output with -q flag', async t => { + const cwd = await git.bootstrap('fixtures/empty'); + const actual = await cli(['-q'], {cwd})('foo: bar'); + t.is(actual.stdout, ''); + t.is(actual.stderr, ''); +}); + +test('should succeed for input from stdin without rules', async t => { + const cwd = await git.bootstrap('fixtures/empty'); + const actual = await cli([], {cwd})('foo: bar'); + t.is(actual.code, 0); +}); + +test('should fail for input from stdin with rule from rc', async t => { + const cwd = await git.bootstrap('fixtures/simple'); + const actual = await cli([], {cwd})('foo: bar'); + t.true(actual.stdout.includes('type must not be one of [foo]')); + t.is(actual.code, 1); +}); + +test('should fail for input from stdin with rule from js', async t => { + const cwd = await git.bootstrap('fixtures/extends-root'); + const actual = await cli(['--extends', './extended'], {cwd})('foo: bar'); + t.true(actual.stdout.includes('type must not be one of [foo]')); + t.is(actual.code, 1); +}); + +test('should produce no error output with --quiet flag', async t => { + const cwd = await git.bootstrap('fixtures/simple'); + const actual = await cli(['--quiet'], {cwd})('foo: bar'); + t.is(actual.stdout, ''); + t.is(actual.stderr, ''); + t.is(actual.code, 1); +}); + +test('should produce no error output with -q flag', async t => { + const cwd = await git.bootstrap('fixtures/simple'); + const actual = await cli(['-q'], {cwd})('foo: bar'); + t.is(actual.stdout, ''); + t.is(actual.stderr, ''); + t.is(actual.code, 1); +}); + +test('should work with husky commitmsg hook and git commit', async () => { + const cwd = await git.bootstrap('fixtures/husky/integration'); + await writePkg({scripts: {commitmsg: `${bin} -e`}}, {cwd}); + + await execa('npm', ['install'], {cwd}); + await execa('git', ['add', 'package.json'], {cwd}); + await execa('git', ['commit', '-m', '"chore: this should work"'], {cwd}); +}); + +test('should work with husky commitmsg hook in sub packages', async () => { + const upper = await git.bootstrap('fixtures/husky'); + const cwd = path.join(upper, 'integration'); + await writePkg({scripts: {commitmsg: `${bin} -e`}}, {cwd: upper}); + + await execa('npm', ['install'], {cwd}); + await execa('git', ['add', 'package.json'], {cwd}); + await execa('git', ['commit', '-m', '"chore: this should work"'], {cwd}); +}); + +test('should pick up parser preset and fail accordingly', async t => { + const cwd = await git.bootstrap('fixtures/parser-preset'); + const actual = await cli(['--parser-preset', './parser-preset'], {cwd})( + 'type(scope): subject' + ); + t.is(actual.code, 1); + t.true(actual.stdout.includes('message may not be empty [subject-empty]')); +}); + +test('should pick up parser preset and succeed accordingly', async t => { + const cwd = await git.bootstrap('fixtures/parser-preset'); + const actual = await cli(['--parser-preset', './parser-preset'], {cwd})( + '----type(scope): subject' + ); + t.is(actual.code, 0); +}); + +async function writePkg(payload, options) { + const pkgPath = path.join(options.cwd, 'package.json'); + const pkg = JSON.parse(await sander.readFile(pkgPath)); + const result = merge(pkg, payload); + await sander.writeFile(pkgPath, JSON.stringify(result, null, ' ')); +} diff --git a/@commitlint/cli/help.js b/@commitlint/cli/src/help.js similarity index 100% rename from @commitlint/cli/help.js rename to @commitlint/cli/src/help.js diff --git a/package.json b/package.json index b0b3567d60..5c45fba0e5 100644 --- a/package.json +++ b/package.json @@ -5,24 +5,24 @@ "version": "1.0.0", "license": "MIT", "scripts": { - "build": "lerna run build --stream --parallel --include-filtered-dependencies", - "clean": "lerna clean --yes && lerna run clean --stream --parallel --include-filtered-dependencies", - "commit": "./@commitlint/prompt-cli/cli.js", - "commitmsg": "./@commitlint/cli/cli.js -e $GIT_PARAMS", - "docs": "docsify serve docs", - "postinstall": "lerna bootstrap", + "build": "npx lerna run build --stream --parallel --include-filtered-dependencies", + "clean": "npx lerna clean --yes && npx lerna run clean --stream --parallel --include-filtered-dependencies", + "commit": "npx -p @commitlint/prompt-cli commit", + "commitmsg": "npx commitlint -e $GIT_PARAMS", + "docs": "npx docsify serve docs", + "postinstall": "npx lerna bootstrap", "precommit": "lint-staged", - "pretest": "xo", - "publish": "lerna publish --conventional-commits", + "pretest": "npx xo", + "publish": "npx lerna publish --conventional-commits", "reinstall": "npm run clean && npm install", - "start": "lerna run start --stream --parallel --include-filtered-dependencies", - "test": "AVA_VERBOSE=--verbose lerna run test --stream --parallel --include-filtered-dependencies", - "travis": "trevor" + "start": "npx lerna run start --stream --parallel --include-filtered-dependencies", + "test": "AVA_VERBOSE=--verbose npx lerna run test --stream --parallel --include-filtered-dependencies", + "travis": "npx trevor" }, "lint-staged": { "*.js": [ - "prettier --write --use-tabs --single-quote --no-bracket-spacing", - "xo --fix", + "npx prettier --write --use-tabs --single-quote --no-bracket-spacing", + "npx xo --fix", "git add" ] }, From ab4ea5c8ddb3bf82d35f5babfb1d324fe4ba5f72 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Sat, 14 Oct 2017 14:34:22 +0200 Subject: [PATCH 3/6] fix(cli): nice error message for missing input --- @commitlint/cli/src/cli.js | 41 ++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/@commitlint/cli/src/cli.js b/@commitlint/cli/src/cli.js index 0706ff4021..56c164b155 100755 --- a/@commitlint/cli/src/cli.js +++ b/@commitlint/cli/src/cli.js @@ -10,14 +10,6 @@ const stdin = require('get-stdin'); const pkg = require('../package'); const help = require('./help'); -const rules = { - fromStdin: (input, flags) => - input.length === 0 && - typeof flags.from !== 'string' && - typeof flags.to !== 'string' && - !flags.edit -}; - const configuration = { string: ['cwd', 'from', 'to', 'edit', 'extends', 'parser-preset'], boolean: ['help', 'version', 'quiet', 'color'], @@ -80,7 +72,7 @@ main(cli).catch(err => async function main(options) { const raw = options.input; const flags = normalizeFlags(options.flags); - const fromStdin = rules.fromStdin(raw, flags); + const fromStdin = checkFromStdin(raw, flags); const range = pick(flags, 'edit', 'from', 'to'); const fmt = new chalk.constructor({enabled: flags.color}); @@ -88,7 +80,20 @@ async function main(options) { const input = await (fromStdin ? stdin() : core.read(range, {cwd: flags.cwd})); - const messages = Array.isArray(input) ? input : [input]; + + const messages = (Array.isArray(input) ? input : [input]) + .filter(message => typeof message === 'string') + .filter(Boolean); + + if (messages.length === 0 && !checkFromRepository(flags)) { + const err = new Error( + '[input] is required: supply via stdin, or --edit or --from and --to' + ); + err.type = pkg.name; + console.log(`${cli.help}\n`); + console.log(err.message); + throw err; + } return Promise.all( messages.map(async message => { @@ -115,6 +120,22 @@ async function main(options) { ); } +function checkFromStdin(input, flags) { + return input.length === 0 && !checkFromRepository(flags); +} + +function checkFromRepository(flags) { + return checkFromHistory(flags) || checkFromEdit(flags); +} + +function checkFromEdit(flags) { + return Boolean(flags.edit); +} + +function checkFromHistory(flags) { + return typeof flags.from === 'string' || typeof flags.to === 'string'; +} + function normalizeFlags(flags) { // The `edit` flag is either a boolean or a string but we are only allowed // to specify one of them in minimist From ce4ca87b464dc2b8d850fccb315710298d64dfb8 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Sat, 14 Oct 2017 14:39:12 +0200 Subject: [PATCH 4/6] chore: add npx --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 5c45fba0e5..85980aa705 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "husky": "^0.14.3", "lerna": "^2.0.0", "lint-staged": "^4.0.1", + "npx": "^9.6.0", "prettier": "^1.5.2", "trevor": "^2.3.0", "xo": "^0.18.2" From 760c1b2cdbfc3c8bff80347fb4ef5a6364da0733 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Sat, 14 Oct 2017 14:45:10 +0200 Subject: [PATCH 5/6] chore: add appropriate run scripts --- @commitlint/cli/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/@commitlint/cli/package.json b/@commitlint/cli/package.json index 807add63cf..64ff42bbcf 100644 --- a/@commitlint/cli/package.json +++ b/@commitlint/cli/package.json @@ -9,7 +9,8 @@ "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", "clean": "rimraf lib", "prepublish": "npm run build", - "pretest": "dep-check", + "prestart": "dep-check && npnm run build", + "pretest": "dep-check && npnm run build", "start": "concurrently \"ava -c 4 --verbose --watch\" \"npm run watch\"", "test": "ava -c 4 $AVA_VERBOSE", "watch": "babel src --out-dir lib --watch --source-maps" From 9f54931d39060c53bc7c32e368c99abc68eaf9f2 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Sat, 14 Oct 2017 15:02:03 +0200 Subject: [PATCH 6/6] chore: fix typo --- @commitlint/cli/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/@commitlint/cli/package.json b/@commitlint/cli/package.json index 64ff42bbcf..eefdb8c4cf 100644 --- a/@commitlint/cli/package.json +++ b/@commitlint/cli/package.json @@ -9,8 +9,8 @@ "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", "clean": "rimraf lib", "prepublish": "npm run build", - "prestart": "dep-check && npnm run build", - "pretest": "dep-check && npnm run build", + "prestart": "dep-check && npm run build", + "pretest": "dep-check && npm run build", "start": "concurrently \"ava -c 4 --verbose --watch\" \"npm run watch\"", "test": "ava -c 4 $AVA_VERBOSE", "watch": "babel src --out-dir lib --watch --source-maps"