Skip to content

Commit fa80b1b

Browse files
committed
style: factor out parse from @commitlint/core
1 parent c1a0eee commit fa80b1b

39 files changed

+121
-37
lines changed

@commitlint/core/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,26 @@
5555
},
5656
"license": "MIT",
5757
"devDependencies": {
58+
"@commitlint/parse": "^5.2.6",
5859
"@commitlint/test": "^5.2.6",
5960
"@commitlint/utils": "^5.1.1",
6061
"ava": "0.22.0",
6162
"babel-cli": "6.26.0",
6263
"babel-preset-commitlint": "^5.2.0",
6364
"babel-register": "6.26.0",
6465
"concurrently": "3.5.1",
66+
"conventional-changelog-angular": "^1.3.3",
6567
"cross-env": "5.1.1",
6668
"execa": "0.8.0",
6769
"globby": "6.1.0",
68-
"import-from": "2.1.0",
6970
"rimraf": "2.6.1",
7071
"xo": "0.18.2"
7172
},
7273
"dependencies": {
74+
"@commitlint/parse": "5.2.6",
7375
"@marionebl/sander": "^0.6.0",
7476
"babel-runtime": "^6.23.0",
7577
"chalk": "^2.0.1",
76-
"conventional-changelog-angular": "^1.3.3",
77-
"conventional-commits-parser": "^2.1.0",
7878
"cosmiconfig": "^3.0.1",
7979
"find-up": "^2.1.0",
8080
"git-raw-commits": "^1.3.0",

@commitlint/core/src/lint.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import parse from '@commitlint/parse';
12
import {entries} from 'lodash';
23
import isIgnored from './library/is-ignored';
3-
import parse from './library/parse';
44
import implementations from './rules';
55

66
export default async (message, rules = {}, opts = {}) => {

@commitlint/core/src/rules/body-case.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import bodyCase from './body-case';
44

55
const messages = {

@commitlint/core/src/rules/body-empty.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import bodyEmpty from './body-empty';
44

55
const messages = {

@commitlint/core/src/rules/body-leading-blank.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import bodyLeadingBlank from './body-leading-blank';
44

55
const messages = {

@commitlint/core/src/rules/body-max-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './body-max-length';
44

55
const short = 'a';

@commitlint/core/src/rules/body-min-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './body-min-length';
44

55
const short = 'a';

@commitlint/core/src/rules/body-tense.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import bodyTense from './body-tense';
44

55
test('returns deprecation warning', async t => {

@commitlint/core/src/rules/footer-empty.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import footerEmpty from './footer-empty';
44

55
const messages = {

@commitlint/core/src/rules/footer-leading-blank.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import footerLeadingBlank from './footer-leading-blank';
44

55
const messages = {

@commitlint/core/src/rules/footer-max-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './footer-max-length';
44

55
const short = 'BREAKING CHANGE: a';

@commitlint/core/src/rules/footer-min-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './footer-min-length';
44

55
const short = 'BREAKING CHANGE: a';

@commitlint/core/src/rules/footer-tense.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import footerTense from './footer-tense';
44

55
test('returns deprecation warning', async t => {

@commitlint/core/src/rules/header-max-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './header-max-length';
44

55
const short = 'test: a';

@commitlint/core/src/rules/header-min-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './header-min-length';
44

55
const short = 'BREAKING CHANGE: a';

@commitlint/core/src/rules/lang.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './lang';
44

55
test('returns a deprecation warning', async t => {

@commitlint/core/src/rules/references-empty.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
22
import preset from 'conventional-changelog-angular';
3-
import parse from '../library/parse';
3+
import parse from '@commitlint/parse';
44
import referencesEmpty from './references-empty';
55

66
const messages = {

@commitlint/core/src/rules/scope-case.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import scopeCase from './scope-case';
44

55
const messages = {

@commitlint/core/src/rules/scope-empty.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import scopeEmpty from './scope-empty';
44

55
const messages = {

@commitlint/core/src/rules/scope-enum.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import scopeEnum from './scope-enum';
44

55
const messages = {

@commitlint/core/src/rules/scope-max-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './scope-max-length';
44

55
const short = 'a';

@commitlint/core/src/rules/scope-min-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './scope-min-length';
44

55
const short = 'a';

@commitlint/core/src/rules/signed-off-by.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './signed-off-by';
44

55
const messages = {

@commitlint/core/src/rules/subject-case.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import subjectCase from './subject-case';
44

55
const messages = {

@commitlint/core/src/rules/subject-empty.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import subjectEmpty from './subject-empty';
44

55
const messages = {

@commitlint/core/src/rules/subject-full-stop.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './subject-full-stop';
44

55
const messages = {

@commitlint/core/src/rules/subject-max-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './subject-max-length';
44

55
const short = 'a';

@commitlint/core/src/rules/subject-min-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './subject-min-length';
44

55
const short = 'a';

@commitlint/core/src/rules/subject-tense.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import subjectTense from './subject-tense';
44

55
test('returns deprecation warning', async t => {

@commitlint/core/src/rules/type-case.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import typeCase from './type-case';
44

55
const messages = {

@commitlint/core/src/rules/type-empty.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import typeEmpty from './type-empty';
44

55
const messages = {

@commitlint/core/src/rules/type-enum.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './type-enum';
44

55
const messages = {

@commitlint/core/src/rules/type-max-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './type-max-length';
44

55
const short = 'a';

@commitlint/core/src/rules/type-min-length.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import parse from '../library/parse';
2+
import parse from '@commitlint/parse';
33
import check from './type-min-length';
44

55
const short = 'a';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
parserOpts: {
3+
parserPreset: './conventional-changelog-custom'
4+
}
5+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = Promise.resolve().then(() => ({
2+
parserOpts: {
3+
headerPattern: /^(\w*)(?:\((.*)\))?-(.*)$/
4+
}
5+
}));

@commitlint/parse/package.json

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"name": "@commitlint/parse",
3+
"version": "5.2.6",
4+
"description": "Lint your commit messages",
5+
"main": "lib/index.js",
6+
"scripts": {
7+
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
8+
"clean": "npx rimraf lib",
9+
"deps": "dep-check",
10+
"lint": "xo",
11+
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
12+
"test": "ava -c 4 --verbose",
13+
"watch": "babel src --out-dir lib --watch --source-maps"
14+
},
15+
"ava": {
16+
"files": [
17+
"src/**/*.test.js",
18+
"!lib/**/*"
19+
],
20+
"source": [
21+
"src/**/*.js",
22+
"!lib/**/*"
23+
],
24+
"babel": "inherit",
25+
"require": [
26+
"babel-register"
27+
]
28+
},
29+
"babel": {
30+
"presets": [
31+
"babel-preset-commitlint"
32+
]
33+
},
34+
"xo": false,
35+
"engines": {
36+
"node": ">=4"
37+
},
38+
"repository": {
39+
"type": "git",
40+
"url": "https://github.com/marionebl/commitlint.git"
41+
},
42+
"bugs": {
43+
"url": "https://github.com/marionebl/commitlint/issues"
44+
},
45+
"homepage": "https://github.com/marionebl/commitlint#readme",
46+
"keywords": [
47+
"conventional-changelog",
48+
"commitlint",
49+
"library",
50+
"core"
51+
],
52+
"author": {
53+
"name": "Mario Nebl",
54+
"email": "[email protected]"
55+
},
56+
"license": "MIT",
57+
"devDependencies": {
58+
"@commitlint/test": "^5.2.6",
59+
"@commitlint/utils": "^5.1.1",
60+
"ava": "0.22.0",
61+
"babel-cli": "6.26.0",
62+
"babel-preset-commitlint": "^5.2.0",
63+
"babel-register": "6.26.0",
64+
"concurrently": "3.5.1",
65+
"cross-env": "5.1.1",
66+
"import-from": "2.1.0",
67+
"rimraf": "2.6.1",
68+
"xo": "0.18.2"
69+
},
70+
"dependencies": {
71+
"conventional-changelog-angular": "^1.3.3",
72+
"conventional-commits-parser": "^2.1.0"
73+
}
74+
}
File renamed without changes.

@commitlint/core/src/library/parse.test.js @commitlint/parse/src/index.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import importFrom from 'import-from';
22
import test from 'ava';
3-
import parse from './parse';
3+
import parse from '.';
44

55
test('throws when called without params', async t => {
66
const error = await t.throws(parse());

0 commit comments

Comments
 (0)