@4s1/conventional-commit-creator 0.8.0 → 0.10.2
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 +21 -0
- package/README.md +8 -2
- package/dist/index.js +20 -6
- package/package.json +22 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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.2](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.9.0...v0.10.2) (2021-12-21)
|
|
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
|
+
* **git:** repair check if current dir is under git ([419d422](https://gitlab.com/4s1/conventional-commit-creator/commit/419d42222a648ea9437a42589a9a9ad404a144ba))
|
|
13
|
+
|
|
14
|
+
## [0.10.1](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.10.0...v0.10.1) (2021-12-18)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* 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))
|
|
20
|
+
* add missing await statement and rename function ([04892a0](https://gitlab.com/4s1/conventional-commit-creator/commit/04892a0e1a9566c0b53895036792001a8e42b00f))
|
|
21
|
+
|
|
22
|
+
## [0.10.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.9.0...v0.10.0) (2021-12-15)
|
|
23
|
+
|
|
24
|
+
## [0.9.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.8.0...v0.9.0) (2021-12-10)
|
|
25
|
+
|
|
5
26
|
## [0.8.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.7.0...v0.8.0) (2021-11-18)
|
|
6
27
|
|
|
7
28
|
|
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,33 @@ 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())) {
|
|
89
94
|
msg += ` (#${data.issue})`;
|
|
90
95
|
}
|
|
91
96
|
else {
|
|
@@ -104,6 +109,15 @@ async function commit(msg) {
|
|
|
104
109
|
process.exit(1);
|
|
105
110
|
}
|
|
106
111
|
}
|
|
112
|
+
async function isCurrentDirUnderGitControl() {
|
|
113
|
+
try {
|
|
114
|
+
const result = await execute('git rev-parse --is-inside-work-tree');
|
|
115
|
+
return result.trim() === 'true';
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
107
121
|
async function haveStagedChanges() {
|
|
108
122
|
try {
|
|
109
123
|
const staged = await execute('git diff --cached');
|
|
@@ -114,7 +128,7 @@ async function haveStagedChanges() {
|
|
|
114
128
|
process.exit(1);
|
|
115
129
|
}
|
|
116
130
|
}
|
|
117
|
-
async function
|
|
131
|
+
async function isWork() {
|
|
118
132
|
try {
|
|
119
133
|
const output = await execute('git remote -v');
|
|
120
134
|
return output.includes('intra.bender:');
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@4s1/conventional-commit-creator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.2",
|
|
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
|
}
|