@4s1/conventional-commit-creator 0.10.0 → 0.11.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 +26 -0
- package/LICENSE +0 -0
- package/README.md +2 -0
- package/dist/index.js +15 -50
- package/package.json +14 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
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.11.1](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.11.0...v0.11.1) (2021-12-26)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* large amount of changes supported ([#5](https://gitlab.com/4s1/conventional-commit-creator/issues/5)) ([db17314](https://gitlab.com/4s1/conventional-commit-creator/commit/db173145a42fcd7f4e701b8a4f413c89f890c680))
|
|
11
|
+
|
|
12
|
+
## [0.11.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.10.2...v0.11.0) (2021-12-26)
|
|
13
|
+
|
|
14
|
+
## [0.10.2](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.9.0...v0.10.2) (2021-12-21)
|
|
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
|
+
* **git:** repair check if current dir is under git ([419d422](https://gitlab.com/4s1/conventional-commit-creator/commit/419d42222a648ea9437a42589a9a9ad404a144ba))
|
|
22
|
+
|
|
23
|
+
## [0.10.1](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.10.0...v0.10.1) (2021-12-18)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* 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))
|
|
29
|
+
* add missing await statement and rename function ([04892a0](https://gitlab.com/4s1/conventional-commit-creator/commit/04892a0e1a9566c0b53895036792001a8e42b00f))
|
|
30
|
+
|
|
5
31
|
## [0.10.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.9.0...v0.10.0) (2021-12-15)
|
|
6
32
|
|
|
7
33
|
## [0.9.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.8.0...v0.9.0) (2021-12-10)
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
This CLI application assists in creating commit messages that are conform to the conventional commit style.
|
|
4
4
|
It will ask for type, scope (optional), description and issue (optional).
|
|
5
5
|
|
|
6
|
+

|
|
7
|
+
|
|
6
8
|
## Install
|
|
7
9
|
|
|
8
10
|
```bash
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
"use strict";
|
|
3
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
4
|
};
|
|
6
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
6
|
const prompts_1 = __importDefault(require("prompts"));
|
|
8
|
-
const
|
|
7
|
+
const git_1 = require("./git");
|
|
9
8
|
const questions = [
|
|
10
9
|
{
|
|
11
10
|
type: 'select',
|
|
@@ -64,28 +63,35 @@ const questions = [
|
|
|
64
63
|
},
|
|
65
64
|
];
|
|
66
65
|
async function main() {
|
|
67
|
-
|
|
66
|
+
const git = new git_1.Git();
|
|
67
|
+
if (!(await git.isCurrentDirUnderGitControl())) {
|
|
68
|
+
console.error('Current directory is not a git repository.');
|
|
69
|
+
process.exit(0);
|
|
70
|
+
}
|
|
71
|
+
if (!(await git.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
|
|
78
|
-
await
|
|
80
|
+
}));
|
|
81
|
+
const isAtWork = await git.isAtWork();
|
|
82
|
+
const msg = await createMsg(data, isAtWork);
|
|
83
|
+
await git.commit(msg);
|
|
79
84
|
console.info('done');
|
|
80
85
|
}
|
|
81
|
-
function createMsg(data) {
|
|
86
|
+
async function createMsg(data, isWork) {
|
|
82
87
|
let msg = `${data.type.trim()}`;
|
|
83
88
|
if (data.scope) {
|
|
84
89
|
msg += `(${data.scope.trim()})`;
|
|
85
90
|
}
|
|
86
91
|
msg += `: ${data.description.trim()}`;
|
|
87
92
|
if (data.issue) {
|
|
88
|
-
|
|
93
|
+
// Hack to support Redmine ticket linking at work.
|
|
94
|
+
if (!isWork) {
|
|
89
95
|
msg += ` (#${data.issue})`;
|
|
90
96
|
}
|
|
91
97
|
else {
|
|
@@ -94,46 +100,5 @@ function createMsg(data) {
|
|
|
94
100
|
}
|
|
95
101
|
return msg;
|
|
96
102
|
}
|
|
97
|
-
async function commit(msg) {
|
|
98
|
-
console.info('committing ...');
|
|
99
|
-
try {
|
|
100
|
-
await execute(`git commit -m "${msg}"`);
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
console.error(err);
|
|
104
|
-
process.exit(1);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async function haveStagedChanges() {
|
|
108
|
-
try {
|
|
109
|
-
const staged = await execute('git diff --cached');
|
|
110
|
-
return staged !== '';
|
|
111
|
-
}
|
|
112
|
-
catch (err) {
|
|
113
|
-
console.error(err);
|
|
114
|
-
process.exit(1);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
async function isBender() {
|
|
118
|
-
try {
|
|
119
|
-
const output = await execute('git remote -v');
|
|
120
|
-
return output.includes('intra.bender:');
|
|
121
|
-
}
|
|
122
|
-
catch (err) {
|
|
123
|
-
console.error(err);
|
|
124
|
-
process.exit(1);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
async function execute(cmd) {
|
|
128
|
-
return new Promise((resolve, reject) => {
|
|
129
|
-
(0, child_process_1.exec)(cmd, (err, stdout) => {
|
|
130
|
-
if (err) {
|
|
131
|
-
reject(err);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
resolve(stdout);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
103
|
main().catch(console.error);
|
|
139
104
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@4s1/conventional-commit-creator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Conventional Commit Creator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"conventional commit",
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
"build:dev": "pnpm run build -- --project tsconfig.dev.json",
|
|
32
32
|
"format": "prettier --write src/",
|
|
33
33
|
"lbt": "npm run lint && npm run build && npm run test",
|
|
34
|
-
"lint": "
|
|
35
|
-
"lint:fix": "npm run lint -- --fix",
|
|
34
|
+
"lint": "eslint --ext .ts src/",
|
|
36
35
|
"prepare": "husky install",
|
|
37
36
|
"release": "git diff --exit-code --quiet && pnpm run lbt && standard-version",
|
|
38
37
|
"release:major": "pnpm run release -- --release-as major",
|
|
@@ -40,23 +39,28 @@
|
|
|
40
39
|
"release:patch": "pnpm run release -- --release-as patch",
|
|
41
40
|
"start": "node dist/index.js",
|
|
42
41
|
"start:dev": "ts-node src/index.ts",
|
|
43
|
-
"test": "
|
|
42
|
+
"test": "jest",
|
|
43
|
+
"test:cov": "pnpm run test -- --coverage",
|
|
44
|
+
"test:watch": "pnpm run test -- --watch"
|
|
44
45
|
},
|
|
45
46
|
"prettier": "@4s1/eslint-config",
|
|
46
47
|
"dependencies": {
|
|
47
48
|
"prompts": "^2.4.2"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"@4s1/eslint-config": "
|
|
51
|
-
"@4s1/ts-config": "
|
|
52
|
-
"@commitlint/cli": "
|
|
53
|
-
"@commitlint/config-conventional": "
|
|
54
|
-
"@types/
|
|
51
|
+
"@4s1/eslint-config": "3.5.0",
|
|
52
|
+
"@4s1/ts-config": "1.4.0",
|
|
53
|
+
"@commitlint/cli": "16.0.0",
|
|
54
|
+
"@commitlint/config-conventional": "16.0.0",
|
|
55
|
+
"@types/jest": "27.0.3",
|
|
56
|
+
"@types/node": "14.18.2",
|
|
55
57
|
"@types/prompts": "2.4.0",
|
|
56
|
-
"eslint": "8.
|
|
58
|
+
"eslint": "8.5.0",
|
|
57
59
|
"husky": "7.0.4",
|
|
60
|
+
"jest": "27.4.5",
|
|
58
61
|
"prettier": "2.5.1",
|
|
59
62
|
"standard-version": "9.3.2",
|
|
63
|
+
"ts-jest": "27.1.2",
|
|
60
64
|
"ts-node": "10.4.0",
|
|
61
65
|
"typescript": "4.5.4"
|
|
62
66
|
},
|