Skip to content

Commit a2798d3

Browse files
committed
chore: unify dep-checks and linting
1 parent b7396f5 commit a2798d3

File tree

14 files changed

+143
-67
lines changed

14 files changed

+143
-67
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules
44
.npm
55
.nyc_output
66
@commitlint/**/lib
7+
@commitlint/**/package.json.lerna_backup

@commitlint/cli/package.json

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"scripts": {
99
"build": "exit 0",
1010
"clean": "exit 0",
11+
"pretest": "dep-check",
1112
"test": "ava",
1213
"prepublish": "npm test"
1314
},
@@ -16,6 +17,7 @@
1617
"cli.test.js"
1718
]
1819
},
20+
"xo": false,
1921
"engines": {
2022
"node": ">=4"
2123
},
@@ -38,43 +40,19 @@
3840
},
3941
"license": "MIT",
4042
"devDependencies": {
41-
"ansi-styles": "3.1.0",
43+
"@commitlint/utils": "^3.0.0",
4244
"ava": "^0.18.2",
43-
"babel-cli": "6.18.0",
44-
"babel-plugin-add-module-exports": "0.2.1",
45-
"babel-plugin-istanbul": "4.1.3",
46-
"babel-plugin-transform-runtime": "6.23.0",
47-
"babel-polyfill": "6.20.0",
48-
"babel-preset-env": "1.2.1",
49-
"babel-preset-stage-0": "6.16.0",
50-
"babel-register": "6.24.1",
51-
"cross-env": "5.0.1",
45+
"dependency-check": "^2.9.1",
5246
"execa": "^0.7.0",
53-
"globby": "6.1.0",
54-
"has-ansi": "3.0.0",
55-
"nyc": "10.3.2",
56-
"path-exists": "3.0.0",
57-
"resolve-from": "3.0.0",
58-
"rimraf": "2.6.1",
59-
"xo": "0.18.2"
47+
"string-to-stream": "^1.1.0",
48+
"xo": "^0.18.2"
6049
},
6150
"dependencies": {
6251
"@commitlint/core": "^3.0.0",
63-
"babel-polyfill": "6.20.0",
64-
"babel-runtime": "6.23.0",
65-
"chalk": "1.1.3",
66-
"conventional-changelog-angular": "1.3.0",
67-
"conventional-commits-parser": "1.3.0",
68-
"franc": "2.0.0",
69-
"get-stdin": "5.0.1",
70-
"git-raw-commits": "1.1.2",
71-
"git-toplevel": "1.1.1",
72-
"import-from": "2.1.0",
73-
"lodash": "4.17.4",
74-
"meow": "3.7.0",
75-
"mz": "2.6.0",
76-
"pos": "0.4.2",
77-
"rc": "1.1.7",
78-
"semver": "^5.3.0"
52+
"babel-polyfill": "^6.23.0",
53+
"chalk": "^2.0.1",
54+
"get-stdin": "^5.0.1",
55+
"lodash": "^4.17.4",
56+
"meow": "^3.7.0"
7957
}
8058
}

@commitlint/config-angular/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"version": "3.0.0",
44
"description": "Shareable commitlint config enforcing the angular commit convention",
55
"scripts": {
6+
"pretest": "dep-check",
67
"test": "exit 0",
78
"clean": "exit 0"
89
},
10+
"xo": false,
911
"repository": {
1012
"type": "git",
1113
"url": "git+https://github.com/marionebl/commitlint.git"
@@ -21,5 +23,8 @@
2123
"bugs": {
2224
"url": "https://github.com/marionebl/commitlint/issues"
2325
},
24-
"homepage": "https://github.com/marionebl/commitlint#readme"
26+
"homepage": "https://github.com/marionebl/commitlint#readme",
27+
"devDependencies": {
28+
"@commitlint/utils": "^3.0.0"
29+
}
2530
}

@commitlint/config-lerna-scopes/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ const globby = require('globby');
33
const jsonfile = require('load-json-file');
44

