From 6973c6ba251c3f1759a0bba7799f8b900a962d49 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Wed, 22 Nov 2017 12:15:13 +0100 Subject: [PATCH 01/28] build: switch to independent mode --- lerna.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index c023c646c0..b04c804f06 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,6 @@ "lerna": "2.5.1", "npmClient": "yarn", "useWorkspaces": true, - "version": "5.0.1" + "version": "5.0.1", + "mode": "independent" } From 58fdd3eb9d10f598cd6046be878dc7647571dd67 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Wed, 22 Nov 2017 13:29:45 +0100 Subject: [PATCH 02/28] ci: draft shareable travis script --- .travis.yml | 1 + @commitlint/travis-cli/README.md | 19 ++++++++++ @commitlint/travis-cli/cli.js | 51 +++++++++++++++++++++++++++ @commitlint/travis-cli/cli.test.js | 43 +++++++++++++++++++++++ @commitlint/travis-cli/package.json | 54 +++++++++++++++++++++++++++++ package.json | 1 + yarn.lock | 12 +++++++ 7 files changed, 181 insertions(+) create mode 100644 @commitlint/travis-cli/README.md create mode 100755 @commitlint/travis-cli/cli.js create mode 100644 @commitlint/travis-cli/cli.test.js create mode 100644 @commitlint/travis-cli/package.json diff --git a/.travis.yml b/.travis.yml index 12a95059b0..26a79b4254 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ install: - yarn --version - npx --version script: + - commitlint-travis - npx yarn build --since $TRAVIS_BRANCH --include-filtered-dependencies --stream - npx yarn lint --since $TRAVIS_BRANCH --include-filtered-dependencies --stream - npx yarn deps --since $TRAVIS_BRANCH --include-filtered-dependencies --stream diff --git a/@commitlint/travis-cli/README.md b/@commitlint/travis-cli/README.md new file mode 100644 index 0000000000..a85348bf77 --- /dev/null +++ b/@commitlint/travis-cli/README.md @@ -0,0 +1,19 @@ +> Lint all relevant commits for a change or PR on Travis CI + +# @commitlint/travis-cli + +This package is a convenience wrapper around `commitlint`, +providing zero-configuration linting of all relevant commits +for a given change/build combination. + +## Getting started + +``` +npm install --save-dev @commitlint/travis-cli +``` + +```yml +# .travis.yml +script + - commitlint-travis +``` diff --git a/@commitlint/travis-cli/cli.js b/@commitlint/travis-cli/cli.js new file mode 100755 index 0000000000..50abeb1844 --- /dev/null +++ b/@commitlint/travis-cli/cli.js @@ -0,0 +1,51 @@ +#!/usr/bin/env node +const path = require('path'); +const execa = require('execa'); +const isTravis = require('is-travis'); + +const REQUIRED = ['TRAVIS_COMMIT', 'TRAVIS_BRANCH']; + +main().catch(err => { + console.log({err}); + setTimeout(() => { + console.log({err}); + throw err; + }, 0); +}); + +function main() { + return new Promise((resolve, reject) => { + if (!isTravis) { + return reject( + new Error(`@commitlint/travis-cli is inteded of usage on Travis CI`) + ); + } + + const missing = REQUIRED.filter(envVar => !(envVar in process.env)); + + if (missing.length > 0) { + const stanza = missing.length > 1 ? 'they were not' : 'it was not'; + return reject( + new Error( + `Expected ${missing.join(', ')} to be defined globally, ${stanza}.` + ) + ); + } + + return execa('git', ['remote', 'set-branches', 'origin', 'master']) + .then(() => execa('git', ['fetch', '--unshallow'])) + .then(() => execa('git', ['checkout', 'master'])) + .then(() => execa('git', ['checkout', '-'])) + .then(() => { + return execa('npm', ['bin']).then(result => { + const bin = result.stdout.split('\n')[0]; + return execa(path.join(bin, 'commitlint'), [ + '--from', + process.env.TRAVIS_BRANCH, + '--to', + process.env.TRAVIS_COMMIT + ]); + }); + }); + }); +} diff --git a/@commitlint/travis-cli/cli.test.js b/@commitlint/travis-cli/cli.test.js new file mode 100644 index 0000000000..b2639a46de --- /dev/null +++ b/@commitlint/travis-cli/cli.test.js @@ -0,0 +1,43 @@ +const test = require('ava'); +const execa = require('execa'); + +const BIN = require.resolve('./cli.js'); + +const bin = async (env = {}) => { + try { + return await execa(BIN, {env, extendEnv: false}); + } catch (err) { + throw new Error([err.stdout, err.stderr].join('\n')); + } +}; + +test('should throw when not on travis ci', t => { + t.throws(bin(), /@commitlint\/travis-cli is inteded of usage on Travis CI/); +}); + +test('should throw when on travis ci, but env vars are missing', t => { + const env = { + TRAVIS: true, + CI: true + }; + + t.throws(bin(env), /TRAVIS_COMMIT, TRAVIS_BRANCH/); +}); + +test('should throw when on travis ci, but TRAVIS_COMMIT is missing', t => { + const env = { + TRAVIS: true, + CI: true + }; + + t.throws(bin(env), /TRAVIS_COMMIT/); +}); + +test('should throw when on travis ci, but TRAVIS_BRANCH is missing', t => { + const env = { + TRAVIS: true, + CI: true + }; + + t.throws(bin(env), /TRAVIS_BRANCH/); +}); diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json new file mode 100644 index 0000000000..25e4223e45 --- /dev/null +++ b/@commitlint/travis-cli/package.json @@ -0,0 +1,54 @@ +{ + "name": "@commitlint/travis-cli", + "version": "5.0.1", + "description": "Lint all relevant commits for a change or PR on Travis CI", + "bin": { + "commitlint-travis": "./cli.js" + }, + "scripts": { + "deps": "dep-check", + "lint": "npx xo", + "start": "npx ava -c 4 --verbose --watch", + "test": "npx ava -c 4 --verbose" + }, + "ava": { + "files": [ + "*.test.js" + ], + "source": [ + "*.js" + ] + }, + "xo": false, + "engines": { + "node": ">=4" + }, + "repository": { + "type": "git", + "url": "https://github.com/marionebl/commitlint.git" + }, + "bugs": { + "url": "https://github.com/marionebl/commitlint/issues" + }, + "homepage": "https://github.com/marionebl/commitlint#readme", + "keywords": [ + "conventional-changelog", + "commitlint", + "cli" + ], + "author": { + "name": "Mario Nebl", + "email": "hello@herebecode.com" + }, + "license": "MIT", + "devDependencies": { + "@commitlint/utils": "^5.0.1", + "ava": "0.18.2" + }, + "dependencies": { + "@commitlint/cli": "^5.0.1", + "execa": "^0.8.0", + "is-travis": "^1.0.0", + "meow": "3.7.0" + } +} diff --git a/package.json b/package.json index bb9e5be3ca..972ba8b612 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "@marionebl/sander": "0.6.1" }, "devDependencies": { + "@commitlint/travis-cli": "file:./@commitlint/travis-cli", "docsify-cli": "4.1.12", "eslint": "4.11.0", "eslint-config-prettier": "2.8.0", diff --git a/yarn.lock b/yarn.lock index a5c04da3f9..2e237339fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -53,6 +53,14 @@ imurmurhash "^0.1.4" slide "^1.1.5" +"@commitlint/travis-cli@file:./@commitlint/travis-cli": + version "5.0.1" + dependencies: + "@commitlint/cli" "^5.0.1" + execa "^0.8.0" + is-travis "^1.0.0" + meow "3.7.0" + "@concordance/react@^1.0.0": version "1.0.0" resolved "https://registry.npmjs.org/@concordance/react/-/react-1.0.0.tgz#fcf3cad020e5121bfd1c61d05bc3516aac25f734" @@ -3955,6 +3963,10 @@ is-text-path@^1.0.0: dependencies: text-extensions "^1.0.0" +is-travis@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/is-travis/-/is-travis-1.0.0.tgz#89d40ed56d9b8f8c36dfbe5811ba7e5e14944df9" + is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" From a7ad565abbea775d2337962d10346139ad7a2f62 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Wed, 22 Nov 2017 13:40:24 +0100 Subject: [PATCH 03/28] ci: relink after building --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 26a79b4254..505d24ce1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,9 @@ install: - yarn --version - npx --version script: - - commitlint-travis - npx yarn build --since $TRAVIS_BRANCH --include-filtered-dependencies --stream + - npx lerna link + - commitlint-travis - npx yarn lint --since $TRAVIS_BRANCH --include-filtered-dependencies --stream - npx yarn deps --since $TRAVIS_BRANCH --include-filtered-dependencies --stream - npx yarn test --since $TRAVIS_BRANCH --include-filtered-dependencies --stream From ec62b220921ca2fbbdc19b1d653e08f2a07e425c Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 08:28:26 +0100 Subject: [PATCH 04/28] feat(cli): expose cli path --- @commitlint/cli/index.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 @commitlint/cli/index.js diff --git a/@commitlint/cli/index.js b/@commitlint/cli/index.js new file mode 100644 index 0000000000..861688777a --- /dev/null +++ b/@commitlint/cli/index.js @@ -0,0 +1 @@ +module.exports = require.resolve('./src/cli.js'); From 0ea70f10c697c0ea3997448c24ce6b1bc827fedb Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 09:21:28 +0100 Subject: [PATCH 05/28] test(travis-cli): cover invocations --- @commitlint/travis-cli/cli.js | 34 +++++--- @commitlint/travis-cli/cli.test.js | 86 +++++++++++++++++-- @commitlint/travis-cli/fixtures/commitlint.js | 2 + @commitlint/travis-cli/fixtures/git.js | 2 + @commitlint/travis-cli/package.json | 3 +- 5 files changed, 106 insertions(+), 21 deletions(-) create mode 100755 @commitlint/travis-cli/fixtures/commitlint.js create mode 100755 @commitlint/travis-cli/fixtures/git.js diff --git a/@commitlint/travis-cli/cli.js b/@commitlint/travis-cli/cli.js index 50abeb1844..eabb2c4458 100755 --- a/@commitlint/travis-cli/cli.js +++ b/@commitlint/travis-cli/cli.js @@ -1,8 +1,11 @@ #!/usr/bin/env node -const path = require('path'); const execa = require('execa'); const isTravis = require('is-travis'); +// Allow to override used bins for testing purposes +const GIT = process.env.TRAVIS_COMMITLINT_GIT_BIN || 'git'; +const COMMITLINT = + process.env.TRAVIS_COMMITLINT_BIN || require('@commitlint/cli'); // eslint-disable-line import/newline-after-import const REQUIRED = ['TRAVIS_COMMIT', 'TRAVIS_BRANCH']; main().catch(err => { @@ -32,20 +35,27 @@ function main() { ); } - return execa('git', ['remote', 'set-branches', 'origin', 'master']) - .then(() => execa('git', ['fetch', '--unshallow'])) - .then(() => execa('git', ['checkout', 'master'])) - .then(() => execa('git', ['checkout', '-'])) - .then(() => { - return execa('npm', ['bin']).then(result => { - const bin = result.stdout.split('\n')[0]; - return execa(path.join(bin, 'commitlint'), [ + return execa( + GIT, + ['remote', 'set-branches', 'origin', process.env.TRAVIS_BRANCH], + {stdio: 'inherit'} + ) + .then(() => execa(GIT, ['fetch', '--unshallow'], {stdio: 'inherit'})) + .then(() => + execa(GIT, ['checkout', process.env.TRAVIS_BRANCH], {stdio: 'inherit'}) + ) + .then(() => execa(GIT, ['checkout', '-'], {stdio: 'inherit'})) + .then(() => + execa( + COMMITLINT, + [ '--from', process.env.TRAVIS_BRANCH, '--to', process.env.TRAVIS_COMMIT - ]); - }); - }); + ], + {stdio: 'inherit'} + ) + ); }); } diff --git a/@commitlint/travis-cli/cli.test.js b/@commitlint/travis-cli/cli.test.js index b2639a46de..ab69417b55 100644 --- a/@commitlint/travis-cli/cli.test.js +++ b/@commitlint/travis-cli/cli.test.js @@ -1,8 +1,15 @@ const test = require('ava'); const execa = require('execa'); +const which = require('which'); +const NODE_BIN = which.sync('node'); const BIN = require.resolve('./cli.js'); +const TRAVIS_COMMITLINT_BIN = require.resolve('./fixtures/commitlint'); +const TRAVIS_COMMITLINT_GIT_BIN = require.resolve('./fixtures/git'); +const TRAVIS_BRANCH = 'TRAVIS_BRANCH'; +const TRAVIS_COMMIT = 'TRAVIS_COMMIT'; + const bin = async (env = {}) => { try { return await execa(BIN, {env, extendEnv: false}); @@ -11,33 +18,96 @@ const bin = async (env = {}) => { } }; -test('should throw when not on travis ci', t => { - t.throws(bin(), /@commitlint\/travis-cli is inteded of usage on Travis CI/); +test('should throw when not on travis ci', async t => { + await t.throws( + bin(), + /@commitlint\/travis-cli is inteded of usage on Travis CI/ + ); }); -test('should throw when on travis ci, but env vars are missing', t => { +test('should throw when on travis ci, but env vars are missing', async t => { const env = { TRAVIS: true, CI: true }; - t.throws(bin(env), /TRAVIS_COMMIT, TRAVIS_BRANCH/); + await t.throws(bin(env), /TRAVIS_COMMIT, TRAVIS_BRANCH/); }); -test('should throw when on travis ci, but TRAVIS_COMMIT is missing', t => { +test('should throw when on travis ci, but TRAVIS_COMMIT is missing', async t => { const env = { TRAVIS: true, CI: true }; - t.throws(bin(env), /TRAVIS_COMMIT/); + await t.throws(bin(env), /TRAVIS_COMMIT/); }); -test('should throw when on travis ci, but TRAVIS_BRANCH is missing', t => { +test('should throw when on travis ci, but TRAVIS_BRANCH is missing', async t => { const env = { TRAVIS: true, CI: true }; - t.throws(bin(env), /TRAVIS_BRANCH/); + await t.throws(bin(env), /TRAVIS_BRANCH/); }); + +test('should call git with expected args if requirements are fulfilled', async t => { + const env = { + TRAVIS: true, + CI: true, + TRAVIS_BRANCH, + TRAVIS_COMMIT, + TRAVIS_COMMITLINT_BIN, + TRAVIS_COMMITLINT_GIT_BIN + }; + + const result = await bin(env); + const invocations = await getInvocations(result.stdout); + t.is(invocations.length, 5); + + const [branches, unshallow, checkout, back, commilint] = invocations; + + t.deepEqual(branches, [ + NODE_BIN, + TRAVIS_COMMITLINT_GIT_BIN, + 'remote', + 'set-branches', + 'origin', + TRAVIS_BRANCH + ]); + t.deepEqual(unshallow, [ + NODE_BIN, + TRAVIS_COMMITLINT_GIT_BIN, + 'fetch', + '--unshallow' + ]); + t.deepEqual(checkout, [ + NODE_BIN, + TRAVIS_COMMITLINT_GIT_BIN, + 'checkout', + TRAVIS_BRANCH + ]); + t.deepEqual(back, [NODE_BIN, TRAVIS_COMMITLINT_GIT_BIN, 'checkout', '-']); + t.deepEqual(commilint, [ + NODE_BIN, + TRAVIS_COMMITLINT_BIN, + '--from', + TRAVIS_BRANCH, + '--to', + TRAVIS_COMMIT + ]); +}); + +function getInvocations(stdout) { + const matches = stdout.match(/[^[\]]+/g); + const raw = Array.isArray(matches) ? matches : []; + + return raw.filter(invocation => invocation !== '\n').map(invocation => + invocation + .split(',') + .map(fragment => fragment.trim()) + .map(fragment => fragment.substring(1, fragment.length - 1)) + .filter(Boolean) + ); +} diff --git a/@commitlint/travis-cli/fixtures/commitlint.js b/@commitlint/travis-cli/fixtures/commitlint.js new file mode 100755 index 0000000000..333349df2e --- /dev/null +++ b/@commitlint/travis-cli/fixtures/commitlint.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +console.log(process.argv); diff --git a/@commitlint/travis-cli/fixtures/git.js b/@commitlint/travis-cli/fixtures/git.js new file mode 100755 index 0000000000..333349df2e --- /dev/null +++ b/@commitlint/travis-cli/fixtures/git.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +console.log(process.argv); diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index 25e4223e45..6eb3006da6 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -43,7 +43,8 @@ "license": "MIT", "devDependencies": { "@commitlint/utils": "^5.0.1", - "ava": "0.18.2" + "ava": "0.18.2", + "which": "^1.3.0" }, "dependencies": { "@commitlint/cli": "^5.0.1", From f7dbac49a085669725d80c96714f8f3d08e57b6d Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 09:27:42 +0100 Subject: [PATCH 06/28] style: ensure consistent json indent --- .editorconfig | 2 +- lerna.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 88f50f5aef..62fcd43244 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,7 @@ insert_final_newline = true trim_trailing_whitespace = true indent_style = tab -[{.*rc,*.yml,*.md,package.json,*.svg}] +[{.*rc,*.yml,*.md,package.json,lerna.json,*.svg}] indent_style = space [*.md] diff --git a/lerna.json b/lerna.json index b04c804f06..b544859cab 100644 --- a/lerna.json +++ b/lerna.json @@ -2,6 +2,6 @@ "lerna": "2.5.1", "npmClient": "yarn", "useWorkspaces": true, - "version": "5.0.1", - "mode": "independent" + "version": "5.0.1", + "mode": "independent" } From 64369111620a9453156b95fd83c275f8ebe8d945 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 09:40:17 +0100 Subject: [PATCH 07/28] fix(travis-cli): remove unneeded meow dep --- @commitlint/travis-cli/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index 6eb3006da6..580854e022 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -49,7 +49,6 @@ "dependencies": { "@commitlint/cli": "^5.0.1", "execa": "^0.8.0", - "is-travis": "^1.0.0", - "meow": "3.7.0" + "is-travis": "^1.0.0" } } From 661fa7d0d78a654eb0c1ac3227775a6be8f89bf8 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 09:42:47 +0100 Subject: [PATCH 08/28] test(travis-cli): skip invocation tests on win32 --- @commitlint/travis-cli/cli.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/@commitlint/travis-cli/cli.test.js b/@commitlint/travis-cli/cli.test.js index ab69417b55..94259a6d12 100644 --- a/@commitlint/travis-cli/cli.test.js +++ b/@commitlint/travis-cli/cli.test.js @@ -1,3 +1,4 @@ +const os = require('os'); const test = require('ava'); const execa = require('execa'); const which = require('which'); @@ -53,6 +54,11 @@ test('should throw when on travis ci, but TRAVIS_BRANCH is missing', async t => }); test('should call git with expected args if requirements are fulfilled', async t => { + if (os.platform() === 'win32') { + t.pass(); + return; + } + const env = { TRAVIS: true, CI: true, From 4fa87445adb8c2ee351f513e32bb593611ea6a20 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 10:04:57 +0100 Subject: [PATCH 09/28] style: simplify catch branch --- @commitlint/travis-cli/cli.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/@commitlint/travis-cli/cli.js b/@commitlint/travis-cli/cli.js index eabb2c4458..7dc5d13607 100755 --- a/@commitlint/travis-cli/cli.js +++ b/@commitlint/travis-cli/cli.js @@ -9,11 +9,8 @@ const COMMITLINT = const REQUIRED = ['TRAVIS_COMMIT', 'TRAVIS_BRANCH']; main().catch(err => { - console.log({err}); - setTimeout(() => { - console.log({err}); - throw err; - }, 0); + console.log(err); + process.exit(1); }); function main() { From de96e8ddeef748c8f3b77eb5c0e87bdd2715119d Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 10:09:45 +0100 Subject: [PATCH 10/28] style: avoid Promise constructor --- @commitlint/travis-cli/cli.js | 70 +++++++++++++++++------------------ 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/@commitlint/travis-cli/cli.js b/@commitlint/travis-cli/cli.js index 7dc5d13607..dbcc25f0a6 100755 --- a/@commitlint/travis-cli/cli.js +++ b/@commitlint/travis-cli/cli.js @@ -14,45 +14,43 @@ main().catch(err => { }); function main() { - return new Promise((resolve, reject) => { - if (!isTravis) { - return reject( - new Error(`@commitlint/travis-cli is inteded of usage on Travis CI`) - ); - } + if (!isTravis) { + return Promise.reject( + new Error(`@commitlint/travis-cli is inteded of usage on Travis CI`) + ); + } - const missing = REQUIRED.filter(envVar => !(envVar in process.env)); + const missing = REQUIRED.filter(envVar => !(envVar in process.env)); - if (missing.length > 0) { - const stanza = missing.length > 1 ? 'they were not' : 'it was not'; - return reject( - new Error( - `Expected ${missing.join(', ')} to be defined globally, ${stanza}.` - ) - ); - } + if (missing.length > 0) { + const stanza = missing.length > 1 ? 'they were not' : 'it was not'; + return Promise.reject( + new Error( + `Expected ${missing.join(', ')} to be defined globally, ${stanza}.` + ) + ); + } - return execa( - GIT, - ['remote', 'set-branches', 'origin', process.env.TRAVIS_BRANCH], - {stdio: 'inherit'} + return execa( + GIT, + ['remote', 'set-branches', 'origin', process.env.TRAVIS_BRANCH], + {stdio: 'inherit'} + ) + .then(() => execa(GIT, ['fetch', '--unshallow'], {stdio: 'inherit'})) + .then(() => + execa(GIT, ['checkout', process.env.TRAVIS_BRANCH], {stdio: 'inherit'}) ) - .then(() => execa(GIT, ['fetch', '--unshallow'], {stdio: 'inherit'})) - .then(() => - execa(GIT, ['checkout', process.env.TRAVIS_BRANCH], {stdio: 'inherit'}) + .then(() => execa(GIT, ['checkout', '-'], {stdio: 'inherit'})) + .then(() => + execa( + COMMITLINT, + [ + '--from', + process.env.TRAVIS_BRANCH, + '--to', + process.env.TRAVIS_COMMIT + ], + {stdio: 'inherit'} ) - .then(() => execa(GIT, ['checkout', '-'], {stdio: 'inherit'})) - .then(() => - execa( - COMMITLINT, - [ - '--from', - process.env.TRAVIS_BRANCH, - '--to', - process.env.TRAVIS_COMMIT - ], - {stdio: 'inherit'} - ) - ); - }); + ); } From 2561a317547693140ac1a5ad87efc1b0b21ed2ef Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 14:31:09 +0100 Subject: [PATCH 11/28] refactor: use babel to use async/await --- @commitlint/travis-cli/cli.js | 56 -------------------- @commitlint/travis-cli/package.json | 16 ++++-- @commitlint/travis-cli/src/cli.js | 47 ++++++++++++++++ @commitlint/travis-cli/{ => src}/cli.test.js | 4 +- 4 files changed, 62 insertions(+), 61 deletions(-) delete mode 100755 @commitlint/travis-cli/cli.js create mode 100755 @commitlint/travis-cli/src/cli.js rename @commitlint/travis-cli/{ => src}/cli.test.js (94%) diff --git a/@commitlint/travis-cli/cli.js b/@commitlint/travis-cli/cli.js deleted file mode 100755 index dbcc25f0a6..0000000000 --- a/@commitlint/travis-cli/cli.js +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env node -const execa = require('execa'); -const isTravis = require('is-travis'); - -// Allow to override used bins for testing purposes -const GIT = process.env.TRAVIS_COMMITLINT_GIT_BIN || 'git'; -const COMMITLINT = - process.env.TRAVIS_COMMITLINT_BIN || require('@commitlint/cli'); // eslint-disable-line import/newline-after-import -const REQUIRED = ['TRAVIS_COMMIT', 'TRAVIS_BRANCH']; - -main().catch(err => { - console.log(err); - process.exit(1); -}); - -function main() { - if (!isTravis) { - return Promise.reject( - new Error(`@commitlint/travis-cli is inteded of usage on Travis CI`) - ); - } - - const missing = REQUIRED.filter(envVar => !(envVar in process.env)); - - if (missing.length > 0) { - const stanza = missing.length > 1 ? 'they were not' : 'it was not'; - return Promise.reject( - new Error( - `Expected ${missing.join(', ')} to be defined globally, ${stanza}.` - ) - ); - } - - return execa( - GIT, - ['remote', 'set-branches', 'origin', process.env.TRAVIS_BRANCH], - {stdio: 'inherit'} - ) - .then(() => execa(GIT, ['fetch', '--unshallow'], {stdio: 'inherit'})) - .then(() => - execa(GIT, ['checkout', process.env.TRAVIS_BRANCH], {stdio: 'inherit'}) - ) - .then(() => execa(GIT, ['checkout', '-'], {stdio: 'inherit'})) - .then(() => - execa( - COMMITLINT, - [ - '--from', - process.env.TRAVIS_BRANCH, - '--to', - process.env.TRAVIS_COMMIT - ], - {stdio: 'inherit'} - ) - ); -} diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index 580854e022..fdc76d92e7 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -3,9 +3,10 @@ "version": "5.0.1", "description": "Lint all relevant commits for a change or PR on Travis CI", "bin": { - "commitlint-travis": "./cli.js" + "commitlint-travis": "./lib/cli.js" }, "scripts": { + "build": "npx cross-env NODE_ENV=production npx -p babel-cli babel src --out-dir lib --source-maps", "deps": "dep-check", "lint": "npx xo", "start": "npx ava -c 4 --verbose --watch", @@ -13,10 +14,15 @@ }, "ava": { "files": [ - "*.test.js" + "src/*.test.js" ], "source": [ - "*.js" + "src/*.js" + ] + }, + "babel": { + "presets": [ + "commitlint" ] }, "xo": false, @@ -44,6 +50,10 @@ "devDependencies": { "@commitlint/utils": "^5.0.1", "ava": "0.18.2", + "babel-cli": "6.26.0", + "babel-preset-commitlint": "^5.0.1", + "babel-register": "6.26.0", + "cross-env": "5.1.1", "which": "^1.3.0" }, "dependencies": { diff --git a/@commitlint/travis-cli/src/cli.js b/@commitlint/travis-cli/src/cli.js new file mode 100755 index 0000000000..890a38c71b --- /dev/null +++ b/@commitlint/travis-cli/src/cli.js @@ -0,0 +1,47 @@ +#!/usr/bin/env node +const execa = require('execa'); +const isTravis = require('is-travis'); + +// Allow to override used bins for testing purposes +const GIT = process.env.TRAVIS_COMMITLINT_GIT_BIN || 'git'; +const COMMITLINT = + process.env.TRAVIS_COMMITLINT_BIN || require('@commitlint/cli'); // eslint-disable-line import/newline-after-import +const REQUIRED = ['TRAVIS_COMMIT', 'TRAVIS_BRANCH']; + +const TRAVIS_BRANCH = process.env.TRAVIS_BRANCH; +const TRAVIS_COMMIT = process.env.TRAVIS_COMMIT; + +main().catch(err => { + console.log(err); + process.exit(1); +}); + +async function main() { + if (!isTravis) { + throw new Error(`@commitlint/travis-cli is inteded of usage on Travis CI`); + } + + const missing = REQUIRED.filter(envVar => !(envVar in process.env)); + + if (missing.length > 0) { + const stanza = missing.length > 1 ? 'they were not' : 'it was not'; + throw new Error( + `Expected ${missing.join(', ')} to be defined globally, ${stanza}.` + ); + } + + await git(['remote', 'set-branches', 'origin', TRAVIS_BRANCH]); + await git(['fetch', '--unshallow']); + await git(['checkout', TRAVIS_BRANCH]); + await git(['checkout', '-']); + + await lint(['--from', TRAVIS_BRANCH, '--to', TRAVIS_COMMIT]); +} + +async function git(args, options) { + return execa(GIT, args, {stdio: 'inherit', ...options}); +} + +async function lint(args, options) { + return execa(COMMITLINT, args, {stdio: 'inherit', ...options}); +} diff --git a/@commitlint/travis-cli/cli.test.js b/@commitlint/travis-cli/src/cli.test.js similarity index 94% rename from @commitlint/travis-cli/cli.test.js rename to @commitlint/travis-cli/src/cli.test.js index 94259a6d12..3352fe6bb9 100644 --- a/@commitlint/travis-cli/cli.test.js +++ b/@commitlint/travis-cli/src/cli.test.js @@ -6,8 +6,8 @@ const which = require('which'); const NODE_BIN = which.sync('node'); const BIN = require.resolve('./cli.js'); -const TRAVIS_COMMITLINT_BIN = require.resolve('./fixtures/commitlint'); -const TRAVIS_COMMITLINT_GIT_BIN = require.resolve('./fixtures/git'); +const TRAVIS_COMMITLINT_BIN = require.resolve('../fixtures/commitlint'); +const TRAVIS_COMMITLINT_GIT_BIN = require.resolve('../fixtures/git'); const TRAVIS_BRANCH = 'TRAVIS_BRANCH'; const TRAVIS_COMMIT = 'TRAVIS_COMMIT'; From 4d6fb5c42d180daf078fa765c6dc9a932987d77c Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 15:09:48 +0100 Subject: [PATCH 12/28] ci: build everything --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 505d24ce1e..c093432fc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,14 +6,14 @@ node_js: install: - npm install -g npx - npx yarn install - - npx lerna bootstrap --since $TRAVIS_BRANCH --include-filtered-dependencies --stream + - npx lerna bootstrap - npm --version - yarn --version - npx --version script: - - npx yarn build --since $TRAVIS_BRANCH --include-filtered-dependencies --stream + - npx yarn build - npx lerna link - commitlint-travis - - npx yarn lint --since $TRAVIS_BRANCH --include-filtered-dependencies --stream - - npx yarn deps --since $TRAVIS_BRANCH --include-filtered-dependencies --stream - - npx yarn test --since $TRAVIS_BRANCH --include-filtered-dependencies --stream + - npx yarn lint + - npx yarn deps + - npx yarn test From 5c15e9e83e3178ba9c9a9c2082d464c66e7c203a Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 15:25:38 +0100 Subject: [PATCH 13/28] fix: use Object.assign instead of spread --- @commitlint/travis-cli/src/cli.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/@commitlint/travis-cli/src/cli.js b/@commitlint/travis-cli/src/cli.js index 890a38c71b..4f7bf68833 100755 --- a/@commitlint/travis-cli/src/cli.js +++ b/@commitlint/travis-cli/src/cli.js @@ -39,9 +39,13 @@ async function main() { } async function git(args, options) { - return execa(GIT, args, {stdio: 'inherit', ...options}); + return execa(GIT, args, Object.assign({}, {stdio: 'inherit'}, options)); } async function lint(args, options) { - return execa(COMMITLINT, args, {stdio: 'inherit', ...options}); + return execa( + COMMITLINT, + args, + Object.assign({}, {stdio: 'inherit'}, options) + ); } From 3a8fc357d4ed05ea14d945815725a7d327c1b80d Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 16:20:17 +0100 Subject: [PATCH 14/28] fix: integrate dogfed tools robustly --- .travis.yml | 3 +-- package.json | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c093432fc5..aeefbf6b1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,7 @@ install: - npx --version script: - npx yarn build - - npx lerna link - - commitlint-travis + - node @commitlint/travis-cli/lib/cli.js - npx yarn lint - npx yarn deps - npx yarn test diff --git a/package.json b/package.json index 972ba8b612..a3449678a0 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "scripts": { "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", + "commit": "node @commitlint/prompt-cli/cli.js", + "commitmsg": "node @commitlint/cli/lib/cli.js -e $GIT_PARAMS", "deps": "npx lerna run deps", "docs": "npx docsify serve docs", "lint": "npx lerna run lint", @@ -81,7 +81,6 @@ "@marionebl/sander": "0.6.1" }, "devDependencies": { - "@commitlint/travis-cli": "file:./@commitlint/travis-cli", "docsify-cli": "4.1.12", "eslint": "4.11.0", "eslint-config-prettier": "2.8.0", From 51c850bd15eb64cf8ef27d661ef7bbc69f768ebe Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 16:35:24 +0100 Subject: [PATCH 15/28] test: add babel build to ava --- @commitlint/travis-cli/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index fdc76d92e7..fc69ce1ad9 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -13,6 +13,10 @@ "test": "npx ava -c 4 --verbose" }, "ava": { + "babel": "inherit", + "require": [ + "babel-register" + ], "files": [ "src/*.test.js" ], From 291792e1e6a88a0251d6b99c7784b4b3c3ec018f Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 23 Nov 2017 22:26:23 +0100 Subject: [PATCH 16/28] build(travis-cli): ensure node <8 compat --- @commitlint/travis-cli/package.json | 17 +++++++++-------- @commitlint/travis-cli/src/cli.js | 4 +++- @commitlint/travis-cli/src/cli.test.js | 4 ++-- yarn.lock | 10 +--------- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index fc69ce1ad9..ff703e2d74 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -10,23 +10,24 @@ "deps": "dep-check", "lint": "npx xo", "start": "npx ava -c 4 --verbose --watch", - "test": "npx ava -c 4 --verbose" + "test": "npx ava -c 4 --verbose", + "watch": "babel src --out-dir lib --watch --source-maps" }, "ava": { - "babel": "inherit", - "require": [ - "babel-register" - ], "files": [ - "src/*.test.js" + "src/**/*.test.js" ], "source": [ - "src/*.js" + "lib/**/*.js" + ], + "babel": "inherit", + "require": [ + "babel-register" ] }, "babel": { "presets": [ - "commitlint" + "babel-preset-commitlint" ] }, "xo": false, diff --git a/@commitlint/travis-cli/src/cli.js b/@commitlint/travis-cli/src/cli.js index 4f7bf68833..af28d603c7 100755 --- a/@commitlint/travis-cli/src/cli.js +++ b/@commitlint/travis-cli/src/cli.js @@ -18,7 +18,9 @@ main().catch(err => { async function main() { if (!isTravis) { - throw new Error(`@commitlint/travis-cli is inteded of usage on Travis CI`); + throw new Error( + `@commitlint/travis-cli is inteded to be used on Travis CI` + ); } const missing = REQUIRED.filter(envVar => !(envVar in process.env)); diff --git a/@commitlint/travis-cli/src/cli.test.js b/@commitlint/travis-cli/src/cli.test.js index 3352fe6bb9..977e9304b4 100644 --- a/@commitlint/travis-cli/src/cli.test.js +++ b/@commitlint/travis-cli/src/cli.test.js @@ -4,7 +4,7 @@ const execa = require('execa'); const which = require('which'); const NODE_BIN = which.sync('node'); -const BIN = require.resolve('./cli.js'); +const BIN = require.resolve('../lib/cli.js'); const TRAVIS_COMMITLINT_BIN = require.resolve('../fixtures/commitlint'); const TRAVIS_COMMITLINT_GIT_BIN = require.resolve('../fixtures/git'); @@ -22,7 +22,7 @@ const bin = async (env = {}) => { test('should throw when not on travis ci', async t => { await t.throws( bin(), - /@commitlint\/travis-cli is inteded of usage on Travis CI/ + /@commitlint\/travis-cli is inteded to be used on Travis CI/ ); }); diff --git a/yarn.lock b/yarn.lock index 2e237339fc..30764eb293 100644 --- a/yarn.lock +++ b/yarn.lock @@ -53,14 +53,6 @@ imurmurhash "^0.1.4" slide "^1.1.5" -"@commitlint/travis-cli@file:./@commitlint/travis-cli": - version "5.0.1" - dependencies: - "@commitlint/cli" "^5.0.1" - execa "^0.8.0" - is-travis "^1.0.0" - meow "3.7.0" - "@concordance/react@^1.0.0": version "1.0.0" resolved "https://registry.npmjs.org/@concordance/react/-/react-1.0.0.tgz#fcf3cad020e5121bfd1c61d05bc3516aac25f734" @@ -7011,7 +7003,7 @@ which-module@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" -which@1, which@^1.2.10, which@^1.2.12, which@^1.2.14, which@^1.2.9: +which@1, which@^1.2.10, which@^1.2.12, which@^1.2.14, which@^1.2.9, which@^1.3.0: version "1.3.0" resolved "https://registry.npmjs.org/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" dependencies: From 08597d40b9a75856b97100ccf47d02847f900cf6 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 08:05:05 +0100 Subject: [PATCH 17/28] fix(travis-cli): be less noisy --- @commitlint/travis-cli/src/cli.js | 8 ++++---- @commitlint/travis-cli/src/cli.test.js | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/@commitlint/travis-cli/src/cli.js b/@commitlint/travis-cli/src/cli.js index af28d603c7..b26d1687e6 100755 --- a/@commitlint/travis-cli/src/cli.js +++ b/@commitlint/travis-cli/src/cli.js @@ -32,10 +32,10 @@ async function main() { ); } - await git(['remote', 'set-branches', 'origin', TRAVIS_BRANCH]); - await git(['fetch', '--unshallow']); - await git(['checkout', TRAVIS_BRANCH]); - await git(['checkout', '-']); + await git(['remote', 'set-branches', 'origin', TRAVIS_BRANCH, '--quiet']); + await git(['fetch', '--unshallow', '--quiet']); + await git(['checkout', TRAVIS_BRANCH, '--quiet']); + await git(['checkout', '-', '--quiet']); await lint(['--from', TRAVIS_BRANCH, '--to', TRAVIS_COMMIT]); } diff --git a/@commitlint/travis-cli/src/cli.test.js b/@commitlint/travis-cli/src/cli.test.js index 977e9304b4..32f7a83f27 100644 --- a/@commitlint/travis-cli/src/cli.test.js +++ b/@commitlint/travis-cli/src/cli.test.js @@ -80,21 +80,30 @@ test('should call git with expected args if requirements are fulfilled', async t 'remote', 'set-branches', 'origin', - TRAVIS_BRANCH + TRAVIS_BRANCH, + '--quiet' ]); t.deepEqual(unshallow, [ NODE_BIN, TRAVIS_COMMITLINT_GIT_BIN, 'fetch', - '--unshallow' + '--unshallow', + '--quiet' ]); t.deepEqual(checkout, [ NODE_BIN, TRAVIS_COMMITLINT_GIT_BIN, 'checkout', - TRAVIS_BRANCH + TRAVIS_BRANCH, + '--quiet' + ]); + t.deepEqual(back, [ + NODE_BIN, + TRAVIS_COMMITLINT_GIT_BIN, + 'checkout', + '-', + '--quiet' ]); - t.deepEqual(back, [NODE_BIN, TRAVIS_COMMITLINT_GIT_BIN, 'checkout', '-']); t.deepEqual(commilint, [ NODE_BIN, TRAVIS_COMMITLINT_BIN, From b37ca41578c3ad1ae4297b351ab685da64ce538e Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 08:16:20 +0100 Subject: [PATCH 18/28] build: remove npx for speed and simplicity --- @commitlint/cli/package.json | 10 +++++----- @commitlint/config-angular-type-enum/package.json | 2 +- @commitlint/config-angular/package.json | 2 +- @commitlint/config-lerna-scopes/package.json | 6 +++--- @commitlint/config-patternplate/package.json | 2 +- @commitlint/core/package.json | 10 +++++----- @commitlint/prompt-cli/package.json | 2 +- @commitlint/prompt/package.json | 12 ++++++------ @commitlint/travis-cli/package.json | 9 +++++---- @packages/babel-preset-commitlint/package.json | 6 +++--- @packages/test/package.json | 10 +++++----- @packages/utils/package.json | 2 +- 12 files changed, 37 insertions(+), 36 deletions(-) diff --git a/@commitlint/cli/package.json b/@commitlint/cli/package.json index 447ffdc969..b15f2f0de1 100644 --- a/@commitlint/cli/package.json +++ b/@commitlint/cli/package.json @@ -6,13 +6,13 @@ "commitlint": "./lib/cli.js" }, "scripts": { - "build": "npx cross-env NODE_ENV=production npx -p babel-cli babel src --out-dir lib --source-maps", + "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", "clean": "npx rimraf lib", "deps": "dep-check", - "lint": "npx xo", - "start": "npx concurrently \"npx ava -c 4 --verbose --watch\" \"npx yarn run watch\"", - "test": "npx ava -c 4 --verbose", - "watch": "npx -p babel-cli babel src --out-dir lib --watch --source-maps" + "lint": "xo", + "start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"", + "test": "ava -c 4 --verbose", + "watch": "babel src --out-dir lib --watch --source-maps" }, "ava": { "files": [ diff --git a/@commitlint/config-angular-type-enum/package.json b/@commitlint/config-angular-type-enum/package.json index d06dd39c37..a976a621de 100644 --- a/@commitlint/config-angular-type-enum/package.json +++ b/@commitlint/config-angular-type-enum/package.json @@ -5,7 +5,7 @@ "scripts": { "clean": "exit 0", "deps": "dep-check", - "lint": "npx xo", + "lint": "xo", "start": "exit 0", "test": "exit 0" }, diff --git a/@commitlint/config-angular/package.json b/@commitlint/config-angular/package.json index 9d38537118..1e272acc2b 100644 --- a/@commitlint/config-angular/package.json +++ b/@commitlint/config-angular/package.json @@ -5,7 +5,7 @@ "scripts": { "clean": "exit 0", "deps": "dep-check", - "lint": "npx xo", + "lint": "xo", "start": "exit 0", "test": "exit 0" }, diff --git a/@commitlint/config-lerna-scopes/package.json b/@commitlint/config-lerna-scopes/package.json index bf8d758e5a..8d9b36baed 100644 --- a/@commitlint/config-lerna-scopes/package.json +++ b/@commitlint/config-lerna-scopes/package.json @@ -4,9 +4,9 @@ "description": "Shareable commitlint config enforcing lerna package names as scopes", "scripts": { "clean": "exit 0", - "lint": "npx xo", - "start": "npx ava --watch --verbose", - "test": "npx ava --verbose" + "lint": "xo", + "start": "ava --watch --verbose", + "test": "ava --verbose" }, "xo": false, "ava": { diff --git a/@commitlint/config-patternplate/package.json b/@commitlint/config-patternplate/package.json index d20b50934d..d82bf4ec6d 100644 --- a/@commitlint/config-patternplate/package.json +++ b/@commitlint/config-patternplate/package.json @@ -5,7 +5,7 @@ "scripts": { "clean": "exit 0", "deps": "dep-check", - "lint": "npx xo", + "lint": "xo", "start": "exit 0", "test": "exit 0" }, diff --git a/@commitlint/core/package.json b/@commitlint/core/package.json index f482372c7f..ee46fe6bdb 100644 --- a/@commitlint/core/package.json +++ b/@commitlint/core/package.json @@ -4,13 +4,13 @@ "description": "Lint your commit messages", "main": "lib/index.js", "scripts": { - "build": "npx cross-env NODE_ENV=production npx -p babel-cli babel src --out-dir lib --source-maps", + "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", "clean": "npx rimraf lib", "deps": "dep-check", - "lint": "npx xo", - "start": "npx concurrently \"npx ava -c 4 --verbose --watch\" \"npx yarn run watch\"", - "test": "npx ava -c 4 --verbose && npx ava \"src/*.serial-test.js\" --verbose", - "watch": "npx -p babel-cli babel src --out-dir lib --watch --source-maps" + "lint": "xo", + "start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"", + "test": "ava -c 4 --verbose && ava \"src/*.serial-test.js\" --verbose", + "watch": "babel src --out-dir lib --watch --source-maps" }, "ava": { "files": [ diff --git a/@commitlint/prompt-cli/package.json b/@commitlint/prompt-cli/package.json index b199ab99d6..95ca851b85 100644 --- a/@commitlint/prompt-cli/package.json +++ b/@commitlint/prompt-cli/package.json @@ -9,7 +9,7 @@ "clean": "npx rimraf lib", "commit": "$npm_package_bin_commit", "deps": "dep-check", - "lint": "npx xo" + "lint": "xo" }, "xo": false, "repository": { diff --git a/@commitlint/prompt/package.json b/@commitlint/prompt/package.json index 57065edbfc..19c5553d3d 100644 --- a/@commitlint/prompt/package.json +++ b/@commitlint/prompt/package.json @@ -4,14 +4,14 @@ "description": "commitizen prompt using commitlint.config.js", "main": "./lib/index.js", "scripts": { - "build": "npx cross-env NODE_ENV=production npx -p babel-cli babel src --out-dir lib --source-maps", + "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", "clean": "npx rimraf lib", - "commit": "npx git-cz", + "commit": "git-cz", "deps": "dep-check", - "lint": "npx xo", - "start": "npx concurrently \"npx ava --watch --verbose\" \"npx yarn run watch\"", - "test": "npx ava --verbose", - "watch": "npx -p babel-cli babel src --out-dir lib --watch --source-maps" + "lint": "xo", + "start": "concurrently \"ava --watch --verbose\" \"yarn run watch\"", + "test": "ava --verbose", + "watch": "babel src --out-dir lib --watch --source-maps" }, "ava": { "babel": "inherit", diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index ff703e2d74..0c8f046ea9 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -6,11 +6,12 @@ "commitlint-travis": "./lib/cli.js" }, "scripts": { - "build": "npx cross-env NODE_ENV=production npx -p babel-cli babel src --out-dir lib --source-maps", + "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", + "clean": "npx rimraf lib", "deps": "dep-check", - "lint": "npx xo", - "start": "npx ava -c 4 --verbose --watch", - "test": "npx ava -c 4 --verbose", + "lint": "xo", + "start": "ava -c 4 --verbose --watch", + "test": "ava -c 4 --verbose", "watch": "babel src --out-dir lib --watch --source-maps" }, "ava": { diff --git a/@packages/babel-preset-commitlint/package.json b/@packages/babel-preset-commitlint/package.json index b2c31bf7ec..58cbacfafa 100644 --- a/@packages/babel-preset-commitlint/package.json +++ b/@packages/babel-preset-commitlint/package.json @@ -5,9 +5,9 @@ "main": "index.js", "scripts": { "deps": "dep-check", - "lint": "npx xo", - "start": "npx ava --watch --verbose", - "test": "npx ava --verbose" + "lint": "xo", + "start": "ava --watch --verbose", + "test": "ava --verbose" }, "ava": { "files": [ diff --git a/@packages/test/package.json b/@packages/test/package.json index 7c7ed756a9..560b35714f 100644 --- a/@packages/test/package.json +++ b/@packages/test/package.json @@ -5,13 +5,13 @@ "main": "lib/", "private": true, "scripts": { - "build": "npx cross-env NODE_ENV=production npx -p babel-cli babel src --out-dir lib --source-maps", + "build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", "clean": "npx rimraf lib", "deps": "dep-check", - "lint": "npx xo", - "start": "npx concurrently \"npx ava --watch --verbose\" \"npx yarn run watch\"", - "test": "npx ava --verbose", - "watch": "npx -p babel-cli babel src --out-dir lib --watch --source-maps" + "lint": "xo", + "start": "concurrently \"ava --watch --verbose\" \"yarn run watch\"", + "test": "ava --verbose", + "watch": "babel src --out-dir lib --watch --source-maps" }, "ava": { "files": [ diff --git a/@packages/utils/package.json b/@packages/utils/package.json index 0ac7d2ae17..399164de8f 100644 --- a/@packages/utils/package.json +++ b/@packages/utils/package.json @@ -4,7 +4,7 @@ "description": "Development utilities for @commitlint", "bin": { "dep-check": "./dep-check.js", - "lint": "npx xo" + "lint": "xo" }, "scripts": { "build": "exit 0", From ac4ebc05daa99b513c799f505d0974aafdeac743 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 08:25:18 +0100 Subject: [PATCH 19/28] build: simplify root level scripts --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index a3449678a0..3a8079b214 100644 --- a/package.json +++ b/package.json @@ -5,18 +5,18 @@ "version": "1.0.0", "license": "MIT", "scripts": { - "build": "npx lerna run build --stream --parallel --include-filtered-dependencies", + "build": "lerna run build --stream --parallel --include-filtered-dependencies", "clean": "npx lerna clean --yes && npx lerna run clean --stream --parallel --include-filtered-dependencies", "commit": "node @commitlint/prompt-cli/cli.js", "commitmsg": "node @commitlint/cli/lib/cli.js -e $GIT_PARAMS", - "deps": "npx lerna run deps", - "docs": "npx docsify serve docs", - "lint": "npx lerna run lint", + "deps": "lerna run deps", + "docs": "docsify serve docs", + "lint": "lerna run lint", "precommit": "lint-staged", - "publish": "npx lerna publish --conventional-commits", - "reinstall": "npm run clean && npm install", - "start": "npx lerna run start --stream --parallel --include-filtered-dependencies", - "test": "npx lerna run test --stream --parallel --include-filtered-dependencies" + "publish": "lerna publish --conventional-commits", + "reinstall": "yarn clean && yarn install", + "start": "lerna run start --stream --parallel --include-filtered-dependencies", + "test": "lerna run test --stream --parallel --include-filtered-dependencies" }, "commitlint": { "extends": [ From 333f287c57035bb0819dd923f49cbb37df488cf2 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 08:25:53 +0100 Subject: [PATCH 20/28] fix(travis-cli): remove faulty flag --- @commitlint/travis-cli/src/cli.js | 2 +- @commitlint/travis-cli/src/cli.test.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/@commitlint/travis-cli/src/cli.js b/@commitlint/travis-cli/src/cli.js index b26d1687e6..9819f05091 100755 --- a/@commitlint/travis-cli/src/cli.js +++ b/@commitlint/travis-cli/src/cli.js @@ -32,7 +32,7 @@ async function main() { ); } - await git(['remote', 'set-branches', 'origin', TRAVIS_BRANCH, '--quiet']); + await git(['remote', 'set-branches', 'origin', TRAVIS_BRANCH]); await git(['fetch', '--unshallow', '--quiet']); await git(['checkout', TRAVIS_BRANCH, '--quiet']); await git(['checkout', '-', '--quiet']); diff --git a/@commitlint/travis-cli/src/cli.test.js b/@commitlint/travis-cli/src/cli.test.js index 32f7a83f27..951adf9c1e 100644 --- a/@commitlint/travis-cli/src/cli.test.js +++ b/@commitlint/travis-cli/src/cli.test.js @@ -80,8 +80,7 @@ test('should call git with expected args if requirements are fulfilled', async t 'remote', 'set-branches', 'origin', - TRAVIS_BRANCH, - '--quiet' + TRAVIS_BRANCH ]); t.deepEqual(unshallow, [ NODE_BIN, From e1e1897b5c57ed38eeeb6a8687a60372fcda7658 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 08:33:28 +0100 Subject: [PATCH 21/28] build: remove independent mode --- lerna.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index b544859cab..c023c646c0 100644 --- a/lerna.json +++ b/lerna.json @@ -2,6 +2,5 @@ "lerna": "2.5.1", "npmClient": "yarn", "useWorkspaces": true, - "version": "5.0.1", - "mode": "independent" + "version": "5.0.1" } From 09f63d7873916e689b3bb37bcad277761df3a6a3 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 08:34:45 +0100 Subject: [PATCH 22/28] fix(cli): resolve to artifacts --- @commitlint/cli/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/@commitlint/cli/index.js b/@commitlint/cli/index.js index 861688777a..6babb12a58 100644 --- a/@commitlint/cli/index.js +++ b/@commitlint/cli/index.js @@ -1 +1,3 @@ -module.exports = require.resolve('./src/cli.js'); +const path = require('path'); + +module.exports = path.join(__dirname, 'lib/cli.js'); From da852e912bd67c6f647139b96a45125ced146fc6 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 13:27:57 +0100 Subject: [PATCH 23/28] fix(travis-cli): stash if git wd is dirty --- @commitlint/travis-cli/src/cli.js | 19 ++++++++++++++++ @commitlint/travis-cli/src/cli.test.js | 30 +++++++++++++++++--------- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/@commitlint/travis-cli/src/cli.js b/@commitlint/travis-cli/src/cli.js index 9819f05091..a9d10f55b7 100755 --- a/@commitlint/travis-cli/src/cli.js +++ b/@commitlint/travis-cli/src/cli.js @@ -32,11 +32,15 @@ async function main() { ); } + const pop = await stash(); + await git(['remote', 'set-branches', 'origin', TRAVIS_BRANCH]); await git(['fetch', '--unshallow', '--quiet']); await git(['checkout', TRAVIS_BRANCH, '--quiet']); await git(['checkout', '-', '--quiet']); + await pop(); + await lint(['--from', TRAVIS_BRANCH, '--to', TRAVIS_COMMIT]); } @@ -44,6 +48,13 @@ async function git(args, options) { return execa(GIT, args, Object.assign({}, {stdio: 'inherit'}, options)); } +async function isClean() { + const result = await git(['status', '--porcelain'], { + stdio: ['pipe', 'pipe', 'pipe'] + }); + return !(result.stdout && result.stdout.trim()); +} + async function lint(args, options) { return execa( COMMITLINT, @@ -51,3 +62,11 @@ async function lint(args, options) { Object.assign({}, {stdio: 'inherit'}, options) ); } + +async function stash() { + if (await isClean()) { + return async () => {}; + } + await git(['stash']); + return () => git(['stash', 'pop']); +} diff --git a/@commitlint/travis-cli/src/cli.test.js b/@commitlint/travis-cli/src/cli.test.js index 951adf9c1e..db5007c4e4 100644 --- a/@commitlint/travis-cli/src/cli.test.js +++ b/@commitlint/travis-cli/src/cli.test.js @@ -11,9 +11,9 @@ const TRAVIS_COMMITLINT_GIT_BIN = require.resolve('../fixtures/git'); const TRAVIS_BRANCH = 'TRAVIS_BRANCH'; const TRAVIS_COMMIT = 'TRAVIS_COMMIT'; -const bin = async (env = {}) => { +const bin = async (config = {}) => { try { - return await execa(BIN, {env, extendEnv: false}); + return await execa(BIN, Object.assign({extendEnv: false}, config)); } catch (err) { throw new Error([err.stdout, err.stderr].join('\n')); } @@ -32,7 +32,7 @@ test('should throw when on travis ci, but env vars are missing', async t => { CI: true }; - await t.throws(bin(env), /TRAVIS_COMMIT, TRAVIS_BRANCH/); + await t.throws(bin({env}), /TRAVIS_COMMIT, TRAVIS_BRANCH/); }); test('should throw when on travis ci, but TRAVIS_COMMIT is missing', async t => { @@ -41,7 +41,7 @@ test('should throw when on travis ci, but TRAVIS_COMMIT is missing', async t => CI: true }; - await t.throws(bin(env), /TRAVIS_COMMIT/); + await t.throws(bin({env}), /TRAVIS_COMMIT/); }); test('should throw when on travis ci, but TRAVIS_BRANCH is missing', async t => { @@ -50,7 +50,7 @@ test('should throw when on travis ci, but TRAVIS_BRANCH is missing', async t => CI: true }; - await t.throws(bin(env), /TRAVIS_BRANCH/); + await t.throws(bin({env}), /TRAVIS_BRANCH/); }); test('should call git with expected args if requirements are fulfilled', async t => { @@ -68,12 +68,21 @@ test('should call git with expected args if requirements are fulfilled', async t TRAVIS_COMMITLINT_GIT_BIN }; - const result = await bin(env); + const result = await bin({env}); const invocations = await getInvocations(result.stdout); - t.is(invocations.length, 5); - - const [branches, unshallow, checkout, back, commilint] = invocations; - + t.is(invocations.length, 7); + + const [ + stash, + branches, + unshallow, + checkout, + back, + pop, + commilint + ] = invocations; + + t.deepEqual(stash, [NODE_BIN, TRAVIS_COMMITLINT_GIT_BIN, 'stash']); t.deepEqual(branches, [ NODE_BIN, TRAVIS_COMMITLINT_GIT_BIN, @@ -103,6 +112,7 @@ test('should call git with expected args if requirements are fulfilled', async t '-', '--quiet' ]); + t.deepEqual(pop, [NODE_BIN, TRAVIS_COMMITLINT_GIT_BIN, 'stash', 'pop']); t.deepEqual(commilint, [ NODE_BIN, TRAVIS_COMMITLINT_BIN, From 1faa70a281c0f53515afe9c08a8c23032cfaabce Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 15:00:04 +0100 Subject: [PATCH 24/28] test(travis-cli): increase git coverage --- @commitlint/travis-cli/package.json | 3 ++ @commitlint/travis-cli/src/cli.js | 9 +++- @commitlint/travis-cli/src/cli.test.js | 66 +++++++++++++++++++++++++- yarn.lock | 2 +- 4 files changed, 76 insertions(+), 4 deletions(-) diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index 0c8f046ea9..68a5979db6 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -64,7 +64,10 @@ }, "dependencies": { "@commitlint/cli": "^5.0.1", + "@commitlint/test": "^5.0.1", + "@marionebl/sander": "^0.6.1", "execa": "^0.8.0", + "find-up": "^2.1.0", "is-travis": "^1.0.0" } } diff --git a/@commitlint/travis-cli/src/cli.js b/@commitlint/travis-cli/src/cli.js index a9d10f55b7..8bfe60363f 100755 --- a/@commitlint/travis-cli/src/cli.js +++ b/@commitlint/travis-cli/src/cli.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +const sander = require('@marionebl/sander'); const execa = require('execa'); +const findUp = require('find-up'); const isTravis = require('is-travis'); // Allow to override used bins for testing purposes @@ -23,6 +25,7 @@ async function main() { ); } + const gitRoot = await findUp('.git'); const missing = REQUIRED.filter(envVar => !(envVar in process.env)); if (missing.length > 0) { @@ -35,7 +38,11 @@ async function main() { const pop = await stash(); await git(['remote', 'set-branches', 'origin', TRAVIS_BRANCH]); - await git(['fetch', '--unshallow', '--quiet']); + + if (await sander.exists(gitRoot, 'shallow')) { + await git(['fetch', '--unshallow', '--quiet']); + } + await git(['checkout', TRAVIS_BRANCH, '--quiet']); await git(['checkout', '-', '--quiet']); diff --git a/@commitlint/travis-cli/src/cli.test.js b/@commitlint/travis-cli/src/cli.test.js index db5007c4e4..13ff2ae245 100644 --- a/@commitlint/travis-cli/src/cli.test.js +++ b/@commitlint/travis-cli/src/cli.test.js @@ -1,4 +1,5 @@ const os = require('os'); +const {git} = require('@commitlint/test'); const test = require('ava'); const execa = require('execa'); const which = require('which'); @@ -53,12 +54,16 @@ test('should throw when on travis ci, but TRAVIS_BRANCH is missing', async t => await t.throws(bin({env}), /TRAVIS_BRANCH/); }); -test('should call git with expected args if requirements are fulfilled', async t => { +test('should call git with expected args on shallow repo', async t => { if (os.platform() === 'win32') { t.pass(); return; } + const cwd = await git.clone('https://github.com/marionebl/commitlint.git', [ + '--depth=10' + ]); + const env = { TRAVIS: true, CI: true, @@ -68,7 +73,7 @@ test('should call git with expected args if requirements are fulfilled', async t TRAVIS_COMMITLINT_GIT_BIN }; - const result = await bin({env}); + const result = await bin({cwd, env}); const invocations = await getInvocations(result.stdout); t.is(invocations.length, 7); @@ -123,6 +128,63 @@ test('should call git with expected args if requirements are fulfilled', async t ]); }); +test('should call git with expected args on unshallow repo', async t => { + if (os.platform() === 'win32') { + t.pass(); + return; + } + + const cwd = await git.clone('https://github.com/marionebl/commitlint.git'); + + const env = { + TRAVIS: true, + CI: true, + TRAVIS_BRANCH, + TRAVIS_COMMIT, + TRAVIS_COMMITLINT_BIN, + TRAVIS_COMMITLINT_GIT_BIN + }; + + const result = await bin({cwd, env}); + const invocations = await getInvocations(result.stdout); + t.is(invocations.length, 6); + + const [stash, branches, checkout, back, pop, commilint] = invocations; + + t.deepEqual(stash, [NODE_BIN, TRAVIS_COMMITLINT_GIT_BIN, 'stash']); + t.deepEqual(branches, [ + NODE_BIN, + TRAVIS_COMMITLINT_GIT_BIN, + 'remote', + 'set-branches', + 'origin', + TRAVIS_BRANCH + ]); + t.deepEqual(checkout, [ + NODE_BIN, + TRAVIS_COMMITLINT_GIT_BIN, + 'checkout', + TRAVIS_BRANCH, + '--quiet' + ]); + t.deepEqual(back, [ + NODE_BIN, + TRAVIS_COMMITLINT_GIT_BIN, + 'checkout', + '-', + '--quiet' + ]); + t.deepEqual(pop, [NODE_BIN, TRAVIS_COMMITLINT_GIT_BIN, 'stash', 'pop']); + t.deepEqual(commilint, [ + NODE_BIN, + TRAVIS_COMMITLINT_BIN, + '--from', + TRAVIS_BRANCH, + '--to', + TRAVIS_COMMIT + ]); +}); + function getInvocations(stdout) { const matches = stdout.match(/[^[\]]+/g); const raw = Array.isArray(matches) ? matches : []; diff --git a/yarn.lock b/yarn.lock index 30764eb293..b4aa9d825b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -81,7 +81,7 @@ split2 "^2.0.0" through2 "^2.0.0" -"@marionebl/sander@0.6.1", "@marionebl/sander@^0.6.0": +"@marionebl/sander@0.6.1", "@marionebl/sander@^0.6.0", "@marionebl/sander@^0.6.1": version "0.6.1" resolved "https://registry.npmjs.org/@marionebl/sander/-/sander-0.6.1.tgz#1958965874f24bc51be48875feb50d642fc41f7b" dependencies: From ae3b87adfd275ee7d321c271d480efda89795141 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 15:15:10 +0100 Subject: [PATCH 25/28] test(travis-cli): explicitly disable Travis CI --- @commitlint/travis-cli/src/cli.test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/@commitlint/travis-cli/src/cli.test.js b/@commitlint/travis-cli/src/cli.test.js index 13ff2ae245..2426a8db08 100644 --- a/@commitlint/travis-cli/src/cli.test.js +++ b/@commitlint/travis-cli/src/cli.test.js @@ -21,8 +21,13 @@ const bin = async (config = {}) => { }; test('should throw when not on travis ci', async t => { + const env = { + CI: null, + TRAVIS: null + }; + await t.throws( - bin(), + bin({env}), /@commitlint\/travis-cli is inteded to be used on Travis CI/ ); }); From f8fafa3adb473fd1025bf32576d7226db600033d Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 15:41:00 +0100 Subject: [PATCH 26/28] test(travis-cli): check if Travis CI on our own --- @commitlint/travis-cli/package.json | 3 +-- @commitlint/travis-cli/src/cli.js | 3 +-- @commitlint/travis-cli/src/cli.test.js | 4 ++-- yarn.lock | 4 ---- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index 68a5979db6..16bccedc89 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -67,7 +67,6 @@ "@commitlint/test": "^5.0.1", "@marionebl/sander": "^0.6.1", "execa": "^0.8.0", - "find-up": "^2.1.0", - "is-travis": "^1.0.0" + "find-up": "^2.1.0" } } diff --git a/@commitlint/travis-cli/src/cli.js b/@commitlint/travis-cli/src/cli.js index 8bfe60363f..8ab5184c4f 100755 --- a/@commitlint/travis-cli/src/cli.js +++ b/@commitlint/travis-cli/src/cli.js @@ -2,7 +2,6 @@ const sander = require('@marionebl/sander'); const execa = require('execa'); const findUp = require('find-up'); -const isTravis = require('is-travis'); // Allow to override used bins for testing purposes const GIT = process.env.TRAVIS_COMMITLINT_GIT_BIN || 'git'; @@ -19,7 +18,7 @@ main().catch(err => { }); async function main() { - if (!isTravis) { + if (process.env.CI !== 'true' || process.env.TRAVIS !== 'true') { throw new Error( `@commitlint/travis-cli is inteded to be used on Travis CI` ); diff --git a/@commitlint/travis-cli/src/cli.test.js b/@commitlint/travis-cli/src/cli.test.js index 2426a8db08..dcda393d24 100644 --- a/@commitlint/travis-cli/src/cli.test.js +++ b/@commitlint/travis-cli/src/cli.test.js @@ -22,8 +22,8 @@ const bin = async (config = {}) => { test('should throw when not on travis ci', async t => { const env = { - CI: null, - TRAVIS: null + CI: false, + TRAVIS: false }; await t.throws( diff --git a/yarn.lock b/yarn.lock index b4aa9d825b..85f8a61079 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3955,10 +3955,6 @@ is-text-path@^1.0.0: dependencies: text-extensions "^1.0.0" -is-travis@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/is-travis/-/is-travis-1.0.0.tgz#89d40ed56d9b8f8c36dfbe5811ba7e5e14944df9" - is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" From 930487c71d88c9809ed287d908b2213f682cbcf3 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 15:49:07 +0100 Subject: [PATCH 27/28] fix(travis-cli): remove obsolete dep --- @commitlint/travis-cli/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index 16bccedc89..7be6686bb2 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -64,7 +64,6 @@ }, "dependencies": { "@commitlint/cli": "^5.0.1", - "@commitlint/test": "^5.0.1", "@marionebl/sander": "^0.6.1", "execa": "^0.8.0", "find-up": "^2.1.0" From 9c0f3cdc30f6a2b903d3ea08db1e3e47aeaa1a29 Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 24 Nov 2017 15:55:47 +0100 Subject: [PATCH 28/28] fix(travis-cli): readd as depdev --- @commitlint/travis-cli/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index 7be6686bb2..a6002ad80f 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -55,6 +55,7 @@ "license": "MIT", "devDependencies": { "@commitlint/utils": "^5.0.1", + "@commitlint/test": "^5.0.1", "ava": "0.18.2", "babel-cli": "6.26.0", "babel-preset-commitlint": "^5.0.1",