-
Notifications
You must be signed in to change notification settings - Fork 883
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prompt-cli): add standalone prompt interface
- Loading branch information
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env node | ||
const execa = require('execa'); | ||
const meow = require('meow'); | ||
const prompter = require('@commitlint/prompt').prompter; | ||
|
||
const HELP = ` | ||
Usage | ||
$ commit | ||
`; | ||
|
||
const _ = undefined; | ||
const prompt = () => prompter(_, commit); | ||
|
||
main(meow(HELP)) | ||
.catch(err => { | ||
setTimeout(() => { | ||
throw err; | ||
}); | ||
}); | ||
|
||
function main() { | ||
return prompt(); | ||
} | ||
|
||
function commit(message) { | ||
const c = execa('git', ['commit', '-m', message]); | ||
c.stdout.pipe(process.stdout); | ||
c.stderr.pipe(process.stderr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@commitlint/prompt", | ||
"version": "3.0.0", | ||
"description": "commit prompt using .commitlintrc", | ||
"bin": { | ||
"commit": "./cli.js" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf lib", | ||
"commit": "$npm_package_bin_commit", | ||
"pretest": "dep-check" | ||
}, | ||
"xo": false, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/marionebl/commitlint.git" | ||
}, | ||
"keywords": [ | ||
"commitlint", | ||
"prompt" | ||
], | ||
"author": "Mario Nebl <hello@herebecode.com>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/marionebl/commitlint/issues" | ||
}, | ||
"homepage": "https://github.com/marionebl/commitlint#readme", | ||
"devDependencies": { | ||
"@commitlint/utils": "^3.0.0" | ||
}, | ||
"dependencies": { | ||
"@commitlint/prompt": "^3.0.0", | ||
"execa": "^0.7.0", | ||
"meow": "^3.7.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
> commit prompt using .commitlintrc | ||
# @commitlint/prompt-cli | ||
|
||
## Getting started | ||
|
||
```bash | ||
npm install --g @commitlint/prompt-cli @commitlint/config-angular | ||
echo '{"extends": ["@commitlint/config-angular"]}' > .commitlintrc | ||
``` | ||
|
||
```bash | ||
git add . | ||
commit | ||
``` |