Skip to content

Commit d2d7646

Browse files
committed
refactor(prompt): reorganize sources
1 parent c80766b commit d2d7646

19 files changed

+766
-548
lines changed

@commitlint/prompt/package.json

+30-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
11
{
22
"name": "@commitlint/prompt",
33
"version": "3.0.0",
4-
"description": "commit prompt using .commitlintrc",
5-
"bin": {
6-
"commit-prompt": "./lib/index.js"
7-
},
4+
"description": "commitizen prompt using .commitlintrc",
5+
"main": "./lib/index.js",
86
"scripts": {
97
"build": "cross-env NODE_ENV=production babel src --out-dir lib",
108
"clean": "rimraf lib",
9+
"commit": "git-cz",
1110
"pretest": "dep-check",
12-
"test": "exit 0",
11+
"test": "ava",
1312
"prepublish": "npm run build"
1413
},
14+
"ava": {
15+
"babel": "inherit",
16+
"require": [
17+
"babel-register"
18+
],
19+
"files": [
20+
"src/**/*.test.js"
21+
],
22+
"sources": [
23+
"src/**/*.js"
24+
]
25+
},
1526
"babel": {
1627
"env": {
1728
"development": {
1829
"sourceMaps": "inline",
1930
"plugins": [
2031
"add-module-exports",
21-
"istanbul",
2232
[
2333
"transform-runtime",
2434
{
@@ -56,6 +66,11 @@
5666
]
5767
]
5868
},
69+
"config": {
70+
"commitizen": {
71+
"path": "./@commitlint/prompt"
72+
}
73+
},
5974
"xo": false,
6075
"repository": {
6176
"type": "git",
@@ -76,19 +91,26 @@
7691
"homepage": "https://github.com/marionebl/commitlint#readme",
7792
"devDependencies": {
7893
"@commitlint/utils": "^3.0.0",
94+
"ava": "^0.20.0",
7995
"babel-cli": "^6.24.1",
8096
"babel-plugin-add-module-exports": "^0.2.1",
8197
"babel-plugin-transform-runtime": "^6.23.0",
8298
"babel-preset-env": "1.6.0",
8399
"babel-preset-stage-0": "^6.24.1",
84-
"cross-env": "5.0.1"
100+
"babel-register": "^6.24.1",
101+
"commitizen": "^2.9.6",
102+
"cross-env": "5.0.1",
103+
"throat": "^4.1.0"
85104
},
86105
"dependencies": {
87106
"@commitlint/core": "^3.0.0",
88107
"babel-polyfill": "^6.23.0",
89108
"babel-runtime": "^6.23.0",
90109
"chalk": "1.1.1",
91-
"lodash": "4.5.1",
110+
"execa": "^0.7.0",
111+
"lodash": "^4.17.4",
112+
"meow": "^3.7.0",
113+
"throat": "^4.1.0",
92114
"vorpal": "1.10.0"
93115
}
94116
}

@commitlint/prompt/src/cli.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import execa from 'execa';
2+
import meow from 'meow';
3+
import vorpal from 'vorpal';
4+
import input from './input';
5+
6+
const HELP = `
7+
Usage
8+
$ commit
9+
`;
10+
11+
async function main() {
12+
const message = await input(vorpal);
13+
const commit = execa('git', ['commit', '-m', message]);
14+
15+
commit.stdout.pipe(process.stdout);
16+
commit.stderr.pipe(process.stderr);
17+
18+
return commit;
19+
}
20+
21+
main(meow(HELP))
22+
.catch(err => {
23+
setTimeout(() => {
24+
throw err;
25+
});
26+
});

0 commit comments

Comments
 (0)