diff --git a/@alias/commitlint-config-lerna-scopes/CHANGELOG.md b/@alias/commitlint-config-lerna-scopes/CHANGELOG.md index 1923bceef8..fd80a176b5 100644 --- a/@alias/commitlint-config-lerna-scopes/CHANGELOG.md +++ b/@alias/commitlint-config-lerna-scopes/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + + + +**Note:** Version bump only for package commitlint-config-lerna-scopes + ## [5.1.1](https://github.com/marionebl/commitlint/compare/v5.1.0...v5.1.1) (2017-11-24) diff --git a/@alias/commitlint-config-lerna-scopes/package.json b/@alias/commitlint-config-lerna-scopes/package.json index edd082a11e..466877a02f 100644 --- a/@alias/commitlint-config-lerna-scopes/package.json +++ b/@alias/commitlint-config-lerna-scopes/package.json @@ -1,6 +1,6 @@ { "name": "commitlint-config-lerna-scopes", - "version": "5.1.1", + "version": "5.2.0", "description": "Shareable commitlint config enforcing lerna package names as scopes", "scripts": { "test": "exit 0", @@ -24,6 +24,6 @@ }, "homepage": "https://github.com/marionebl/commitlint#readme", "dependencies": { - "@commitlint/config-lerna-scopes": "^5.1.1" + "@commitlint/config-lerna-scopes": "^5.2.0" } } diff --git a/@alias/commitlint/CHANGELOG.md b/@alias/commitlint/CHANGELOG.md index 5b1fa47941..79c0060596 100644 --- a/@alias/commitlint/CHANGELOG.md +++ b/@alias/commitlint/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + + + +**Note:** Version bump only for package commitlint + ## [5.1.1](https://github.com/marionebl/commitlint/compare/v5.1.0...v5.1.1) (2017-11-24) diff --git a/@alias/commitlint/package.json b/@alias/commitlint/package.json index 830be46e57..89f512a53a 100644 --- a/@alias/commitlint/package.json +++ b/@alias/commitlint/package.json @@ -1,6 +1,6 @@ { "name": "commitlint", - "version": "5.1.1", + "version": "5.2.0", "description": "Lint your commit messages", "bin": { "commitlint": "cli.js" @@ -28,7 +28,7 @@ }, "license": "MIT", "dependencies": { - "@commitlint/cli": "^5.1.1", + "@commitlint/cli": "^5.2.0", "read-pkg": "3.0.0", "resolve-pkg": "1.0.0" } diff --git a/@commitlint/cli/CHANGELOG.md b/@commitlint/cli/CHANGELOG.md index 7b16ae59d2..e23b4fe32e 100644 --- a/@commitlint/cli/CHANGELOG.md +++ b/@commitlint/cli/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + + + +**Note:** Version bump only for package @commitlint/cli + ## [5.1.1](https://github.com/marionebl/commitlint/compare/v5.1.0...v5.1.1) (2017-11-24) diff --git a/@commitlint/cli/package.json b/@commitlint/cli/package.json index 0f6e9fe21e..6502bfec48 100644 --- a/@commitlint/cli/package.json +++ b/@commitlint/cli/package.json @@ -1,6 +1,6 @@ { "name": "@commitlint/cli", - "version": "5.1.1", + "version": "5.2.0", "description": "Lint your commit messages", "bin": { "commitlint": "./lib/cli.js" @@ -50,11 +50,11 @@ }, "license": "MIT", "devDependencies": { - "@commitlint/test": "^5.1.1", + "@commitlint/test": "^5.2.0", "@commitlint/utils": "^5.1.1", "ava": "0.18.2", "babel-cli": "6.26.0", - "babel-preset-commitlint": "^5.1.1", + "babel-preset-commitlint": "^5.2.0", "babel-register": "6.26.0", "concurrently": "3.5.1", "cross-env": "5.1.1", @@ -69,7 +69,7 @@ "xo": "0.18.2" }, "dependencies": { - "@commitlint/core": "^5.1.1", + "@commitlint/core": "^5.2.0", "babel-polyfill": "6.26.0", "chalk": "2.3.0", "get-stdin": "5.0.1", diff --git a/@commitlint/config-lerna-scopes/CHANGELOG.md b/@commitlint/config-lerna-scopes/CHANGELOG.md index f33d6c4c01..fad8e06b1d 100644 --- a/@commitlint/config-lerna-scopes/CHANGELOG.md +++ b/@commitlint/config-lerna-scopes/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + + + +**Note:** Version bump only for package @commitlint/config-lerna-scopes + ## [5.1.1](https://github.com/marionebl/commitlint/compare/v5.1.0...v5.1.1) (2017-11-24) diff --git a/@commitlint/config-lerna-scopes/package.json b/@commitlint/config-lerna-scopes/package.json index c684362625..89c6bbb1ef 100644 --- a/@commitlint/config-lerna-scopes/package.json +++ b/@commitlint/config-lerna-scopes/package.json @@ -1,6 +1,6 @@ { "name": "@commitlint/config-lerna-scopes", - "version": "5.1.1", + "version": "5.2.0", "description": "Shareable commitlint config enforcing lerna package names as scopes", "scripts": { "clean": "exit 0", @@ -39,7 +39,7 @@ "lerna": "2.5.1" }, "devDependencies": { - "@commitlint/test": "^5.1.1", + "@commitlint/test": "^5.2.0", "ava": "0.22.0", "xo": "0.18.2" } diff --git a/@commitlint/core/CHANGELOG.md b/@commitlint/core/CHANGELOG.md index 006a3d6e19..32d7f78708 100644 --- a/@commitlint/core/CHANGELOG.md +++ b/@commitlint/core/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + +### Bug Fixes + +* consider pull requests from forks ([4653c2c](https://github.com/marionebl/commitlint/commit/4653c2c)) + + + + ## [5.1.1](https://github.com/marionebl/commitlint/compare/v5.1.0...v5.1.1) (2017-11-24) diff --git a/@commitlint/core/package.json b/@commitlint/core/package.json index 57bc7126a7..a8f60b4d19 100644 --- a/@commitlint/core/package.json +++ b/@commitlint/core/package.json @@ -1,6 +1,6 @@ { "name": "@commitlint/core", - "version": "5.1.1", + "version": "5.2.0", "description": "Lint your commit messages", "main": "lib/index.js", "scripts": { @@ -55,21 +55,17 @@ }, "license": "MIT", "devDependencies": { - "@commitlint/test": "^5.1.1", + "@commitlint/test": "^5.2.0", "@commitlint/utils": "^5.1.1", "ava": "0.22.0", "babel-cli": "6.26.0", - "babel-preset-commitlint": "^5.1.1", + "babel-preset-commitlint": "^5.2.0", "babel-register": "6.26.0", "concurrently": "3.5.1", "cross-env": "5.1.1", - "denodeify": "1.2.1", - "dependency-check": "2.7.0", "execa": "0.8.0", "globby": "6.1.0", "import-from": "2.1.0", - "path-exists": "3.0.0", - "resolve-from": "4.0.0", "rimraf": "2.6.1", "xo": "0.18.2" }, @@ -83,7 +79,6 @@ "cosmiconfig": "^3.0.1", "find-up": "^2.1.0", "lodash": "^4.17.4", - "path-exists": "^3.0.0", "require-uncached": "^1.0.3", "resolve-from": "^4.0.0", "resolve-global": "^0.1.0", diff --git a/@commitlint/core/src/read.js b/@commitlint/core/src/read.js index 642da86e3f..9992f34077 100644 --- a/@commitlint/core/src/read.js +++ b/@commitlint/core/src/read.js @@ -1,5 +1,4 @@ import path from 'path'; -import exists from 'path-exists'; import gitRawCommits from '@marionebl/git-raw-commits'; import * as sander from '@marionebl/sander'; @@ -7,12 +6,6 @@ import toplevel from './library/toplevel'; export default getCommitMessages; -const SHALLOW_MESSAGE = [ - 'Could not get git history from shallow clone.', - 'Use git fetch --unshallow before linting.', - 'Original issue: https://git.io/vyKMq\n Refer to https://git.io/vyKMv for details.' -].join('\n'); - // Get commit messages // Object => Promise> async function getCommitMessages(settings) { @@ -22,10 +15,6 @@ async function getCommitMessages(settings) { return getEditCommit(cwd, edit); } - if (await isShallow(cwd)) { - throw new Error(SHALLOW_MESSAGE); - } - return getHistoryCommits({from, to}, {cwd}); } @@ -43,19 +32,6 @@ function getHistoryCommits(options, opts = {}) { }); } -// Check if the current repository is shallow -// (cwd: string) => Promise -async function isShallow(cwd) { - const top = await toplevel(cwd); - - if (typeof top !== 'string') { - throw new TypeError(`Could not find git root from ${cwd}`); - } - - const shallow = path.join(top, '.git/shallow'); - return exists(shallow); -} - // Get recently edited commit message // (cwd: string, edit: any) => Promise> async function getEditCommit(cwd, edit) { diff --git a/@commitlint/core/src/read.test.js b/@commitlint/core/src/read.test.js index fcc802baae..da60beb8e9 100644 --- a/@commitlint/core/src/read.test.js +++ b/@commitlint/core/src/read.test.js @@ -3,7 +3,6 @@ import test from 'ava'; import execa from 'execa'; import * as sander from '@marionebl/sander'; -import pkg from '../package'; import read from './read'; test('get edit commit message specified by the `edit` flag', async t => { @@ -52,12 +51,3 @@ test('get edit commit message from git subdirectory', async t => { const actual = await read({edit: true, cwd}); t.deepEqual(actual, expected); }); - -test('get history commit messages from shallow clone', async t => { - const cwd = await git.clone(pkg.repository.url, '--depth', '1'); - const err = await t.throws(read({from: 'master', cwd})); - - t.true( - err.message.indexOf('Could not get git history from shallow clone') > -1 - ); -}); diff --git a/@commitlint/prompt-cli/CHANGELOG.md b/@commitlint/prompt-cli/CHANGELOG.md index 0afb1cf32f..cb524bb972 100644 --- a/@commitlint/prompt-cli/CHANGELOG.md +++ b/@commitlint/prompt-cli/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + + + +**Note:** Version bump only for package @commitlint/prompt-cli + ## [5.1.2](https://github.com/marionebl/commitlint/compare/v5.1.1...v5.1.2) (2017-11-24) diff --git a/@commitlint/prompt-cli/package.json b/@commitlint/prompt-cli/package.json index 158b33fd96..013de22f11 100644 --- a/@commitlint/prompt-cli/package.json +++ b/@commitlint/prompt-cli/package.json @@ -1,6 +1,6 @@ { "name": "@commitlint/prompt-cli", - "version": "5.1.2", + "version": "5.2.0", "description": "commit prompt using commitlint.config.js", "bin": { "commit": "./cli.js" @@ -31,7 +31,7 @@ "xo": "0.18.2" }, "dependencies": { - "@commitlint/prompt": "^5.1.2", + "@commitlint/prompt": "^5.2.0", "execa": "0.8.0", "meow": "3.7.0" } diff --git a/@commitlint/prompt/CHANGELOG.md b/@commitlint/prompt/CHANGELOG.md index 5919a41450..a688aa3f63 100644 --- a/@commitlint/prompt/CHANGELOG.md +++ b/@commitlint/prompt/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + + + +**Note:** Version bump only for package @commitlint/prompt + ## [5.1.2](https://github.com/marionebl/commitlint/compare/v5.1.1...v5.1.2) (2017-11-24) diff --git a/@commitlint/prompt/package.json b/@commitlint/prompt/package.json index 110d521e4c..093d826a5e 100644 --- a/@commitlint/prompt/package.json +++ b/@commitlint/prompt/package.json @@ -1,6 +1,6 @@ { "name": "@commitlint/prompt", - "version": "5.1.2", + "version": "5.2.0", "description": "commitizen prompt using commitlint.config.js", "main": "./lib/index.js", "scripts": { @@ -57,7 +57,7 @@ "@commitlint/utils": "^5.1.1", "ava": "0.20.0", "babel-cli": "6.26.0", - "babel-preset-commitlint": "^5.1.1", + "babel-preset-commitlint": "^5.2.0", "babel-register": "6.26.0", "commitizen": "2.9.6", "concurrently": "3.5.1", @@ -66,7 +66,7 @@ "xo": "0.18.2" }, "dependencies": { - "@commitlint/core": "^5.1.1", + "@commitlint/core": "^5.2.0", "babel-runtime": "^6.23.0", "chalk": "^2.0.0", "lodash": "^4.17.4", diff --git a/@commitlint/travis-cli/CHANGELOG.md b/@commitlint/travis-cli/CHANGELOG.md index b1f5df3a0f..114f98da79 100644 --- a/@commitlint/travis-cli/CHANGELOG.md +++ b/@commitlint/travis-cli/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + +### Bug Fixes + +* consider pull requests from forks ([4653c2c](https://github.com/marionebl/commitlint/commit/4653c2c)) + + + + ## [5.1.1](https://github.com/marionebl/commitlint/compare/v5.1.0...v5.1.1) (2017-11-24) diff --git a/@commitlint/travis-cli/package.json b/@commitlint/travis-cli/package.json index 785cb9cdad..78704c514b 100644 --- a/@commitlint/travis-cli/package.json +++ b/@commitlint/travis-cli/package.json @@ -1,6 +1,6 @@ { "name": "@commitlint/travis-cli", - "version": "5.1.1", + "version": "5.2.0", "description": "Lint all relevant commits for a change or PR on Travis CI", "bin": { "commitlint-travis": "./lib/cli.js" @@ -54,19 +54,18 @@ }, "license": "MIT", "devDependencies": { - "@commitlint/test": "^5.1.1", + "@commitlint/test": "^5.2.0", "@commitlint/utils": "^5.1.1", "ava": "0.18.2", "babel-cli": "6.26.0", - "babel-preset-commitlint": "^5.1.1", + "babel-preset-commitlint": "^5.2.0", "babel-register": "6.26.0", "cross-env": "5.1.1", "which": "^1.3.0" }, "dependencies": { - "@commitlint/cli": "^5.1.1", - "@marionebl/sander": "^0.6.1", - "execa": "^0.8.0", - "find-up": "^2.1.0" + "@commitlint/cli": "^5.2.0", + "babel-runtime": "^6.26.0", + "execa": "^0.8.0" } } diff --git a/@commitlint/travis-cli/src/cli.js b/@commitlint/travis-cli/src/cli.js index 8ab5184c4f..c323182f84 100755 --- a/@commitlint/travis-cli/src/cli.js +++ b/@commitlint/travis-cli/src/cli.js @@ -1,16 +1,22 @@ #!/usr/bin/env node -const sander = require('@marionebl/sander'); const execa = require('execa'); -const findUp = require('find-up'); +const commitlint = require('@commitlint/cli'); // 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 COMMITLINT = process.env.TRAVIS_COMMITLINT_BIN; -const TRAVIS_BRANCH = process.env.TRAVIS_BRANCH; -const TRAVIS_COMMIT = process.env.TRAVIS_COMMIT; +const REQUIRED = [ + 'TRAVIS_COMMIT', + 'TRAVIS_COMMIT_RANGE', + 'TRAVIS_REPO_SLUG', + 'TRAVIS_PULL_REQUEST_SLUG' +]; + +const COMMIT = process.env.TRAVIS_COMMIT; +const REPO_SLUG = process.env.TRAVIS_REPO_SLUG; +const PR_SLUG = process.env.TRAVIS_PULL_REQUEST_SLUG || REPO_SLUG; +const RANGE = process.env.TRAVIS_COMMIT_RANGE; main().catch(err => { console.log(err); @@ -18,42 +24,39 @@ main().catch(err => { }); async function main() { - if (process.env.CI !== 'true' || process.env.TRAVIS !== 'true') { - throw new Error( - `@commitlint/travis-cli is inteded to be used on Travis CI` - ); - } - - const gitRoot = await findUp('.git'); - 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}.` - ); - } + validate(); + // Stash changes in working copy if needed const pop = await stash(); - await git(['remote', 'set-branches', 'origin', TRAVIS_BRANCH]); - - if (await sander.exists(gitRoot, 'shallow')) { - await git(['fetch', '--unshallow', '--quiet']); - } - - await git(['checkout', TRAVIS_BRANCH, '--quiet']); - await git(['checkout', '-', '--quiet']); + // Make base and source available as dedicated remotes + await Promise.all([ + () => fetch({name: 'base', url: `https://github.com/${REPO_SLUG}.git`}), + () => fetch({name: 'source', url: `https://github.com/${PR_SLUG}.git`}) + ]); + // Restore stashed changes if any await pop(); - await lint(['--from', TRAVIS_BRANCH, '--to', TRAVIS_COMMIT]); + // Lint all commits in TRAVIS_COMMIT_RANGE if available + if (RANGE) { + const [start, end] = RANGE.split('.').filter(Boolean); + await lint(['--from', start, '--to', end]); + } + + // Always lint the triggering commit indicated by TRAVIS_COMMIT + await lint(['--from', COMMIT]); } async function git(args, options) { return execa(GIT, args, Object.assign({}, {stdio: 'inherit'}, options)); } +async function fetch({name, url}) { + await git(['remote', 'add', name, url]); + await git(['fetch', name, '--quiet']); +} + async function isClean() { const result = await git(['status', '--porcelain'], { stdio: ['pipe', 'pipe', 'pipe'] @@ -63,7 +66,7 @@ async function isClean() { async function lint(args, options) { return execa( - COMMITLINT, + COMMITLINT || commitlint, args, Object.assign({}, {stdio: 'inherit'}, options) ); @@ -73,6 +76,23 @@ async function stash() { if (await isClean()) { return async () => {}; } - await git(['stash']); - return () => git(['stash', 'pop']); + await git(['stash', '-k', '-u', '--quiet']); + return () => git(['stash', 'pop', '--quiet']); +} + +function validate() { + if (process.env.CI !== 'true' || process.env.TRAVIS !== 'true') { + throw new Error( + `@commitlint/travis-cli is inteded to be used 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}.` + ); + } } diff --git a/@commitlint/travis-cli/src/cli.test.js b/@commitlint/travis-cli/src/cli.test.js index dcda393d24..fe01ae319a 100644 --- a/@commitlint/travis-cli/src/cli.test.js +++ b/@commitlint/travis-cli/src/cli.test.js @@ -32,14 +32,17 @@ test('should throw when not on travis ci', async t => { ); }); -test('should throw when on travis ci, but env vars are missing', async t => { - const env = { - TRAVIS: true, - CI: true - }; - - await t.throws(bin({env}), /TRAVIS_COMMIT, TRAVIS_BRANCH/); -}); +test.failing( + 'should throw when on travis ci, but env vars are missing', + async t => { + const env = { + TRAVIS: true, + CI: true + }; + + await t.throws(bin({env}), /TRAVIS_COMMIT, TRAVIS_BRANCH/); + } +); test('should throw when on travis ci, but TRAVIS_COMMIT is missing', async t => { const env = { @@ -50,16 +53,19 @@ test('should throw when on travis ci, but TRAVIS_COMMIT is missing', async t => await t.throws(bin({env}), /TRAVIS_COMMIT/); }); -test('should throw when on travis ci, but TRAVIS_BRANCH is missing', async t => { - const env = { - TRAVIS: true, - CI: true - }; +test.failing( + 'should throw when on travis ci, but TRAVIS_BRANCH is missing', + async t => { + const env = { + TRAVIS: true, + CI: true + }; - await t.throws(bin({env}), /TRAVIS_BRANCH/); -}); + await t.throws(bin({env}), /TRAVIS_BRANCH/); + } +); -test('should call git with expected args on shallow repo', async t => { +test.failing('should call git with expected args on shallow repo', async t => { if (os.platform() === 'win32') { t.pass(); return; @@ -133,62 +139,65 @@ test('should call git with expected args on shallow repo', async t => { ]); }); -test('should call git with expected args on unshallow repo', async t => { - if (os.platform() === 'win32') { - t.pass(); - return; +test.failing( + '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 + ]); } - - 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); diff --git a/@packages/babel-preset-commitlint/CHANGELOG.md b/@packages/babel-preset-commitlint/CHANGELOG.md index 4d2a1e3d49..8e9ce76c18 100644 --- a/@packages/babel-preset-commitlint/CHANGELOG.md +++ b/@packages/babel-preset-commitlint/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + +### Features + +* **babel-preset-commitlint:** add jsx tranform ([#163](https://github.com/marionebl/commitlint/issues/163)) ([5190241](https://github.com/marionebl/commitlint/commit/5190241)) + + + + ## [5.1.1](https://github.com/marionebl/commitlint/compare/v5.1.0...v5.1.1) (2017-11-24) diff --git a/@packages/babel-preset-commitlint/index.js b/@packages/babel-preset-commitlint/index.js index 07c5842b44..5bb61635b1 100644 --- a/@packages/babel-preset-commitlint/index.js +++ b/@packages/babel-preset-commitlint/index.js @@ -1,5 +1,6 @@ const addModuleExports = require('babel-plugin-add-module-exports'); const fastAsync = require('fast-async'); +const jsx = require('babel-plugin-transform-react-jsx'); const istanbul = require('babel-plugin-istanbul').default; const transformRuntime = require('babel-plugin-transform-runtime').default; const env = require('babel-preset-env').default; @@ -9,6 +10,7 @@ module.exports = preset; function preset() { const plugins = [ addModuleExports, + [jsx, {pragma: 'h'}], [fastAsync, {spec: true}], [transformRuntime, {polyfill: false, regenerator: false}] ]; @@ -21,11 +23,14 @@ function preset() { }, plugins, presets: [ - [env, { - debug: process.env.DEBUG === 'true', - exclude: ['transform-regenerator', 'transform-async-to-generator'], - targets: {node: '4.8'} - }] - ], + [ + env, + { + debug: process.env.DEBUG === 'true', + exclude: ['transform-regenerator', 'transform-async-to-generator'], + targets: {node: '4.8'} + } + ] + ] }; } diff --git a/@packages/babel-preset-commitlint/package.json b/@packages/babel-preset-commitlint/package.json index ac5bd83470..a567933153 100644 --- a/@packages/babel-preset-commitlint/package.json +++ b/@packages/babel-preset-commitlint/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-commitlint", - "version": "5.1.1", + "version": "5.2.0", "description": "Lint your commit messages", "main": "index.js", "scripts": { @@ -55,6 +55,7 @@ "dependencies": { "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-istanbul": "^4.1.4", + "babel-plugin-transform-react-jsx": "^6.24.1", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.6.0", "fast-async": "^6.3.0" diff --git a/@packages/example-prompt/CHANGELOG.md b/@packages/example-prompt/CHANGELOG.md index 957d259c75..940d5352d7 100644 --- a/@packages/example-prompt/CHANGELOG.md +++ b/@packages/example-prompt/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + + + +**Note:** Version bump only for package @commitlint/example-prompt + ## [5.1.2](https://github.com/marionebl/commitlint/compare/v5.1.1...v5.1.2) (2017-11-24) diff --git a/@packages/example-prompt/package.json b/@packages/example-prompt/package.json index c54e5cecd9..d36cc7d649 100644 --- a/@packages/example-prompt/package.json +++ b/@packages/example-prompt/package.json @@ -1,7 +1,7 @@ { "name": "@commitlint/example-prompt", "private": true, - "version": "5.1.2", + "version": "5.2.0", "description": "Example for prompt guide", "scripts": { "commit": "commit" @@ -17,6 +17,6 @@ }, "homepage": "https://github.com/marionebl/commitlint#readme", "devDependencies": { - "@commitlint/prompt-cli": "^5.1.2" + "@commitlint/prompt-cli": "^5.2.0" } } diff --git a/@packages/test/CHANGELOG.md b/@packages/test/CHANGELOG.md index 178696d98f..a626b9ed61 100644 --- a/@packages/test/CHANGELOG.md +++ b/@packages/test/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + + + +**Note:** Version bump only for package @commitlint/test + ## [5.1.1](https://github.com/marionebl/commitlint/compare/v5.1.0...v5.1.1) (2017-11-24) diff --git a/@packages/test/package.json b/@packages/test/package.json index 7e8dc4522f..905d026bc8 100644 --- a/@packages/test/package.json +++ b/@packages/test/package.json @@ -1,6 +1,6 @@ { "name": "@commitlint/test", - "version": "5.1.1", + "version": "5.2.0", "description": "test utilities for @commitlint", "main": "lib/", "private": true, @@ -63,7 +63,7 @@ "@commitlint/utils": "^5.1.1", "ava": "0.22.0", "babel-cli": "6.26.0", - "babel-preset-commitlint": "^5.1.1", + "babel-preset-commitlint": "^5.2.0", "babel-register": "6.26.0", "concurrently": "3.5.1", "cross-env": "5.1.1", diff --git a/CHANGELOG.md b/CHANGELOG.md index 2faa1d32c6..62eabb35d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [5.2.0](https://github.com/marionebl/commitlint/compare/v5.1.3...v5.2.0) (2017-11-30) + + +### Bug Fixes + +* consider pull requests from forks ([4653c2c](https://github.com/marionebl/commitlint/commit/4653c2c)) + + +### Features + +* **babel-preset-commitlint:** add jsx tranform ([#163](https://github.com/marionebl/commitlint/issues/163)) ([5190241](https://github.com/marionebl/commitlint/commit/5190241)) + + + + ## [5.1.3](https://github.com/marionebl/commitlint/compare/v5.1.2...v5.1.3) (2017-11-24) diff --git a/README.md b/README.md index 85f3b58473..a6febd5a01 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ A number of shared configurations are available to install and use with `commitl * [conventional-changelog](https://git.io/v18sw) – Generate a changelog from conventional commit history * [commitizen](https://git.io/vwTym) – Simple commit conventions for internet citizens +* [create-semantic-module](https://git.io/vFjFg) – CLI for quickly integrating commitizen and commitlint in new or existing projects ## License Copyright by @marionebl. All `commitlint` packages are released under the MIT license. diff --git a/lerna.json b/lerna.json index b8ba2752d2..c8da605263 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "lerna": "2.5.1", "npmClient": "yarn", "useWorkspaces": true, - "version": "5.1.3" + "version": "5.2.0" } diff --git a/package.json b/package.json index 3a8079b214..3ee8242390 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "eslint": "4.11.0", "eslint-config-prettier": "2.8.0", "husky": "0.14.3", - "lerna": "2.5.1", + "lerna": "^2.5.1", "lint-staged": "5.0.0", "npx": "9.7.1", "prettier": "1.8.2", diff --git a/yarn.lock b/yarn.lock index 85f8a61079..42baf4b4e6 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.1", "@marionebl/sander@^0.6.0": version "0.6.1" resolved "https://registry.npmjs.org/@marionebl/sander/-/sander-0.6.1.tgz#1958965874f24bc51be48875feb50d642fc41f7b" dependencies: @@ -340,7 +340,7 @@ async-each@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" -async@^1.0.0, async@^1.4.0, async@^1.5.0: +async@^1.4.0, async@^1.5.0: version "1.5.2" resolved "https://registry.npmjs.org/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -701,6 +701,14 @@ babel-helper-builder-binary-assignment-operator-visitor@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" +babel-helper-builder-react-jsx@^6.24.1: + version "6.26.0" + resolved "https://registry.npmjs.org/babel-helper-builder-react-jsx/-/babel-helper-builder-react-jsx-6.26.0.tgz#39ff8313b75c8b65dceff1f31d383e0ff2a408a0" + dependencies: + babel-runtime "^6.26.0" + babel-types "^6.26.0" + esutils "^2.0.2" + babel-helper-call-delegate@^6.24.1: version "6.24.1" resolved "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz#ece6aacddc76e41c3461f88bfc575bd0daa2df8d" @@ -845,6 +853,10 @@ babel-plugin-syntax-exponentiation-operator@^6.8.0: version "6.13.0" resolved "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de" +babel-plugin-syntax-jsx@^6.8.0: + version "6.18.0" + resolved "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" + babel-plugin-syntax-trailing-function-commas@^6.20.0, babel-plugin-syntax-trailing-function-commas@^6.22.0: version "6.22.0" resolved "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" @@ -1033,6 +1045,14 @@ babel-plugin-transform-exponentiation-operator@^6.22.0, babel-plugin-transform-e babel-plugin-syntax-exponentiation-operator "^6.8.0" babel-runtime "^6.22.0" +babel-plugin-transform-react-jsx@^6.24.1: + version "6.24.1" + resolved "https://registry.npmjs.org/babel-plugin-transform-react-jsx/-/babel-plugin-transform-react-jsx-6.24.1.tgz#840a028e7df460dfc3a2d29f0c0d91f6376e66a3" + dependencies: + babel-helper-builder-react-jsx "^6.24.1" + babel-plugin-syntax-jsx "^6.8.0" + babel-runtime "^6.22.0" + babel-plugin-transform-regenerator@^6.22.0: version "6.26.0" resolved "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f" @@ -2148,27 +2168,10 @@ delegates@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" -denodeify@1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz#3a36287f5034e699e7577901052c2e6c94251631" - depd@1.1.1, depd@~1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz#5783b4e1c459f06fa5ca27f991f3d06e7a310359" -dependency-check@2.7.0: - version "2.7.0" - resolved "https://registry.npmjs.org/dependency-check/-/dependency-check-2.7.0.tgz#7fd13368d90047b4c2d65923ff22a023ef4caf8d" - dependencies: - async "^1.0.0" - builtins "^1.0.0" - debug "^2.2.0" - detective "^4.0.0" - is-relative "^0.2.1" - minimist "^1.2.0" - read-package-json "^2.0.4" - resolve "^1.1.7" - dependency-check@2.9.1: version "2.9.1" resolved "https://registry.npmjs.org/dependency-check/-/dependency-check-2.9.1.tgz#228bdba768e3bf819a2a68c36f3f6a773c426ebf" @@ -4226,7 +4229,7 @@ lcid@^1.0.0: dependencies: invert-kv "^1.0.0" -lerna@2.5.1: +lerna@2.5.1, lerna@^2.5.1: version "2.5.1" resolved "https://registry.npmjs.org/lerna/-/lerna-2.5.1.tgz#d07099bd3051ee799f98c753328bd69e96c6fab8" dependencies: