@4s1/conventional-commit-creator 0.10.1 → 0.11.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 CHANGED
@@ -2,6 +2,31 @@
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.2](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.11.1...v0.11.2) (2021-12-28)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add shebang ([6cc8f2c](https://gitlab.com/4s1/conventional-commit-creator/commit/6cc8f2cd0dc20eaef6e11945e8a83bbaec0b6652))
11
+
12
+ ## [0.11.1](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.11.0...v0.11.1) (2021-12-26)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * 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))
18
+
19
+ ## [0.11.0](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.10.2...v0.11.0) (2021-12-26)
20
+
21
+ ## [0.10.2](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.9.0...v0.10.2) (2021-12-21)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * 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))
27
+ * add missing await statement and rename function ([04892a0](https://gitlab.com/4s1/conventional-commit-creator/commit/04892a0e1a9566c0b53895036792001a8e42b00f))
28
+ * **git:** repair check if current dir is under git ([419d422](https://gitlab.com/4s1/conventional-commit-creator/commit/419d42222a648ea9437a42589a9a9ad404a144ba))
29
+
5
30
  ## [0.10.1](https://gitlab.com/4s1/conventional-commit-creator/compare/v0.10.0...v0.10.1) (2021-12-18)
6
31
 
7
32
 
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
- const child_process_1 = require("child_process");
8
+ const git_1 = require("./git");
9
9
  const questions = [
10
10
  {
11
11
  type: 'select',
@@ -64,11 +64,12 @@ const questions = [
64
64
  },
65
65
  ];
66
66
  async function main() {
67
- if (!(await isCurrentDirUnderGitControl())) {
67
+ const git = new git_1.Git();
68
+ if (!(await git.isCurrentDirUnderGitControl())) {
68
69
  console.error('Current directory is not a git repository.');
69
70
  process.exit(0);
70
71
  }
71
- if (!(await haveStagedChanges())) {
72
+ if (!(await git.haveStagedChanges())) {
72
73
  console.error('Nothing to commit');
73
74
  process.exit(0);
74
75
  }
@@ -78,11 +79,12 @@ async function main() {
78
79
  process.exit(1);
79
80
  },
80
81
  }));
81
- const msg = await createMsg(data);
82
- await commit(msg);
82
+ const isAtWork = await git.isAtWork();
83
+ const msg = await createMsg(data, isAtWork);
84
+ await git.commit(msg);
83
85
  console.info('done');
84
86
  }
85
- async function createMsg(data) {
87
+ async function createMsg(data, isWork) {
86
88
  let msg = `${data.type.trim()}`;
87
89
  if (data.scope) {
88
90
  msg += `(${data.scope.trim()})`;
@@ -90,7 +92,7 @@ async function createMsg(data) {
90
92
  msg += `: ${data.description.trim()}`;
91
93
  if (data.issue) {
92
94
  // Hack to support Redmine ticket linking at work.
93
- if (!(await isWork())) {
95
+ if (!isWork) {
94
96
  msg += ` (#${data.issue})`;
95
97
  }
96
98
  else {
@@ -99,55 +101,5 @@ async function createMsg(data) {
99
101
  }
100
102
  return msg;
101
103
  }
102
- async function commit(msg) {
103
- console.info('committing ...');
104
- try {
105
- await execute(`git commit -m "${msg}"`);
106
- }
107
- catch (err) {
108
- console.error(err);
109
- process.exit(1);
110
- }
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
- }
121
- async function haveStagedChanges() {
122
- try {
123
- const staged = await execute('git diff --cached');
124
- return staged !== '';
125
- }
126
- catch (err) {
127
- console.error(err);
128
- process.exit(1);
129
- }
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
- }
141
- async function execute(cmd) {
142
- return new Promise((resolve, reject) => {
143
- (0, child_process_1.exec)(cmd, (err, stdout) => {
144
- if (err) {
145
- reject(err);
146
- return;
147
- }
148
- resolve(stdout);
149
- });
150
- });
151
- }
152
104
  main().catch(console.error);
153
105
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4s1/conventional-commit-creator",
3
- "version": "0.10.1",
3
+ "version": "0.11.2",
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": "echo no linting",
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",
@@ -49,12 +48,12 @@
49
48
  "prompts": "^2.4.2"
50
49
  },
51
50
  "devDependencies": {
52
- "@4s1/eslint-config": "3.4.0",
51
+ "@4s1/eslint-config": "3.5.0",
53
52
  "@4s1/ts-config": "1.4.0",
54
- "@commitlint/cli": "15.0.0",
55
- "@commitlint/config-conventional": "15.0.0",
53
+ "@commitlint/cli": "16.0.1",
54
+ "@commitlint/config-conventional": "16.0.0",
56
55
  "@types/jest": "27.0.3",
57
- "@types/node": "14.18.1",
56
+ "@types/node": "14.18.3",
58
57
  "@types/prompts": "2.4.0",
59
58
  "eslint": "8.5.0",
60
59
  "husky": "7.0.4",