uni-run 1.0.6 → 1.0.8
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/dist/arg-helper.cjs +29 -18
- package/dist/arg-helper.d.cts +29 -15
- package/dist/arg-helper.d.mts +29 -15
- package/dist/arg-helper.mjs +29 -18
- package/dist/arg.d.cts +54 -30
- package/dist/arg.d.mts +54 -30
- package/dist/execution/index.cjs +53 -29
- package/dist/execution/index.d.cts +3 -1
- package/dist/execution/index.d.mts +3 -1
- package/dist/execution/index.mjs +53 -29
- package/dist/execution/watcher.cjs +16 -20
- package/dist/execution/watcher.d.cts +1 -1
- package/dist/execution/watcher.d.mts +1 -1
- package/dist/execution/watcher.mjs +16 -20
- package/dist/utils/debounce.d.cts +1 -1
- package/dist/utils/debounce.d.mts +1 -1
- package/package.json +8 -9
package/dist/arg-helper.cjs
CHANGED
|
@@ -8,21 +8,18 @@ exports.mapFlagsToOptions = mapFlagsToOptions;
|
|
|
8
8
|
const noarg_1 = __importDefault(require("noarg"));
|
|
9
9
|
exports.executionConfig = noarg_1.default.defineConfig({
|
|
10
10
|
flags: {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// Watch/Reload flags
|
|
12
|
+
'key-reload': noarg_1.default.boolean()
|
|
13
|
+
.aliases('k')
|
|
13
14
|
.default(true)
|
|
14
15
|
.description("Reload the page when pressing 'Ctrl+R' or 'F5'"),
|
|
15
16
|
watch: noarg_1.default.boolean()
|
|
16
17
|
.aliases('w')
|
|
17
18
|
.default(true)
|
|
18
|
-
.description('Watch for changes'),
|
|
19
|
-
|
|
19
|
+
.description('Watch for file changes and reload the script'),
|
|
20
|
+
exit: noarg_1.default.boolean()
|
|
20
21
|
.default(false)
|
|
21
|
-
.description('
|
|
22
|
-
clear: noarg_1.default.boolean()
|
|
23
|
-
.aliases('c')
|
|
24
|
-
.default(true)
|
|
25
|
-
.description('Clear the console before running the script'),
|
|
22
|
+
.description('Exit after code execution, disabling `watch` and `reloadKey`'),
|
|
26
23
|
delay: noarg_1.default.number()
|
|
27
24
|
.aliases('d')
|
|
28
25
|
.default(100)
|
|
@@ -31,23 +28,35 @@ exports.executionConfig = noarg_1.default.defineConfig({
|
|
|
31
28
|
.aliases('e')
|
|
32
29
|
.default([])
|
|
33
30
|
.description('Looks for changes only of the given extensions'),
|
|
31
|
+
focus: noarg_1.default.array(noarg_1.default.string())
|
|
32
|
+
.aliases('f')
|
|
33
|
+
.default([])
|
|
34
|
+
.description('Only watch the given items. `chokidar` syntax'),
|
|
34
35
|
ignore: noarg_1.default.array(noarg_1.default.string())
|
|
35
36
|
.aliases('ig')
|
|
36
37
|
.default([])
|
|
37
|
-
.description('
|
|
38
|
+
.description('Exclude the given items. `gitignore` syntax'),
|
|
39
|
+
// Benchmark flags
|
|
38
40
|
bench: noarg_1.default.boolean()
|
|
39
41
|
.aliases('b')
|
|
40
42
|
.description('Calculate the execution time'),
|
|
41
|
-
|
|
43
|
+
'bench-prefix': noarg_1.default.string()
|
|
42
44
|
.aliases('bp')
|
|
43
45
|
.minLength(1)
|
|
44
46
|
.description('The prefix to show before the execution time'),
|
|
47
|
+
clear: noarg_1.default.boolean()
|
|
48
|
+
.aliases('c')
|
|
49
|
+
.default(true)
|
|
50
|
+
.description('Clear the console before running the script'),
|
|
45
51
|
cwd: noarg_1.default.string()
|
|
46
52
|
.default(process.cwd())
|
|
47
53
|
.description('Current working directory'),
|
|
48
54
|
shell: noarg_1.default.boolean()
|
|
49
55
|
.default(false)
|
|
50
56
|
.description('Run the script in a shell for more low-level control'),
|
|
57
|
+
'safe-stdin': noarg_1.default.boolean()
|
|
58
|
+
.default(false)
|
|
59
|
+
.description('Disable raw mode for stdin (useful for some scripts)'),
|
|
51
60
|
info: noarg_1.default.boolean()
|
|
52
61
|
.default(false)
|
|
53
62
|
.description('Show information about the script'),
|
|
@@ -58,12 +67,12 @@ exports.executionConfig = noarg_1.default.defineConfig({
|
|
|
58
67
|
.default([])
|
|
59
68
|
.description('Environment variables'),
|
|
60
69
|
// Extra flags
|
|
61
|
-
|
|
70
|
+
'node-dev': noarg_1.default.boolean()
|
|
62
71
|
.default(false)
|
|
63
72
|
.description('Set NODE_ENV to "development"'),
|
|
64
73
|
tsn: noarg_1.default.boolean()
|
|
65
74
|
.default(false)
|
|
66
|
-
.description('Run the script with ts-node'),
|
|
75
|
+
.description('Run the script with ts-node (TypeScript)'),
|
|
67
76
|
},
|
|
68
77
|
listArgument: {
|
|
69
78
|
name: 'args for script',
|
|
@@ -80,14 +89,16 @@ function mapFlagsToOptions(flags, bin) {
|
|
|
80
89
|
return {
|
|
81
90
|
cwd: flags.cwd,
|
|
82
91
|
shell: flags.shell,
|
|
92
|
+
stdinSafeMode: flags['safe-stdin'],
|
|
83
93
|
showInfo: flags.info,
|
|
84
94
|
showTime: flags.time,
|
|
85
|
-
benchmark: (_a = flags.bench) !== null && _a !== void 0 ? _a : Boolean(flags
|
|
86
|
-
benchmarkPrefix: flags
|
|
95
|
+
benchmark: (_a = flags.bench) !== null && _a !== void 0 ? _a : Boolean(flags['bench-prefix']),
|
|
96
|
+
benchmarkPrefix: flags['bench-prefix'],
|
|
87
97
|
clearOnReload: flags.clear,
|
|
88
|
-
keystrokeReload: flags.
|
|
89
|
-
watch: flags.
|
|
98
|
+
keystrokeReload: flags.exit ? false : flags['key-reload'],
|
|
99
|
+
watch: flags.exit ? false : flags.watch,
|
|
90
100
|
watchDelay: flags.delay,
|
|
101
|
+
watchFocus: flags.focus.length ? flags.focus : [flags.cwd],
|
|
91
102
|
watchIgnore: flags.ignore,
|
|
92
103
|
watchExtensions: (flags.ext.length ? flags.ext : bin === null || bin === void 0 ? void 0 : bin.getRelatedExts()) || [],
|
|
93
104
|
tsNode: flags['tsn'],
|
|
@@ -95,6 +106,6 @@ function mapFlagsToOptions(flags, bin) {
|
|
|
95
106
|
const [key, value] = env.split('=');
|
|
96
107
|
acc[key] = value;
|
|
97
108
|
return acc;
|
|
98
|
-
}, {})), (flags
|
|
109
|
+
}, {})), (flags['node-dev'] ? { NODE_ENV: 'development' } : {})),
|
|
99
110
|
};
|
|
100
111
|
}
|
package/dist/arg-helper.d.cts
CHANGED
|
@@ -3,8 +3,8 @@ import type { app } from "./arg.cjs";
|
|
|
3
3
|
import Executor from "./builtin-bin/Executor.cjs";
|
|
4
4
|
export declare const executionConfig: {
|
|
5
5
|
readonly flags: {
|
|
6
|
-
readonly
|
|
7
|
-
aliases: ["
|
|
6
|
+
readonly 'key-reload': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
7
|
+
aliases: ["k"];
|
|
8
8
|
required: true;
|
|
9
9
|
default: true;
|
|
10
10
|
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
@@ -13,18 +13,12 @@ export declare const executionConfig: {
|
|
|
13
13
|
aliases: ["w"];
|
|
14
14
|
required: true;
|
|
15
15
|
default: true;
|
|
16
|
-
description: "Watch for changes";
|
|
16
|
+
description: "Watch for file changes and reload the script";
|
|
17
17
|
}>;
|
|
18
|
-
readonly
|
|
18
|
+
readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
19
19
|
required: true;
|
|
20
20
|
default: false;
|
|
21
|
-
description: "
|
|
22
|
-
}>;
|
|
23
|
-
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
24
|
-
aliases: ["c"];
|
|
25
|
-
required: true;
|
|
26
|
-
default: true;
|
|
27
|
-
description: "Clear the console before running the script";
|
|
21
|
+
description: "Exit after code execution, disabling `watch` and `reloadKey`";
|
|
28
22
|
}>;
|
|
29
23
|
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
30
24
|
aliases: ["d"];
|
|
@@ -39,22 +33,35 @@ export declare const executionConfig: {
|
|
|
39
33
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
40
34
|
description: "Looks for changes only of the given extensions";
|
|
41
35
|
}>;
|
|
36
|
+
readonly focus: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
37
|
+
aliases: ["f"];
|
|
38
|
+
required: true;
|
|
39
|
+
default: never[];
|
|
40
|
+
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
41
|
+
description: "Only watch the given items. `chokidar` syntax";
|
|
42
|
+
}>;
|
|
42
43
|
readonly ignore: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
43
44
|
aliases: ["ig"];
|
|
44
45
|
required: true;
|
|
45
46
|
default: never[];
|
|
46
47
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
47
|
-
description: "
|
|
48
|
+
description: "Exclude the given items. `gitignore` syntax";
|
|
48
49
|
}>;
|
|
49
50
|
readonly bench: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
50
51
|
aliases: ["b"];
|
|
51
52
|
description: "Calculate the execution time";
|
|
52
53
|
}>;
|
|
53
|
-
readonly
|
|
54
|
+
readonly 'bench-prefix': import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
54
55
|
aliases: ["bp"];
|
|
55
56
|
minLength: 1;
|
|
56
57
|
description: "The prefix to show before the execution time";
|
|
57
58
|
}>;
|
|
59
|
+
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
60
|
+
aliases: ["c"];
|
|
61
|
+
required: true;
|
|
62
|
+
default: true;
|
|
63
|
+
description: "Clear the console before running the script";
|
|
64
|
+
}>;
|
|
58
65
|
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
59
66
|
required: true;
|
|
60
67
|
default: string;
|
|
@@ -65,6 +72,11 @@ export declare const executionConfig: {
|
|
|
65
72
|
default: false;
|
|
66
73
|
description: "Run the script in a shell for more low-level control";
|
|
67
74
|
}>;
|
|
75
|
+
readonly 'safe-stdin': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
76
|
+
required: true;
|
|
77
|
+
default: false;
|
|
78
|
+
description: "Disable raw mode for stdin (useful for some scripts)";
|
|
79
|
+
}>;
|
|
68
80
|
readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
69
81
|
required: true;
|
|
70
82
|
default: false;
|
|
@@ -81,7 +93,7 @@ export declare const executionConfig: {
|
|
|
81
93
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
82
94
|
description: "Environment variables";
|
|
83
95
|
}>;
|
|
84
|
-
readonly
|
|
96
|
+
readonly 'node-dev': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
85
97
|
required: true;
|
|
86
98
|
default: false;
|
|
87
99
|
description: "Set NODE_ENV to \"development\"";
|
|
@@ -89,7 +101,7 @@ export declare const executionConfig: {
|
|
|
89
101
|
readonly tsn: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
90
102
|
required: true;
|
|
91
103
|
default: false;
|
|
92
|
-
description: "Run the script with ts-node";
|
|
104
|
+
description: "Run the script with ts-node (TypeScript)";
|
|
93
105
|
}>;
|
|
94
106
|
};
|
|
95
107
|
readonly listArgument: {
|
|
@@ -106,6 +118,7 @@ export type ExecuteOptions = ReturnType<typeof mapFlagsToOptions>;
|
|
|
106
118
|
export declare function mapFlagsToOptions(flags: NoArg.InferFlags<typeof app>, bin?: Executor): {
|
|
107
119
|
cwd: string;
|
|
108
120
|
shell: boolean;
|
|
121
|
+
stdinSafeMode: boolean;
|
|
109
122
|
showInfo: boolean;
|
|
110
123
|
showTime: boolean;
|
|
111
124
|
benchmark: boolean;
|
|
@@ -114,6 +127,7 @@ export declare function mapFlagsToOptions(flags: NoArg.InferFlags<typeof app>, b
|
|
|
114
127
|
keystrokeReload: boolean;
|
|
115
128
|
watch: boolean;
|
|
116
129
|
watchDelay: number;
|
|
130
|
+
watchFocus: string[];
|
|
117
131
|
watchIgnore: string[];
|
|
118
132
|
watchExtensions: string[];
|
|
119
133
|
tsNode: boolean;
|
package/dist/arg-helper.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ import type { app } from "./arg.mjs";
|
|
|
3
3
|
import Executor from "./builtin-bin/Executor.mjs";
|
|
4
4
|
export declare const executionConfig: {
|
|
5
5
|
readonly flags: {
|
|
6
|
-
readonly
|
|
7
|
-
aliases: ["
|
|
6
|
+
readonly 'key-reload': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
7
|
+
aliases: ["k"];
|
|
8
8
|
required: true;
|
|
9
9
|
default: true;
|
|
10
10
|
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
@@ -13,18 +13,12 @@ export declare const executionConfig: {
|
|
|
13
13
|
aliases: ["w"];
|
|
14
14
|
required: true;
|
|
15
15
|
default: true;
|
|
16
|
-
description: "Watch for changes";
|
|
16
|
+
description: "Watch for file changes and reload the script";
|
|
17
17
|
}>;
|
|
18
|
-
readonly
|
|
18
|
+
readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
19
19
|
required: true;
|
|
20
20
|
default: false;
|
|
21
|
-
description: "
|
|
22
|
-
}>;
|
|
23
|
-
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
24
|
-
aliases: ["c"];
|
|
25
|
-
required: true;
|
|
26
|
-
default: true;
|
|
27
|
-
description: "Clear the console before running the script";
|
|
21
|
+
description: "Exit after code execution, disabling `watch` and `reloadKey`";
|
|
28
22
|
}>;
|
|
29
23
|
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
30
24
|
aliases: ["d"];
|
|
@@ -39,22 +33,35 @@ export declare const executionConfig: {
|
|
|
39
33
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
40
34
|
description: "Looks for changes only of the given extensions";
|
|
41
35
|
}>;
|
|
36
|
+
readonly focus: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
37
|
+
aliases: ["f"];
|
|
38
|
+
required: true;
|
|
39
|
+
default: never[];
|
|
40
|
+
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
41
|
+
description: "Only watch the given items. `chokidar` syntax";
|
|
42
|
+
}>;
|
|
42
43
|
readonly ignore: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
43
44
|
aliases: ["ig"];
|
|
44
45
|
required: true;
|
|
45
46
|
default: never[];
|
|
46
47
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
47
|
-
description: "
|
|
48
|
+
description: "Exclude the given items. `gitignore` syntax";
|
|
48
49
|
}>;
|
|
49
50
|
readonly bench: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
50
51
|
aliases: ["b"];
|
|
51
52
|
description: "Calculate the execution time";
|
|
52
53
|
}>;
|
|
53
|
-
readonly
|
|
54
|
+
readonly 'bench-prefix': import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
54
55
|
aliases: ["bp"];
|
|
55
56
|
minLength: 1;
|
|
56
57
|
description: "The prefix to show before the execution time";
|
|
57
58
|
}>;
|
|
59
|
+
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
60
|
+
aliases: ["c"];
|
|
61
|
+
required: true;
|
|
62
|
+
default: true;
|
|
63
|
+
description: "Clear the console before running the script";
|
|
64
|
+
}>;
|
|
58
65
|
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
59
66
|
required: true;
|
|
60
67
|
default: string;
|
|
@@ -65,6 +72,11 @@ export declare const executionConfig: {
|
|
|
65
72
|
default: false;
|
|
66
73
|
description: "Run the script in a shell for more low-level control";
|
|
67
74
|
}>;
|
|
75
|
+
readonly 'safe-stdin': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
76
|
+
required: true;
|
|
77
|
+
default: false;
|
|
78
|
+
description: "Disable raw mode for stdin (useful for some scripts)";
|
|
79
|
+
}>;
|
|
68
80
|
readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
69
81
|
required: true;
|
|
70
82
|
default: false;
|
|
@@ -81,7 +93,7 @@ export declare const executionConfig: {
|
|
|
81
93
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
82
94
|
description: "Environment variables";
|
|
83
95
|
}>;
|
|
84
|
-
readonly
|
|
96
|
+
readonly 'node-dev': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
85
97
|
required: true;
|
|
86
98
|
default: false;
|
|
87
99
|
description: "Set NODE_ENV to \"development\"";
|
|
@@ -89,7 +101,7 @@ export declare const executionConfig: {
|
|
|
89
101
|
readonly tsn: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
90
102
|
required: true;
|
|
91
103
|
default: false;
|
|
92
|
-
description: "Run the script with ts-node";
|
|
104
|
+
description: "Run the script with ts-node (TypeScript)";
|
|
93
105
|
}>;
|
|
94
106
|
};
|
|
95
107
|
readonly listArgument: {
|
|
@@ -106,6 +118,7 @@ export type ExecuteOptions = ReturnType<typeof mapFlagsToOptions>;
|
|
|
106
118
|
export declare function mapFlagsToOptions(flags: NoArg.InferFlags<typeof app>, bin?: Executor): {
|
|
107
119
|
cwd: string;
|
|
108
120
|
shell: boolean;
|
|
121
|
+
stdinSafeMode: boolean;
|
|
109
122
|
showInfo: boolean;
|
|
110
123
|
showTime: boolean;
|
|
111
124
|
benchmark: boolean;
|
|
@@ -114,6 +127,7 @@ export declare function mapFlagsToOptions(flags: NoArg.InferFlags<typeof app>, b
|
|
|
114
127
|
keystrokeReload: boolean;
|
|
115
128
|
watch: boolean;
|
|
116
129
|
watchDelay: number;
|
|
130
|
+
watchFocus: string[];
|
|
117
131
|
watchIgnore: string[];
|
|
118
132
|
watchExtensions: string[];
|
|
119
133
|
tsNode: boolean;
|
package/dist/arg-helper.mjs
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import NoArg from "noarg";
|
|
2
2
|
export const executionConfig = NoArg.defineConfig({
|
|
3
3
|
flags: {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
// Watch/Reload flags
|
|
5
|
+
'key-reload': NoArg.boolean()
|
|
6
|
+
.aliases('k')
|
|
6
7
|
.default(true)
|
|
7
8
|
.description("Reload the page when pressing 'Ctrl+R' or 'F5'"),
|
|
8
9
|
watch: NoArg.boolean()
|
|
9
10
|
.aliases('w')
|
|
10
11
|
.default(true)
|
|
11
|
-
.description('Watch for changes'),
|
|
12
|
-
|
|
12
|
+
.description('Watch for file changes and reload the script'),
|
|
13
|
+
exit: NoArg.boolean()
|
|
13
14
|
.default(false)
|
|
14
|
-
.description('
|
|
15
|
-
clear: NoArg.boolean()
|
|
16
|
-
.aliases('c')
|
|
17
|
-
.default(true)
|
|
18
|
-
.description('Clear the console before running the script'),
|
|
15
|
+
.description('Exit after code execution, disabling `watch` and `reloadKey`'),
|
|
19
16
|
delay: NoArg.number()
|
|
20
17
|
.aliases('d')
|
|
21
18
|
.default(100)
|
|
@@ -24,23 +21,35 @@ export const executionConfig = NoArg.defineConfig({
|
|
|
24
21
|
.aliases('e')
|
|
25
22
|
.default([])
|
|
26
23
|
.description('Looks for changes only of the given extensions'),
|
|
24
|
+
focus: NoArg.array(NoArg.string())
|
|
25
|
+
.aliases('f')
|
|
26
|
+
.default([])
|
|
27
|
+
.description('Only watch the given items. `chokidar` syntax'),
|
|
27
28
|
ignore: NoArg.array(NoArg.string())
|
|
28
29
|
.aliases('ig')
|
|
29
30
|
.default([])
|
|
30
|
-
.description('
|
|
31
|
+
.description('Exclude the given items. `gitignore` syntax'),
|
|
32
|
+
// Benchmark flags
|
|
31
33
|
bench: NoArg.boolean()
|
|
32
34
|
.aliases('b')
|
|
33
35
|
.description('Calculate the execution time'),
|
|
34
|
-
|
|
36
|
+
'bench-prefix': NoArg.string()
|
|
35
37
|
.aliases('bp')
|
|
36
38
|
.minLength(1)
|
|
37
39
|
.description('The prefix to show before the execution time'),
|
|
40
|
+
clear: NoArg.boolean()
|
|
41
|
+
.aliases('c')
|
|
42
|
+
.default(true)
|
|
43
|
+
.description('Clear the console before running the script'),
|
|
38
44
|
cwd: NoArg.string()
|
|
39
45
|
.default(process.cwd())
|
|
40
46
|
.description('Current working directory'),
|
|
41
47
|
shell: NoArg.boolean()
|
|
42
48
|
.default(false)
|
|
43
49
|
.description('Run the script in a shell for more low-level control'),
|
|
50
|
+
'safe-stdin': NoArg.boolean()
|
|
51
|
+
.default(false)
|
|
52
|
+
.description('Disable raw mode for stdin (useful for some scripts)'),
|
|
44
53
|
info: NoArg.boolean()
|
|
45
54
|
.default(false)
|
|
46
55
|
.description('Show information about the script'),
|
|
@@ -51,12 +60,12 @@ export const executionConfig = NoArg.defineConfig({
|
|
|
51
60
|
.default([])
|
|
52
61
|
.description('Environment variables'),
|
|
53
62
|
// Extra flags
|
|
54
|
-
|
|
63
|
+
'node-dev': NoArg.boolean()
|
|
55
64
|
.default(false)
|
|
56
65
|
.description('Set NODE_ENV to "development"'),
|
|
57
66
|
tsn: NoArg.boolean()
|
|
58
67
|
.default(false)
|
|
59
|
-
.description('Run the script with ts-node'),
|
|
68
|
+
.description('Run the script with ts-node (TypeScript)'),
|
|
60
69
|
},
|
|
61
70
|
listArgument: {
|
|
62
71
|
name: 'args for script',
|
|
@@ -73,14 +82,16 @@ export function mapFlagsToOptions(flags, bin) {
|
|
|
73
82
|
return {
|
|
74
83
|
cwd: flags.cwd,
|
|
75
84
|
shell: flags.shell,
|
|
85
|
+
stdinSafeMode: flags['safe-stdin'],
|
|
76
86
|
showInfo: flags.info,
|
|
77
87
|
showTime: flags.time,
|
|
78
|
-
benchmark: (_a = flags.bench) !== null && _a !== void 0 ? _a : Boolean(flags
|
|
79
|
-
benchmarkPrefix: flags
|
|
88
|
+
benchmark: (_a = flags.bench) !== null && _a !== void 0 ? _a : Boolean(flags['bench-prefix']),
|
|
89
|
+
benchmarkPrefix: flags['bench-prefix'],
|
|
80
90
|
clearOnReload: flags.clear,
|
|
81
|
-
keystrokeReload: flags.
|
|
82
|
-
watch: flags.
|
|
91
|
+
keystrokeReload: flags.exit ? false : flags['key-reload'],
|
|
92
|
+
watch: flags.exit ? false : flags.watch,
|
|
83
93
|
watchDelay: flags.delay,
|
|
94
|
+
watchFocus: flags.focus.length ? flags.focus : [flags.cwd],
|
|
84
95
|
watchIgnore: flags.ignore,
|
|
85
96
|
watchExtensions: (flags.ext.length ? flags.ext : bin === null || bin === void 0 ? void 0 : bin.getRelatedExts()) || [],
|
|
86
97
|
tsNode: flags['tsn'],
|
|
@@ -88,6 +99,6 @@ export function mapFlagsToOptions(flags, bin) {
|
|
|
88
99
|
const [key, value] = env.split('=');
|
|
89
100
|
acc[key] = value;
|
|
90
101
|
return acc;
|
|
91
|
-
}, {})), (flags
|
|
102
|
+
}, {})), (flags['node-dev'] ? { NODE_ENV: 'development' } : {})),
|
|
92
103
|
};
|
|
93
104
|
}
|
package/dist/arg.d.cts
CHANGED
|
@@ -22,8 +22,8 @@ export declare const app: NoArg<"uni-run", {
|
|
|
22
22
|
};
|
|
23
23
|
readonly trailingArguments: "--";
|
|
24
24
|
readonly flags: {
|
|
25
|
-
readonly
|
|
26
|
-
aliases: ["
|
|
25
|
+
readonly 'key-reload': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
26
|
+
aliases: ["k"];
|
|
27
27
|
required: true;
|
|
28
28
|
default: true;
|
|
29
29
|
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
@@ -32,18 +32,12 @@ export declare const app: NoArg<"uni-run", {
|
|
|
32
32
|
aliases: ["w"];
|
|
33
33
|
required: true;
|
|
34
34
|
default: true;
|
|
35
|
-
description: "Watch for changes";
|
|
35
|
+
description: "Watch for file changes and reload the script";
|
|
36
36
|
}>;
|
|
37
|
-
readonly
|
|
37
|
+
readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
38
38
|
required: true;
|
|
39
39
|
default: false;
|
|
40
|
-
description: "
|
|
41
|
-
}>;
|
|
42
|
-
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
43
|
-
aliases: ["c"];
|
|
44
|
-
required: true;
|
|
45
|
-
default: true;
|
|
46
|
-
description: "Clear the console before running the script";
|
|
40
|
+
description: "Exit after code execution, disabling `watch` and `reloadKey`";
|
|
47
41
|
}>;
|
|
48
42
|
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
49
43
|
aliases: ["d"];
|
|
@@ -58,22 +52,35 @@ export declare const app: NoArg<"uni-run", {
|
|
|
58
52
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
59
53
|
description: "Looks for changes only of the given extensions";
|
|
60
54
|
}>;
|
|
55
|
+
readonly focus: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
56
|
+
aliases: ["f"];
|
|
57
|
+
required: true;
|
|
58
|
+
default: never[];
|
|
59
|
+
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
60
|
+
description: "Only watch the given items. `chokidar` syntax";
|
|
61
|
+
}>;
|
|
61
62
|
readonly ignore: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
62
63
|
aliases: ["ig"];
|
|
63
64
|
required: true;
|
|
64
65
|
default: never[];
|
|
65
66
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
66
|
-
description: "
|
|
67
|
+
description: "Exclude the given items. `gitignore` syntax";
|
|
67
68
|
}>;
|
|
68
69
|
readonly bench: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
69
70
|
aliases: ["b"];
|
|
70
71
|
description: "Calculate the execution time";
|
|
71
72
|
}>;
|
|
72
|
-
readonly
|
|
73
|
+
readonly 'bench-prefix': import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
73
74
|
aliases: ["bp"];
|
|
74
75
|
minLength: 1;
|
|
75
76
|
description: "The prefix to show before the execution time";
|
|
76
77
|
}>;
|
|
78
|
+
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
79
|
+
aliases: ["c"];
|
|
80
|
+
required: true;
|
|
81
|
+
default: true;
|
|
82
|
+
description: "Clear the console before running the script";
|
|
83
|
+
}>;
|
|
77
84
|
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
78
85
|
required: true;
|
|
79
86
|
default: string;
|
|
@@ -84,6 +91,11 @@ export declare const app: NoArg<"uni-run", {
|
|
|
84
91
|
default: false;
|
|
85
92
|
description: "Run the script in a shell for more low-level control";
|
|
86
93
|
}>;
|
|
94
|
+
readonly 'safe-stdin': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
95
|
+
required: true;
|
|
96
|
+
default: false;
|
|
97
|
+
description: "Disable raw mode for stdin (useful for some scripts)";
|
|
98
|
+
}>;
|
|
87
99
|
readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
88
100
|
required: true;
|
|
89
101
|
default: false;
|
|
@@ -100,7 +112,7 @@ export declare const app: NoArg<"uni-run", {
|
|
|
100
112
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
101
113
|
description: "Environment variables";
|
|
102
114
|
}>;
|
|
103
|
-
readonly
|
|
115
|
+
readonly 'node-dev': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
104
116
|
required: true;
|
|
105
117
|
default: false;
|
|
106
118
|
description: "Set NODE_ENV to \"development\"";
|
|
@@ -108,7 +120,7 @@ export declare const app: NoArg<"uni-run", {
|
|
|
108
120
|
readonly tsn: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
109
121
|
required: true;
|
|
110
122
|
default: false;
|
|
111
|
-
description: "Run the script with ts-node";
|
|
123
|
+
description: "Run the script with ts-node (TypeScript)";
|
|
112
124
|
}>;
|
|
113
125
|
};
|
|
114
126
|
readonly customRenderHelp: {
|
|
@@ -133,8 +145,8 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
133
145
|
};
|
|
134
146
|
readonly trailingArguments: "--";
|
|
135
147
|
readonly flags: {
|
|
136
|
-
readonly
|
|
137
|
-
aliases: ["
|
|
148
|
+
readonly 'key-reload': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
149
|
+
aliases: ["k"];
|
|
138
150
|
required: true;
|
|
139
151
|
default: true;
|
|
140
152
|
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
@@ -143,18 +155,12 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
143
155
|
aliases: ["w"];
|
|
144
156
|
required: true;
|
|
145
157
|
default: true;
|
|
146
|
-
description: "Watch for changes";
|
|
158
|
+
description: "Watch for file changes and reload the script";
|
|
147
159
|
}>;
|
|
148
|
-
readonly
|
|
160
|
+
readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
149
161
|
required: true;
|
|
150
162
|
default: false;
|
|
151
|
-
description: "
|
|
152
|
-
}>;
|
|
153
|
-
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
154
|
-
aliases: ["c"];
|
|
155
|
-
required: true;
|
|
156
|
-
default: true;
|
|
157
|
-
description: "Clear the console before running the script";
|
|
163
|
+
description: "Exit after code execution, disabling `watch` and `reloadKey`";
|
|
158
164
|
}>;
|
|
159
165
|
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
160
166
|
aliases: ["d"];
|
|
@@ -169,22 +175,35 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
169
175
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
170
176
|
description: "Looks for changes only of the given extensions";
|
|
171
177
|
}>;
|
|
178
|
+
readonly focus: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
179
|
+
aliases: ["f"];
|
|
180
|
+
required: true;
|
|
181
|
+
default: never[];
|
|
182
|
+
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
183
|
+
description: "Only watch the given items. `chokidar` syntax";
|
|
184
|
+
}>;
|
|
172
185
|
readonly ignore: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
173
186
|
aliases: ["ig"];
|
|
174
187
|
required: true;
|
|
175
188
|
default: never[];
|
|
176
189
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
177
|
-
description: "
|
|
190
|
+
description: "Exclude the given items. `gitignore` syntax";
|
|
178
191
|
}>;
|
|
179
192
|
readonly bench: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
180
193
|
aliases: ["b"];
|
|
181
194
|
description: "Calculate the execution time";
|
|
182
195
|
}>;
|
|
183
|
-
readonly
|
|
196
|
+
readonly 'bench-prefix': import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
184
197
|
aliases: ["bp"];
|
|
185
198
|
minLength: 1;
|
|
186
199
|
description: "The prefix to show before the execution time";
|
|
187
200
|
}>;
|
|
201
|
+
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
202
|
+
aliases: ["c"];
|
|
203
|
+
required: true;
|
|
204
|
+
default: true;
|
|
205
|
+
description: "Clear the console before running the script";
|
|
206
|
+
}>;
|
|
188
207
|
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
189
208
|
required: true;
|
|
190
209
|
default: string;
|
|
@@ -195,6 +214,11 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
195
214
|
default: false;
|
|
196
215
|
description: "Run the script in a shell for more low-level control";
|
|
197
216
|
}>;
|
|
217
|
+
readonly 'safe-stdin': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
218
|
+
required: true;
|
|
219
|
+
default: false;
|
|
220
|
+
description: "Disable raw mode for stdin (useful for some scripts)";
|
|
221
|
+
}>;
|
|
198
222
|
readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
199
223
|
required: true;
|
|
200
224
|
default: false;
|
|
@@ -211,7 +235,7 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
211
235
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
212
236
|
description: "Environment variables";
|
|
213
237
|
}>;
|
|
214
|
-
readonly
|
|
238
|
+
readonly 'node-dev': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
215
239
|
required: true;
|
|
216
240
|
default: false;
|
|
217
241
|
description: "Set NODE_ENV to \"development\"";
|
|
@@ -219,7 +243,7 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
219
243
|
readonly tsn: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
220
244
|
required: true;
|
|
221
245
|
default: false;
|
|
222
|
-
description: "Run the script with ts-node";
|
|
246
|
+
description: "Run the script with ts-node (TypeScript)";
|
|
223
247
|
}>;
|
|
224
248
|
};
|
|
225
249
|
readonly customRenderHelp: {
|