55
module.exports = {
6-
utils: {
7-
getPackages: getPackages
8-
},
6+
utils: {getPackages},
97
rules: {
108
'scope-enum': () => getPackages()
119
.then(names => [2, 'always', names])

@commitlint/config-lerna-scopes/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"version": "3.0.0",
44
"description": "Shareable commitlint config enforcing lerna package names as scopes",
55
"scripts": {
6+
"pretest": "dep-check",
67
"test": "exit 0",
78
"clean": "exit 0"
89
},
10+
"xo": false,
911
"repository": {
1012
"type": "git",
1113
"url": "git+https://github.com/marionebl/commitlint.git"
@@ -25,5 +27,8 @@
2527
"dependencies": {
2628
"globby": "6.1.0",
2729
"load-json-file": "2.0.0"
30+
},
31+
"devDependencies": {
32+
"@commitlint/utils": "^3.0.0"
2833
}
2934
}

@commitlint/config-patternplate/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function getPatternIDs() {
1515
}
1616

1717
module.exports = merge(
18-
require('conventional-changelog-lint-config-angular'),
18+
require('@commitlint/config-angular'),
1919
{
2020
rules: {
2121
'scope-enum': () => getPatternIDs()

@commitlint/config-patternplate/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"version": "3.0.0",
44
"description": "Shareable conventional-changelog-lint config enforcing the patternplate commit message convention",
55
"scripts": {
6+
"pretest": "dep-check",
67
"test": "exit 0",
78
"clean": "exit 0"
89
},
10+
"xo": false,
911
"repository": {
1012
"type": "git",
1113
"url": "git+https://github.com/marionebl/commitlint.git"
@@ -26,5 +28,8 @@
2628
"@commitlint/config-angular": "^3.0.0",
2729
"globby": "^4.0.0",
2830
"lodash": "^4.5.1"
31+
},
32+
"devDependencies": {
33+
"@commitlint/utils": "^3.0.0"
2934
}
3035
}

@commitlint/core/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Lint your commit messages",
55
"main": "lib/index.js",
66
"scripts": {
7+
"pretest": "dep-check",
78
"test": "ava -c 4",
89
"build": "cross-env NODE_ENV=production babel src --out-dir lib",
910
"clean": "rimraf lib",
@@ -68,6 +69,7 @@
6869
]
6970
]
7071
},
72+
"xo": false,
7173
"nyc": {
7274
"all": true,
7375
"sourceMap": false,
@@ -99,13 +101,14 @@
99101
},
100102
"license": "MIT",
101103
"devDependencies": {
104+
"@commitlint/utils": "^3.0.0",
102105
"ansi-styles": "3.1.0",
103106
"ava": "0.18.2",
104107
"babel-cli": "^6.18.0",
105108
"babel-plugin-add-module-exports": "0.2.1",
106109
"babel-plugin-istanbul": "4.1.3",
107110
"babel-plugin-transform-runtime": "6.23.0",
108-
"babel-polyfill": "6.20.0",
111+
"babel-polyfill": "^6.20.0",
109112
"babel-preset-env": "^1.2.1",
110113
"babel-preset-stage-0": "^6.16.0",
111114
"babel-register": "6.24.1",
@@ -127,18 +130,15 @@
127130
"xo": "0.18.2"
128131
},
129132
"dependencies": {
130-
"babel-polyfill": "6.20.0",
131133
"babel-runtime": "6.23.0",
132134
"chalk": "1.1.3",
133-
"conventional-changelog-angular": "1.3.0",
134135
"conventional-commits-parser": "1.3.0",
135136
"franc": "2.0.0",
136-
"get-stdin": "5.0.1",
137137
"git-raw-commits": "1.1.2",
138138
"git-toplevel": "1.1.1",
139139
"lodash": "4.17.4",
140-
"meow": "3.7.0",
141140
"mz": "2.6.0",
141+
"path-exists": "^3.0.0",
142142
"pos": "0.4.2",
143143
"rc": "1.1.7",
144144
"resolve-from": "^3.0.0",

@commitlint/prompt/package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
"name": "@commitlint/prompt",
33
"version": "3.0.0",
44
"description": "commit prompt using .commitlintrc",
5-
"main": "index.js",
5+
"bin": {
6+
"commit-prompt": "./lib/index.js"
7+
},
68
"scripts": {
79
"build": "cross-env NODE_ENV=production babel src --out-dir lib",
810
"clean": "rimraf lib",
11+
"pretest": "dep-check",
912
"test": "exit 0",
1013
"prepublish": "npm run build"
1114
},
@@ -53,6 +56,7 @@
5356
]
5457
]
5558
},
59+
"xo": false,
5660
"repository": {
5761
"type": "git",
5862
"url": "git+https://github.com/marionebl/commitlint.git"
@@ -71,6 +75,7 @@
7175
},
7276
"homepage": "https://github.com/marionebl/commitlint#readme",
7377
"devDependencies": {
78+
"@commitlint/utils": "^3.0.0",
7479
"babel-cli": "^6.24.1",
7580
"babel-plugin-add-module-exports": "^0.2.1",
7681
"babel-plugin-transform-runtime": "^6.23.0",
@@ -79,10 +84,10 @@
7984
"cross-env": "5.0.1"
8085
},
8186
"dependencies": {
82-
"@commitlint/cli": "^3.0.0",
87+
"@commitlint/core": "^3.0.0",
8388
"babel-polyfill": "^6.23.0",
89+
"babel-runtime": "^6.23.0",
8490
"chalk": "1.1.1",
85-
"inquirer": "0.12.0",
8691
"lodash": "4.5.1",
8792
"vorpal": "1.10.0"
8893
}

