Skip to content

Commit

Permalink
feat(prompt-cli): add standalone prompt interface
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Jul 11, 2017
1 parent 061936a commit 7911040
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
29 changes: 29 additions & 0 deletions @commitlint/prompt-cli/cli.js
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);
}
36 changes: 36 additions & 0 deletions @commitlint/prompt-cli/package.json
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"
}
}
15 changes: 15 additions & 0 deletions @commitlint/prompt-cli/readme.md
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
```

0 comments on commit 7911040

Please sign in to comment.