czg 0.0.1 → 0.0.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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "czg",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Interactive Commitizen CLI that generate standardized commit messages",
5
5
  "keywords": [
6
6
  "commit",
7
7
  "commit message",
8
- "commitizen-cli",
9
8
  "commitizen",
9
+ "commitizen-cli",
10
10
  "cli",
11
11
  "cz-git",
12
12
  "cz-customizable"
@@ -23,14 +23,16 @@
23
23
  "license": "MIT",
24
24
  "author": "Zhengqbbb <zhengqbbb@gmail.com> (https://github.com/Zhengqbbb)",
25
25
  "bin": {
26
- "czgit": "lib/index.js"
26
+ "czg": "bin/index.js"
27
+ },
28
+ "devDependencies": {
29
+ "cz-git": "1.3.5",
30
+ "inquirer": "8.2.0",
31
+ "rimraf": "3.0.2"
27
32
  },
28
33
  "scripts": {
29
34
  "build": "pnpm clean && tsup",
30
35
  "clean": "rimraf *.tsbuildinfo lib dist",
31
36
  "release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
32
- },
33
- "devDependencies": {
34
- "rimraf": "3.0.2"
35
37
  }
36
- }
38
+ }
File without changes
File without changes
@@ -0,0 +1,41 @@
1
+ /** `czg` help document */
2
+ import { style } from "cz-git";
3
+ export const generateHelp = (version: string, code = 0) => {
4
+ // prettier-ignore
5
+ console.log(
6
+ `${style.yellow("NAME:")}
7
+ ${style.green("czg")} - Interactive Commitizen CLI that generate standardized commit messages
8
+
9
+ ${style.yellow("WEBSITE:")}
10
+ ${style.underline("https://cz-git.qbenben.com/cli/")}
11
+ ${style.underline("https://github.com/Zhengqbbb/cz-git")}
12
+
13
+ ${style.yellow("VERSION:")} ${version}
14
+
15
+ ${style.yellow("USAGE:")}
16
+ czg [subcommand] [options]
17
+
18
+ ${style.yellow("SUBCOMMAND:")}
19
+ ${style.cyan("init")} ${style.red("Generate initialize commitizen configFile and guide")}
20
+ ${style.gray("Default porvide interactive prompt. skip 'czg init -y'")}
21
+ ${style.cyan("emoji")} ${style.red("Turn on emoji mode")}
22
+ ${style.cyan("checkbox")} ${style.red("Turn on scope checkbox mode")}
23
+ ${style.cyan("version")} ${style.red("Show version")}
24
+ ${style.cyan("help")} ${style.red("Show help")}
25
+
26
+ ${style.yellow("OPTIONS:")}
27
+ ${style.cyan("--config")} ${style.red("Specify the configuration file to use")}
28
+ ${style.cyan("--reback|-b")} ${style.red("Provide interactive prompt by the last message")}
29
+ ${style.cyan("--retry|-r")} ${style.red("Direct retry submit by the last message")}
30
+
31
+ ${style.yellow("EXAMPLES:")}
32
+ ${style.cyan("czg")}
33
+ ${style.cyan("czg emoji")}
34
+ ${style.cyan("czg --config \"./config/cz.json\"")}
35
+
36
+ Run 'czg SUBCOMMAND --help' for more information on a command
37
+ Extends 'git commit' command and options.
38
+ See 'git commit --help' for more information. `
39
+ );
40
+ process.exit(code);
41
+ };
@@ -0,0 +1 @@
1
+ export * from "./help";
package/src/index.ts CHANGED
@@ -1,3 +1,46 @@
1
1
  #!/usr/bin/env node
2
- const nice = "hello world";
3
- console.log(nice);
2
+ import { generateHelp } from "./generator";
3
+
4
+ process.on("uncaughtException", function (err) {
5
+ console.error(err.message || err);
6
+ process.exit(1);
7
+ });
8
+
9
+ // catch SIGINT signal like control+c
10
+ process.stdin.on("data", function (key: any) {
11
+ if (key == "\u0003") {
12
+ process.exit(130); // 128 + SIGINT
13
+ }
14
+ });
15
+
16
+ /**
17
+ * Main CLI Enter Point
18
+ * @param environment use debug mode
19
+ * @param {string[]} argv Node.js process
20
+ */
21
+ export const bootsrap = (environment: any = {}, argv = process.argv) => {
22
+ const commandArgs = argv.slice(2, argv.length);
23
+ const subCommand = commandArgs[0] || "";
24
+ const czgitVersion = require("../package.json").version;
25
+
26
+ if (!subCommand) console.log("commit", environment);
27
+
28
+ /* eslint-disable prettier/prettier */
29
+ /* prettier-ignore */
30
+ switch (true) {
31
+ // options
32
+ case /^(--config)$/.test(subCommand): console.log("config file"); process.exit(0);
33
+ case /^(--reback|-b)$/.test(subCommand): console.log("reback"); process.exit(0);
34
+ case /^(--retry|-r$)$/.test(subCommand): console.log("retry"); process.exit(0);
35
+ // subCommand
36
+ case /^(init)$/.test(subCommand): console.log("init"); process.exit(0);
37
+ case /^(emoji)$/.test(subCommand): console.log("emoji"); process.exit(0);
38
+ case /^(checkbox)$/.test(subCommand): console.log("checkbox"); process.exit(0);
39
+ case /^(version|-v|--version)$/.test(subCommand): console.log(czgitVersion); process.exit(0);
40
+ case /^(help|-h|--help)$/.test(subCommand): generateHelp(czgitVersion); return;
41
+
42
+ default: console.log("commit"); process.exit(0);
43
+ }
44
+ };
45
+
46
+ bootsrap()
package/tsconfig.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "outDir": "./lib",
6
6
  "noUnusedLocals": false,
7
7
  "noUnusedParameters": false,
8
+ "removeComments": true,
8
9
  },
9
10
  "exclude": ["node_modules", "./dist", "./lib"],
10
11
  "include": ["./src"]
package/tsup.config.ts CHANGED
@@ -4,8 +4,10 @@ import baseConfig from "../../tsup.config";
4
4
  export default defineConfig(() => {
5
5
  return {
6
6
  ...baseConfig,
7
+
7
8
  minify: true,
8
9
  entry: ["./src/index.ts"],
10
+ outDir: "./bin",
9
11
  tsconfig: "./tsconfig.json",
10
12
  dts: false
11
13
  };
package/lib/index.js DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- var o="hello world";console.log(o);