@zokugun/cli-utils 0.1.0 → 0.2.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.
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Command = void 0;
37
- const commander = __importStar(require("commander"));
38
- const commander_1 = require("commander");
39
- Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return commander_1.Command; } });
37
+ const commander = __importStar(require("@commander-js/extra-typings"));
38
+ const extra_typings_1 = require("@commander-js/extra-typings");
39
+ Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return extra_typings_1.Command; } });
40
40
  exports.default = commander;
@@ -1,4 +1,4 @@
1
- import * as commander from 'commander';
2
- import { Command } from 'commander';
1
+ import * as commander from '@commander-js/extra-typings';
2
+ import { Command } from '@commander-js/extra-typings';
3
3
  export default commander;
4
4
  export { Command, };
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.begin = begin;
7
7
  exports.check = check;
8
8
  exports.error = error;
9
+ exports.fatal = fatal;
9
10
  exports.finish = finish;
10
11
  exports.info = info;
11
12
  exports.newLine = newLine;
@@ -16,6 +17,7 @@ exports.step = step;
16
17
  exports.stop = stop;
17
18
  exports.success = success;
18
19
  exports.warn = warn;
20
+ const node_process_1 = __importDefault(require("node:process"));
19
21
  const log_update_plus_1 = require("@zokugun/log-update-plus");
20
22
  const ansi_colors_1 = __importDefault(require("ansi-colors"));
21
23
  const cli_spinners_1 = __importDefault(require("cli-spinners"));
@@ -30,9 +32,16 @@ function check(message) {
30
32
  log_update_plus_1.stdout.persist(`${ansi_colors_1.default.green(ansi_colors_1.default.symbols.check)} ${message}`);
31
33
  } // }}}
32
34
  function error(message) {
33
- stop(`${ansi_colors_1.default.red(ansi_colors_1.default.symbols.cross)} ${ansi_colors_1.default.bold('Error!')}`);
35
+ log_update_plus_1.stdout.persist(`${ansi_colors_1.default.red(ansi_colors_1.default.symbols.cross)} ${ansi_colors_1.default.bold('Error!')}`);
34
36
  log_update_plus_1.stdout.persist(message);
35
37
  } // }}}
