@4s1/conventional-commit-creator 1.0.0 → 2.0.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Steffen (4s1)
3
+ Copyright (c) 2023 Steffen (4s1)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,7 +1,3 @@
1
- [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=4s1_conventional-commit-creator&metric=bugs)](https://sonarcloud.io/project/issues?id=4s1_conventional-commit-creator&resolved=false&types=BUG)
2
- [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=4s1_conventional-commit-creator&metric=vulnerabilities)](https://sonarcloud.io/project/issues?id=4s1_conventional-commit-creator&resolved=false&types=VULNERABILITY)
3
- [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=4s1_conventional-commit-creator&metric=code_smells)](https://sonarcloud.io/project/issues?id=4s1_conventional-commit-creator&resolved=false&types=CODE_SMELL)
4
-
5
1
  # Conventional Commit Creator
6
2
 
7
3
  This CLI application assists in creating commit messages that are conform to the conventional commit style.
package/dist/git.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Git = void 0;
4
- const child_process_1 = require("child_process");
5
- class Git {
1
+ import { exec } from 'node:child_process';
2
+ export class Git {
6
3
  async isCurrentDirUnderGitControl() {
7
4
  try {
8
5
  const result = await this.execute('git rev-parse --is-inside-work-tree');
@@ -37,16 +34,19 @@ class Git {
37
34
  async commit(msg) {
38
35
  console.info('committing ...');
39
36
  try {
40
- await this.execute(`git commit -m "${msg}"`);
37
+ await this.execute(`git commit -m "${this.encodeMessage(msg)}"`);
41
38
  }
42
39
  catch (err) {
43
40
  console.error(err);
44
41
  process.exit(1);
45
42
  }
46
43
  }
44
+ encodeMessage(msg) {
45
+ return msg.replaceAll('"', '\\"');
46
+ }
47
47
  execute(cmd) {
48
48
  return new Promise((resolve, reject) => {
49
- (0, child_process_1.exec)(cmd, (err, stdout) => {
49
+ exec(cmd, (err, stdout) => {
50
50
  if (err) {
51
51
  reject(err);
52
52
  return;
@@ -56,5 +56,3 @@ class Git {
56
56
  });
57
57
  }
58
58
  }
59
- exports.Git = Git;
60
- //# sourceMappingURL=git.js.map
package/dist/index.js CHANGED
@@ -1,11 +1,6 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const prompts_1 = __importDefault(require("prompts"));
8
- const git_1 = require("./git");
2
+ import prompts from 'prompts';
3
+ import { Git } from './git.js';
9
4
  // https://kapeli.com/cheat_sheets/Conventional_Commits.docset/Contents/Resources/Documents/index
10
5
  const questions = [
11
6
  {
@@ -62,7 +57,7 @@ const questions = [
62
57
  },
63
58
  ];
64
59
  async function main() {
65
- const git = new git_1.Git();
60
+ const git = new Git();
66
61
  if (!(await git.isCurrentDirUnderGitControl())) {
67
62
  console.error('Current directory is not a git repository.');
68
63
  process.exit(0);
@@ -71,7 +66,7 @@ async function main() {
71
66
  console.error('Nothing to commit');
72
67
  process.exit(0);
73
68
  }
74
- const data = (await (0, prompts_1.default)(questions, {
69
+ const data = (await prompts(questions, {
75
70
  onCancel: () => {
76
71
  console.error('Aborted');
77
72
  process.exit(1);
@@ -100,4 +95,3 @@ async function createMsg(data, isWork) {
100
95
  return msg;
101
96
  }
102
97
  main().catch(console.error);
103
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4s1/conventional-commit-creator",
3
- "version": "1.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Conventional Commit Creator",
5
5
  "keywords": [
6
6
  "conventional commit",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "license": "MIT",
17
17
  "author": "Steffen <steffen@4s1.de>",
18
- "type": "commonjs",
18
+ "type": "module",
19
19
  "exports": "./dist/index.js",
20
20
  "main": "./dist/index.js",
21
21
  "typings": "./dist/index.d.ts",
@@ -26,34 +26,36 @@
26
26
  "files": [
27
27
  "dist/"
28
28
  ],
29
- "prettier": "@4s1/eslint-config",
30
- "dependencies": {
31
- "prompts": "^2.4.2"
32
- },
33
- "devDependencies": {
34
- "@4s1/eslint-config": "3.14.1",
35
- "@4s1/ts-config": "2.0.0",
36
- "@types/node": "14.18.22",
37
- "@types/prompts": "2.4.0",
38
- "eslint": "8.20.0",
39
- "prettier": "2.7.1",
40
- "ts-node": "10.9.1",
41
- "typescript": "4.7.4"
42
- },
43
- "publishConfig": {
44
- "access": "public",
45
- "registry": "https://registry.npmjs.org"
46
- },
47
29
  "scripts": {
48
30
  "build": "rm -rf dist && tsc",
49
31
  "build:dev": "pnpm run build -- --project tsconfig.dev.json",
50
- "format": "prettier --write src/",
51
32
  "lbt": "npm run lint && npm run build && npm run test",
52
- "lint": "eslint --ext .ts src/",
33
+ "lint": "eslint --ext .ts src/ && prettier --check .",
34
+ "lint:fix": "eslint --ext .ts --fix src/ && prettier --write .",
53
35
  "start": "node dist/index.js",
54
36
  "start:dev": "ts-node src/index.ts",
55
37
  "test": "echo no tests",
56
38
  "test:cov": "pnpm run test -- --coverage",
57
39
  "test:watch": "pnpm run test -- --watch"
40
+ },
41
+ "prettier": "@4s1/eslint-config",
42
+ "dependencies": {
43
+ "prompts": "2.4.2"
44
+ },
45
+ "devDependencies": {
46
+ "@4s1/eslint-config": "6.5.0",
47
+ "@4s1/ts-config": "4.1.1",
48
+ "@types/node": "18.15.11",
49
+ "@types/prompts": "2.4.4",
50
+ "eslint": "8.38.0",
51
+ "prettier": "2.8.7",
52
+ "ts-node": "10.9.1",
53
+ "typescript": "5.0.4"
54
+ },
55
+ "engines": {
56
+ "node": "18"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public"
58
60
  }
59
- }
61
+ }
package/dist/git.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export declare class Git {
2
- isCurrentDirUnderGitControl(): Promise<boolean>;
3
- haveStagedChanges(): Promise<boolean>;
4
- isAtWork(): Promise<boolean>;
5
- commit(msg: string): Promise<void>;
6
- private execute;
7
- }
8
- //# sourceMappingURL=git.d.ts.map
package/dist/git.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAEA,qBAAa,GAAG;IACD,2BAA2B,IAAI,OAAO,CAAC,OAAO,CAAC;IAU/C,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAWrC,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAU5B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU/C,OAAO,CAAC,OAAO;CAWhB"}
package/dist/git.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":";;;AAAA,iDAAmD;AAEnD,MAAa,GAAG;IACP,KAAK,CAAC,2BAA2B;QACtC,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAA;YACxE,OAAO,MAAM,CAAC,IAAI,EAAE,KAAK,MAAM,CAAA;SAChC;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClB,OAAO,KAAK,CAAA;SACb;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB;QAC5B,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAA;YAChE,OAAO,MAAM,KAAK,EAAE,CAAA;SACrB;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClB,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;YAC3B,OAAO,KAAK,CAAA;SACb;IACH,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;YAClD,OAAO,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;SACxC;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClB,OAAO,KAAK,CAAA;SACb;IACH,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,GAAW;QAC7B,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAC9B,IAAI;YACF,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,GAAG,GAAG,CAAC,CAAA;SAC7C;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SAChB;IACH,CAAC;IAEO,OAAO,CAAC,GAAW;QACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAA,oBAAI,EAAC,GAAG,EAAE,CAAC,GAAyB,EAAE,MAAc,EAAE,EAAE;gBACtD,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAA;oBACX,OAAM;iBACP;gBACD,OAAO,CAAC,MAAM,CAAC,CAAA;YACjB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AArDD,kBAqDC"}
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,sDAA+C;AAC/C,+BAA2B;AAS3B,iGAAiG;AACjG,MAAM,SAAS,GAAmB;IAChC;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,KAAK,EAAE;YAC9C,EAAE,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,EAAE;YACpD,EAAE,KAAK,EAAE,sEAAsE,EAAE,KAAK,EAAE,UAAU,EAAE;YACpG,EAAE,KAAK,EAAE,oDAAoD,EAAE,KAAK,EAAE,MAAM,EAAE;YAC9E,EAAE,KAAK,EAAE,uCAAuC,EAAE,KAAK,EAAE,MAAM,EAAE;YACjE,EAAE,KAAK,EAAE,8EAA8E,EAAE,KAAK,EAAE,OAAO,EAAE;YACzG,EAAE,KAAK,EAAE,oCAAoC,EAAE,KAAK,EAAE,MAAM,EAAE;YAC9D,EAAE,KAAK,EAAE,8DAA8D,EAAE,KAAK,EAAE,OAAO,EAAE;YACzF,EAAE,KAAK,EAAE,2DAA2D,EAAE,KAAK,EAAE,OAAO,EAAE;YACtF,EAAE,KAAK,EAAE,gEAAgE,EAAE,KAAK,EAAE,IAAI,EAAE;YACxF,EAAE,KAAK,EAAE,sCAAsC,EAAE,KAAK,EAAE,QAAQ,EAAE;SACnE;KACF;IACD;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,CAAC,KAAa,EAAoB,EAAE;YAC5C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;gBACrB,OAAO,gBAAgB,KAAK,CAAC,MAAM,GAAG,EAAE,oBAAoB,CAAA;a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