@goldstack/utils-cli 0.2.16 → 0.3.0
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/README.md +5 -5
- package/dist/src/utilsCli.d.ts +3 -3
- package/dist/src/utilsCli.js +29 -29
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# Goldstack CLI Utils
|
|
2
|
-
|
|
3
|
-
This library contains a method to wrap the execution for a Node.js CLI application.
|
|
4
|
-
|
|
5
|
-
See [Source Code](https://github.com/goldstack/goldstack/blob/master/workspaces/templates-lib/packages/utils-cli/src/utilsCli.ts).
|
|
1
|
+
# Goldstack CLI Utils
|
|
2
|
+
|
|
3
|
+
This library contains a method to wrap the execution for a Node.js CLI application.
|
|
4
|
+
|
|
5
|
+
See [Source Code](https://github.com/goldstack/goldstack/blob/master/workspaces/templates-lib/packages/utils-cli/src/utilsCli.ts).
|
package/dist/src/utilsCli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare type AsyncFunction<O> = () => Promise<O>;
|
|
2
|
-
export declare const wrapCli: (func: AsyncFunction<any>) => Promise<void>;
|
|
3
|
-
export {};
|
|
1
|
+
declare type AsyncFunction<O> = () => Promise<O>;
|
|
2
|
+
export declare const wrapCli: (func: AsyncFunction<any>) => Promise<void>;
|
|
3
|
+
export {};
|
|
4
4
|
//# sourceMappingURL=utilsCli.d.ts.map
|
package/dist/src/utilsCli.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wrapCli = void 0;
|
|
4
|
-
const isDebug = process.env.GOLDSTACK_DEBUG || process.env.DEBUG;
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
const wrapCli = async (func) => {
|
|
7
|
-
try {
|
|
8
|
-
await func();
|
|
9
|
-
process.exit(0);
|
|
10
|
-
}
|
|
11
|
-
catch (e) {
|
|
12
|
-
if (isDebug) {
|
|
13
|
-
throw e;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
console.log('❌ ' + e.message);
|
|
17
|
-
process.exit(1);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
exports.wrapCli = wrapCli;
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
process.on('unhandledRejection', (e) => {
|
|
24
|
-
if (isDebug) {
|
|
25
|
-
console.log(e);
|
|
26
|
-
}
|
|
27
|
-
console.log('❌ Unhandled error in asynchronous method:', e.message);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapCli = void 0;
|
|
4
|
+
const isDebug = process.env.GOLDSTACK_DEBUG || process.env.DEBUG;
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
const wrapCli = async (func) => {
|
|
7
|
+
try {
|
|
8
|
+
await func();
|
|
9
|
+
process.exit(0);
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
if (isDebug) {
|
|
13
|
+
throw e;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
console.log('❌ ' + e.message);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.wrapCli = wrapCli;
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
process.on('unhandledRejection', (e) => {
|
|
24
|
+
if (isDebug) {
|
|
25
|
+
console.log(e);
|
|
26
|
+
}
|
|
27
|
+
console.log('❌ Unhandled error in asynchronous method:', e.message);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
});
|
|
30
30
|
//# sourceMappingURL=utilsCli.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goldstack/utils-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Utilities for building command line interfaces.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goldstack",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@goldstack/utils-git": "0.
|
|
38
|
+
"@goldstack/utils-git": "0.2.0",
|
|
39
39
|
"@types/jest": "^28.1.8",
|
|
40
40
|
"@types/node": "^18.7.13",
|
|
41
41
|
"jest": "^28.1.0",
|