@4s1/conventional-commit-creator 0.7.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +8 -2
- package/dist/index.js +34 -5
- package/package.json +22 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.10.1](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.10.0...v0.10.1) (2021-12-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add check if current dir is a git repository ([#4](https://gitlab.com/4s1/conventional-commit-creator/issues/4)) ([75d34be](https://gitlab.com/4s1/conventional-commit-creator/commit/75d34be610e1ef6500d970f8c32464da0bf2d6a3))
|
|
11
|
+
* add missing await statement and rename function ([04892a0](https://gitlab.com/4s1/conventional-commit-creator/commit/04892a0e1a9566c0b53895036792001a8e42b00f))
|
|
12
|
+
|
|
13
|
+
## [0.10.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.9.0...v0.10.0) (2021-12-15)
|
|
14
|
+
|
|
15
|
+
## [0.9.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.8.0...v0.9.0) (2021-12-10)
|
|
16
|
+
|
|
17
|
+
## [0.8.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.7.0...v0.8.0) (2021-11-18)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add hack for redmine at work ([538273e](https://gitlab.com/4s1/conventional-commit-creator/commit/538273e997c074bb28c877571b68e82a9d3fff52))
|
|
23
|
+
|
|
5
24
|
## [0.7.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.6.0...v0.7.0) (2021-11-18)
|
|
6
25
|
|
|
7
26
|
|
package/README.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
# Conventional Commit Creator
|
|
2
2
|
|
|
3
|
+
This CLI application assists in creating commit messages that are conform to the conventional commit style.
|
|
4
|
+
It will ask for type, scope (optional), description and issue (optional).
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
3
8
|
## Install
|
|
4
9
|
|
|
5
10
|
```bash
|
|
6
|
-
|
|
11
|
+
# Install globally
|
|
12
|
+
npm install -g @4s1/conventional-commit-creator
|
|
7
13
|
```
|
|
8
14
|
|
|
9
|
-
##
|
|
15
|
+
## Usage
|
|
10
16
|
|
|
11
17
|
```bash
|
|
12
18
|
conventional-commit-creator
|
package/dist/index.js
CHANGED
|
@@ -64,28 +64,38 @@ const questions = [
|
|
|
64
64
|
},
|
|
65
65
|
];
|
|
66
66
|
async function main() {
|
|
67
|
+
if (!(await isCurrentDirUnderGitControl())) {
|
|
68
|
+
console.error('Current directory is not a git repository.');
|
|
69
|
+
process.exit(0);
|
|
70
|
+
}
|
|
67
71
|
if (!(await haveStagedChanges())) {
|
|
68
72
|
console.error('Nothing to commit');
|
|
69
73
|
process.exit(0);
|
|
70
74
|
}
|
|
71
|
-
const data = await (0, prompts_1.default)(questions, {
|
|
75
|
+
const data = (await (0, prompts_1.default)(questions, {
|
|
72
76
|
onCancel: () => {
|
|
73
77
|
console.error('Aborted');
|
|
74
78
|
process.exit(1);
|
|
75
79
|
},
|
|
76
|
-
});
|
|
77
|
-
const msg = createMsg(data);
|
|
80
|
+
}));
|
|
81
|
+
const msg = await createMsg(data);
|
|
78
82
|
await commit(msg);
|
|
79
83
|
console.info('done');
|
|
80
84
|
}
|
|
81
|
-
function createMsg(data) {
|
|
85
|
+
async function createMsg(data) {
|
|
82
86
|
let msg = `${data.type.trim()}`;
|
|
83
87
|
if (data.scope) {
|
|
84
88
|
msg += `(${data.scope.trim()})`;
|
|
85
89
|
}
|
|
86
90
|
msg += `: ${data.description.trim()}`;
|
|
87
91
|
if (data.issue) {
|
|
88
|
-
|
|
92
|
+
// Hack to support Redmine ticket linking at work.
|
|
93
|
+
if (!(await isWork())) {
|
|
94
|
+
msg += ` (#${data.issue})`;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
msg += ` [refs #${data.issue}]`;
|
|
98
|
+
}
|
|
89
99
|
}
|
|
90
100
|
return msg;
|
|
91
101
|
}
|
|
@@ -99,6 +109,15 @@ async function commit(msg) {
|
|
|
99
109
|
process.exit(1);
|
|
100
110
|
}
|
|
101
111
|
}
|
|
112
|
+
async function isCurrentDirUnderGitControl() {
|
|
113
|
+
try {
|
|
114
|
+
const result = await execute('git rev-parse --is-inside-work-tree');
|
|
115
|
+
return result === 'true';
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
102
121
|
async function haveStagedChanges() {
|
|
103
122
|
try {
|
|
104
123
|
const staged = await execute('git diff --cached');
|
|
@@ -109,6 +128,16 @@ async function haveStagedChanges() {
|
|
|
109
128
|
process.exit(1);
|
|
110
129
|
}
|
|
111
130
|
}
|
|
131
|
+
async function isWork() {
|
|
132
|
+
try {
|
|
133
|
+
const output = await execute('git remote -v');
|
|
134
|
+
return output.includes('intra.bender:');
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
console.error(err);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
112
141
|
async function execute(cmd) {
|
|
113
142
|
return new Promise((resolve, reject) => {
|
|
114
143
|
(0, child_process_1.exec)(cmd, (err, stdout) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@4s1/conventional-commit-creator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Conventional Commit Creator",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"conventional commit",
|
|
7
|
+
"4s1"
|
|
8
|
+
],
|
|
5
9
|
"bugs": {
|
|
6
10
|
"url": "https://gitlab.com/4s1/conventional-commit-creator/issues"
|
|
7
11
|
},
|
|
@@ -36,22 +40,32 @@
|
|
|
36
40
|
"release:patch": "pnpm run release -- --release-as patch",
|
|
37
41
|
"start": "node dist/index.js",
|
|
38
42
|
"start:dev": "ts-node src/index.ts",
|
|
39
|
-
"test": "
|
|
43
|
+
"test": "jest",
|
|
44
|
+
"test:cov": "pnpm run test -- --coverage",
|
|
45
|
+
"test:watch": "pnpm run test -- --watch"
|
|
40
46
|
},
|
|
41
47
|
"prettier": "@4s1/eslint-config",
|
|
42
48
|
"dependencies": {
|
|
43
49
|
"prompts": "^2.4.2"
|
|
44
50
|
},
|
|
45
51
|
"devDependencies": {
|
|
46
|
-
"@4s1/eslint-config": "3.
|
|
47
|
-
"@4s1/ts-config": "1.
|
|
48
|
-
"@
|
|
52
|
+
"@4s1/eslint-config": "3.4.0",
|
|
53
|
+
"@4s1/ts-config": "1.4.0",
|
|
54
|
+
"@commitlint/cli": "15.0.0",
|
|
55
|
+
"@commitlint/config-conventional": "15.0.0",
|
|
56
|
+
"@types/jest": "27.0.3",
|
|
57
|
+
"@types/node": "14.18.1",
|
|
49
58
|
"@types/prompts": "2.4.0",
|
|
50
|
-
"eslint": "8.
|
|
59
|
+
"eslint": "8.5.0",
|
|
51
60
|
"husky": "7.0.4",
|
|
52
|
-
"
|
|
61
|
+
"jest": "27.4.5",
|
|
62
|
+
"prettier": "2.5.1",
|
|
53
63
|
"standard-version": "9.3.2",
|
|
64
|
+
"ts-jest": "27.1.2",
|
|
54
65
|
"ts-node": "10.4.0",
|
|
55
|
-
"typescript": "4.
|
|
66
|
+
"typescript": "4.5.4"
|
|
67
|
+
},
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public"
|
|
56
70
|
}
|
|
57
71
|
}
|