Skip to content

Commit 4e8da01

Browse files
committed
feat(adapter): Create initial commit.
0 parents  commit 4e8da01

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

.cz.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"path": "./"
3+
}

index.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// This can be any kind of SystemJS compatible module.
2+
// We use Commonjs here, but ES6 or AMD would do just
3+
// fine.
4+
module.exports = {
5+
6+
// When a user runs `git cz`, prompter will
7+
// be executed. We pass you cz, which currently
8+
// is just an instance of inquirer.js. Using
9+
// this you can ask questions and get answers.
10+
//
11+
// The commit callback should be executed when
12+
// you're ready to send back a commit template
13+
// to git.
14+
//
15+
// By default, we'll de-indent your commit
16+
// template and will keep empty lines.
17+
prompter: function(cz, commit) {
18+
19+
console.log('\nAll commit message lines will be cropped at 100 characters.\n');
20+
21+
// Let's ask some questions of the user
22+
// so that we can populate our commit
23+
// template.
24+
//
25+
// See inquirer.js docs for specifics.
26+
// You can also opt to use another input
27+
// collection library if you prefer.
28+
cz.prompt([
29+
{
30+
type: 'list',
31+
name: 'type',
32+
message: 'Select the type of change that you\'re committing:',
33+
choices: [
34+
{
35+
name: 'feat: A new feature',
36+
value: 'feat'
37+
}, {
38+
name: 'fix: A bug fix',
39+
value: 'fix'
40+
}, {
41+
name: 'docs: Documentation only changes',
42+
value: 'docs'
43+
}, {
44+
name: 'style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)',
45+
value: 'style'
46+
}, {
47+
name: 'refactor: A code change that neither fixes a bug or adds a feature',
48+
value: 'refactor'
49+
}, {
50+
name: 'perf: A code change that improves performance',
51+
value: 'perf'
52+
}, {
53+
name: 'test: Adding missing tests',
54+
value: 'test'
55+
}, {
56+
name: 'chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation',
57+
value: 'chore'
58+
}]
59+
}, {
60+
type: 'input',
61+
name: 'scope',
62+
message: 'Denote the scope of this change ($location, $browser, $compile, etc.):\n'
63+
}, {
64+
type: 'input',
65+
name: 'subject',
66+
message: 'Write a short, imperative tense description of the change:\n'
67+
}, {
68+
type: 'input',
69+
name: 'body',
70+
message: 'Provide a longer description of the change:\n'
71+
}, {
72+
type: 'input',
73+
name: 'footer',
74+
message: 'List any breaking changes or issues closed by this change:\n'
75+
}
76+
], function(answers) {
77+
78+
// Plug the answers into our template
79+
// By default, we dedent this for you
80+
commit(`${answers.type}(${answers.scope}): ${answers.subject}`.slice(0, 100) + `
81+
82+
` + answers.body.slice(0, 100) + `
83+
84+
` + answers.footer.slice(0, 100));
85+
});
86+
}
87+
}

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "cz-conventional-changelog",
3+
"version": "1.0.0",
4+
"description": "Commitizen adapter following the conventional-changelog format.",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "Jim Cummins <[email protected]>",
10+
"license": "MIT",
11+
"dependencies": {
12+
}
13+
}

0 commit comments

Comments
 (0)