@commitlint/prompt/src/get-input.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import chalk from 'chalk';
2-
import {getPreset, getConfiguration} from '@commitlint/core';
3-
import {merge} from 'lodash';
2+
import {load} from '@commitlint/core';
43
import vorpal from 'vorpal';
54

65
/**
@@ -147,7 +146,6 @@ function getForcedCaseFn(rule) {
147146
return noop;
148147
}
149148

150-
// const case = getForcedCase(rule);
151149
const forcedCase = getForcedCase(rule);
152150

153151
if (forcedCase === null) {
@@ -215,7 +213,7 @@ function getForcedLeadingFn(rule) {
215213
}
216214

217215
/**
218-
* get a cli prompt based on rule configuration
216+
* Get a cli prompt based on rule configuration
219217
* @param {string} type type of the data to gather
220218
* @param {array} rules rules to parse
221219
* @param {object} settings = {} additional display settings
@@ -393,11 +391,11 @@ function getPrompt(type, rules, settings = {}, results = {}) {
393391
prompt.addListener('client_prompt_submit', onSubmit);
394392

395393
prompt.log(`\n\nPlease enter a ${chalk.bold(type)}: ${meta({
396-
'optional': !mayNotBeEmpty,
397-
'required': mayNotBeEmpty,
394+
optional: !mayNotBeEmpty,
395+
required: mayNotBeEmpty,
398396
'tab-completion': typeof enumRule !== 'undefined',
399-
'header': typeof settings.header !== 'undefined',
400-
'case': forcedCase,
397+
header: typeof settings.header !== 'undefined',
398+
case: forcedCase,
401399
'multi-line': settings.multiline
402400
})}`);
403401

@@ -468,7 +466,6 @@ const settings = {
468466
* @return {string} formatted debug message
469467
*/
470468
function format(input, debug = false) {
471-
// show debug format data if debug = true
472469
const results = debug ?
473470
Object.entries(input)
474471
.reduce((registry, item) => {
@@ -506,10 +503,7 @@ export default async () => {
506503
footer: null
507504
};
508505

509-
// Get the current conventional-changelog-lint configuration
510-
const configuration = await getConfiguration('conventional-changelog-lint');
511-
const preset = await getPreset(configuration.preset || 'angular');
512-
const {rules} = merge({}, configuration, preset);
506+
const {rules} = await load();
513507

514508
for (const input of ['type', 'scope', 'subject', 'body', 'footer']) {
515509
const inputRules = getRules(input, rules);
@@ -529,7 +523,7 @@ export default async () => {
529523
}
530524
}
531525

532-
results[input] = await getPrompt(input, inputRules, inputSettings, results);
526+
results[input] = await getPrompt(input, inputRules, inputSettings, results); // eslint-disable-line no-await-in-loop
533527
}
534528

535529
// Return the results

0 commit comments

Comments
 (0)