38
+ function fatal(message, code = 1) {
39
+ stop();
40
+ log_update_plus_1.stdout.persist(`${ansi_colors_1.default.red(ansi_colors_1.default.symbols.cross)} ${ansi_colors_1.default.bold('Fatal!')}`);
41
+ log_update_plus_1.stdout.persist(message);
42
+ // eslint-disable-next-line unicorn/no-process-exit
43
+ node_process_1.default.exit(code);
44
+ } // }}}
36
45
  function finish(duration) {
37
46
  if (typeof duration !== 'number') {
38
47
  if ($start === 0) {
@@ -92,6 +101,7 @@ exports.default = {
92
101
  begin,
93
102
  check,
94
103
  error,
104
+ fatal,
95
105
  finish,
96
106
  info,
97
107
  newLine,
@@ -2,6 +2,7 @@ export type IndicatorLoading = ReturnType<typeof setInterval>;
2
2
  export declare function begin(): void;
3
3
  export declare function check(message: string): void;
4
4
  export declare function error(message: string): void;
5
+ export declare function fatal(message: string, code?: number): never;
5
6
  export declare function finish(duration?: number): void;
6
7
  export declare function info(message: string): void;
7
8
  export declare function newLine(): void;
@@ -16,6 +17,7 @@ declare const _default: {
16
17
  begin: typeof begin;
17
18
  check: typeof check;
18
19
  error: typeof error;
20
+ fatal: typeof fatal;
19
21
  finish: typeof finish;
20
22
  info: typeof info;
21
23
  newLine: typeof newLine;
@@ -1,4 +1,4 @@
1
- import * as commander from 'commander';
2
- import { Command } from 'commander';
1
+ import * as commander from '@commander-js/extra-typings';
2
+ import { Command } from '@commander-js/extra-typings';
3
3
  export default commander;
4
4
  export { Command, };
@@ -1,5 +1,5 @@
1
- import * as commander from 'commander';
2
- import { Command } from 'commander';
1
+ import * as commander from '@commander-js/extra-typings';
2
+ import { Command } from '@commander-js/extra-typings';
3
3
  export default commander;
4
4
  export {
5
5
  // eslint-disable-next-line unicorn/prefer-export-from
@@ -2,6 +2,7 @@ export type IndicatorLoading = ReturnType<typeof setInterval>;
2
2
  export declare function begin(): void;
3
3
  export declare function check(message: string): void;
4
4
  export declare function error(message: string): void;
5
+ export declare function fatal(message: string, code?: number): never;
5
6
  export declare function finish(duration?: number): void;
6
7
  export declare function info(message: string): void;
7
8
  export declare function newLine(): void;
@@ -16,6 +17,7 @@ declare const _default: {
16
17
  begin: typeof begin;
17
18
  check: typeof check;
18
19
  error: typeof error;
20
+ fatal: typeof fatal;
19
21
  finish: typeof finish;
20
22
  info: typeof info;
21
23
  newLine: typeof newLine;
@@ -1,3 +1,4 @@
1
+ import process from 'node:process';
1
2
  import { stdout } from '@zokugun/log-update-plus';
2
3
  import c from 'ansi-colors';
3
4
  import cliSpinners from 'cli-spinners';
@@ -12,9 +13,16 @@ export function check(message) {
12
13
  stdout.persist(`${c.green(c.symbols.check)} ${message}`);
13
14
  } // }}}
14
15
  export function error(message) {
15
- stop(`${c.red(c.symbols.cross)} ${c.bold('Error!')}`);
16
+ stdout.persist(`${c.red(c.symbols.cross)} ${c.bold('Error!')}`);
16
17
  stdout.persist(message);
17
18
  } // }}}
19
+ export function fatal(message, code = 1) {
20
+ stop();
21
+ stdout.persist(`${c.red(c.symbols.cross)} ${c.bold('Fatal!')}`);
22
+ stdout.persist(message);
23
+ // eslint-disable-next-line unicorn/no-process-exit
24
+ process.exit(code);
25
+ } // }}}
18
26
  export function finish(duration) {
19
27
  if (typeof duration !== 'number') {
20
28
  if ($start === 0) {
@@ -74,6 +82,7 @@ export default {
74
82
  begin,
75
83
  check,
76
84
  error,
85
+ fatal,
77
86
  finish,
78
87
  info,
79
88
  newLine,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zokugun/cli-utils",
3
3
  "description": "Utils for CLI app",
4
- "version": "0.1.0",
4
+ "version": "0.2.1",
5
5
  "author": {
6
6
  "name": "Baptiste Augrain",
7
7
  "email": "daiyam@zokugun.org"
@@ -13,7 +13,7 @@
13
13
  "url": "git+https://github.com/zokugun/node-cli-utils.git"
14
14
  },
15
15
  "bugs": {
16
- "url": "https://github.com/zokugun/node-cli-utils/issues"
16
+ "url": "https://github.com/zokugun/node-cli-utils/discussions/categories/issue-triage"
17
17
  },
18
18
  "type": "module",
19
19
  "exports": {
@@ -67,44 +67,49 @@
67
67
  }
68
68
  },
69
69
  "scripts": {
70
+ "audit:fix": "npm audit fix --min-release-age=0",
70
71
  "build": "npm run clean && npm run build:lib",
71
72
  "build:lib": "tsc-leda generate",
72
73
  "build:package": "tsc-leda update-package",
74
+ "ci:lint": "zizmor .",
75
+ "ci:lint:fix": "zizmor . --fix=all",
73
76
  "clean": "rimraf lib .src",
74
77
  "compile:src": "tsc -p src",
75
78
  "lint": "xo",
79
+ "lint:all": "fixpack && npm audit && npm run ci:lint && npm run lint",
76
80
  "lint:fix": "xo --fix",
77
81
  "postinstall": "patch-package",
78
82
  "prepack": "npm run build",
79
83
  "prepare": "husky; fixpack || true",
80
84
  "release": "release-it",
85
+ "update:artifacts": "artifact update",
86
+ "update:ci": "PINACT_MIN_AGE=7 pinact run",
87
+ "update:deps": "taze",
88
+ "watch:build": "tsc-watch -p src --onSuccess 'npm run build'",
81
89
  "watch:src": "tsc-watch -p src"
82
90
  },
83
91
  "dependencies": {
84
- "@zokugun/log-update-plus": "^0.1.0",
85
- "ansi-colors": "^4.1.3",
86
- "cli-spinners": "^3.4.0",
87
- "commander": "^14.0.3",
88
- "enquirer": "^2.4.1",
89
- "patch-package": "^8.0.1"
92
+ "@commander-js/extra-typings": "14.0.0",
93
+ "@zokugun/log-update-plus": "0.1.1",
94
+ "ansi-colors": "4.1.3",
95
+ "cli-spinners": "3.4.0",
96
+ "commander": "14.0.3",
97
+ "enquirer": "2.4.1",
98
+ "patch-package": "8.0.1"
90
99
  },
91
100
  "devDependencies": {
92
- "@commitlint/cli": "^19.7.1",
93
- "@commitlint/config-conventional": "^19.7.1",
94
- "@types/node": "^20.14.8",
95
- "@zokugun/tsc-leda": "^0.3.1",
96
- "fixpack": "^4.0.0",
97
- "husky": "^9.1.7",
98
- "lint-staged": "^16.1.4",
99
- "release-it": "^19.2.4",
100
- "tsc-watch": "^7.2.0",
101
- "typescript": "^5.7.3",
101
+ "@commitlint/cli": "19.8.1",
102
+ "@commitlint/config-conventional": "19.8.1",
103
+ "@types/node": "20.19.39",
104
+ "@zokugun/tsc-leda": "0.3.1",
105
+ "fixpack": "4.0.0",
106
+ "husky": "9.1.7",
107
+ "lint-staged": "16.4.0",
108
+ "release-it": "20.0.0-1",
109
+ "taze": "19.11.0",
110
+ "tsc-watch": "7.2.0",
111
+ "typescript": "5.9.3",
102
112
  "xo": "0.60.0"
103
113
  },
104
- "overrides": {
105
- "terser-webpack-plugin": {
106
- "serialize-javascript": "^7.0.3"
107
- }
108
- },
109
114
  "keywords": []
110
115
  }