Skip to content

Commit 620913b

Browse files
committed
refactor: split @commitlint/core into sub packages
1 parent d063f65 commit 620913b

File tree

109 files changed

+657
-780
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+657
-780
lines changed

@commitlint/cli/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@
7575
"xo": "0.18.2"
7676
},
7777
"dependencies": {
78-
"@commitlint/core": "^6.1.0",
78+
"@commitlint/format": "^6.1.0",
79+
"@commitlint/lint": "^6.1.0",
80+
"@commitlint/load": "^6.1.0",
81+
"@commitlint/read": "^6.1.0",
7982
"babel-polyfill": "6.26.0",
8083
"chalk": "2.3.0",
8184
"get-stdin": "5.0.1",

@commitlint/cli/src/cli.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/usr/bin/env node
22
require('babel-polyfill'); // eslint-disable-line import/no-unassigned-import
33

4-
const core = require('@commitlint/core');
4+
const format = require('@commitlint/format');
5+
const load = require('@commitlint/load');
6+
const lint = require('@commitlint/lint');
7+
const read = require('@commitlint/read');
58
const chalk = require('chalk');
69
const meow = require('meow');
710
const merge = require('lodash.merge');
@@ -81,9 +84,7 @@ async function main(options) {
8184
const range = pick(flags, 'edit', 'from', 'to');
8285
const fmt = new chalk.constructor({enabled: flags.color});
8386

84-
const input = await (fromStdin
85-
? stdin()
86-
: core.read(range, {cwd: flags.cwd}));
87+
const input = await (fromStdin ? stdin() : read(range, {cwd: flags.cwd}));
8788

8889
const messages = (Array.isArray(input) ? input : [input])
8990
.filter(message => typeof message === 'string')
@@ -100,7 +101,7 @@ async function main(options) {
100101
}
101102

102103
const loadOpts = {cwd: flags.cwd, file: flags.config};
103-
const loaded = await core.load(getSeed(flags), loadOpts);
104+
const loaded = await load(getSeed(flags), loadOpts);
104105
const parserOpts = selectParserOpts(loaded.parserPreset);
105106
const opts = parserOpts ? {parserOpts} : {parserOpts: {}};
106107

@@ -111,8 +112,8 @@ async function main(options) {
111112

112113
return Promise.all(
113114
messages.map(async message => {
114-
const report = await core.lint(message, loaded.rules, opts);
115-
const formatted = core.format(report, {color: flags.color});
115+
const report = await lint(message, loaded.rules, opts);
116+
const formatted = format(report, {color: flags.color});
116117

117118
if (!flags.quiet) {
118119
console.log(

0 commit comments

Comments
 (0)