uni-run 1.1.9 → 1.1.11
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/app.js +8 -13
- package/dist/arg.d.ts +62 -120
- package/dist/argHelper.d.ts +32 -62
- package/dist/argHelper.js +46 -63
- package/dist/execution/index.d.ts +2 -0
- package/dist/execution/index.js +12 -5
- package/dist/scriptExecutors/index.js +3 -6
- package/package.json +2 -2
package/dist/app.js
CHANGED
|
@@ -46,11 +46,6 @@ const getUserExecutors_1 = __importDefault(require("./helpers/getUserExecutors")
|
|
|
46
46
|
const helpers_1 = require("./scriptExecutors/helpers");
|
|
47
47
|
arg.app.on((_a, flags_1) => __awaiter(void 0, [_a, flags_1], void 0, function* ([script, listArs, trailingArgs], flags) {
|
|
48
48
|
var _b;
|
|
49
|
-
if (process.env.NODE_ENV_UNI_RUN === 'LAB') {
|
|
50
|
-
flags.clear = false;
|
|
51
|
-
flags['safe-stdin'] = true;
|
|
52
|
-
flags['key-reload'] = false;
|
|
53
|
-
}
|
|
54
49
|
const executionConfig = (0, getConfig_1.default)(flags.cwd);
|
|
55
50
|
const userExecutors = (0, getUserExecutors_1.default)(flags.cwd);
|
|
56
51
|
const totalExecutors = [
|
|
@@ -75,15 +70,15 @@ arg.exec.on(([listArs, trailingArgs], flags) => {
|
|
|
75
70
|
new execution_1.default((0, argHelper_1.mapFlagsToOptions)(flags), [...listArs, ...trailingArgs]).start();
|
|
76
71
|
});
|
|
77
72
|
arg.list.on(() => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
var _a;
|
|
74
|
+
function printExecutorsFactory(clrFn, executors) {
|
|
75
|
+
executors.forEach(({ name, exts }) => {
|
|
76
|
+
console.log(`- ${clrFn(name)}`, `[${exts.map((e) => '.' + colors_1.default.green(e)).join(', ')}]`);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
83
79
|
console.log(colors_1.default.bold('Supported scripts:'));
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
80
|
+
printExecutorsFactory(colors_1.default.cyan, (_a = (0, getUserExecutors_1.default)()) !== null && _a !== void 0 ? _a : []);
|
|
81
|
+
printExecutorsFactory(colors_1.default.blue, scriptExecutors_1.default);
|
|
87
82
|
});
|
|
88
83
|
arg.clean.on(() => {
|
|
89
84
|
console.log(colors_1.default.bgGreen('CACHE:'), (0, helpers_1.getCacheDir)());
|
package/dist/arg.d.ts
CHANGED
|
@@ -22,50 +22,51 @@ export declare const app: NoArg<"uni-run", {
|
|
|
22
22
|
};
|
|
23
23
|
readonly trailingArguments: "--";
|
|
24
24
|
readonly flags: {
|
|
25
|
-
readonly '
|
|
26
|
-
aliases: ["
|
|
27
|
-
required: true;
|
|
28
|
-
default: true;
|
|
29
|
-
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
30
|
-
}>;
|
|
31
|
-
readonly watch: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
32
|
-
aliases: ["w"];
|
|
33
|
-
required: true;
|
|
34
|
-
default: true;
|
|
25
|
+
readonly 'do-not-watch': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
26
|
+
aliases: ["dw"];
|
|
35
27
|
description: "Watch for file changes and reload the script";
|
|
36
28
|
}>;
|
|
29
|
+
readonly 'disable-reload-key': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
30
|
+
aliases: ["dk"];
|
|
31
|
+
description: "Disable 'Ctrl+R' or 'F5' to reload the script";
|
|
32
|
+
}>;
|
|
33
|
+
readonly 'disable-raw-stdin': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
34
|
+
aliases: ["drs"];
|
|
35
|
+
description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
|
|
36
|
+
}>;
|
|
37
37
|
readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
description: "Exit after code execution, disabling `watch` and `reloadKey`";
|
|
38
|
+
aliases: ["x"];
|
|
39
|
+
description: "Exit the script after the first execution";
|
|
41
40
|
}>;
|
|
42
|
-
readonly
|
|
43
|
-
aliases: ["
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
readonly quiet: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
42
|
+
aliases: ["q"];
|
|
43
|
+
description: "Do not show any output of the script";
|
|
44
|
+
}>;
|
|
45
|
+
readonly keep: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
46
|
+
aliases: ["k"];
|
|
47
|
+
description: "Do not clear the console while starting the script";
|
|
47
48
|
}>;
|
|
48
49
|
readonly ext: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
49
50
|
aliases: ["e"];
|
|
50
|
-
required: true;
|
|
51
|
-
default: never[];
|
|
52
51
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
53
52
|
description: "Looks for changes only of the given extensions";
|
|
54
53
|
}>;
|
|
55
54
|
readonly focus: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
56
55
|
aliases: ["f"];
|
|
57
|
-
required: true;
|
|
58
|
-
default: never[];
|
|
59
56
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
60
57
|
description: "Only watch the given items. `chokidar` syntax";
|
|
61
58
|
}>;
|
|
62
59
|
readonly ignore: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
63
60
|
aliases: ["ig"];
|
|
64
|
-
required: true;
|
|
65
|
-
default: never[];
|
|
66
61
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
67
62
|
description: "Exclude the given items. `gitignore` syntax";
|
|
68
63
|
}>;
|
|
64
|
+
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
65
|
+
aliases: ["d"];
|
|
66
|
+
required: true;
|
|
67
|
+
default: 100;
|
|
68
|
+
description: "The delay to wait for the watcher to trigger";
|
|
69
|
+
}>;
|
|
69
70
|
readonly bench: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
70
71
|
aliases: ["b"];
|
|
71
72
|
description: "Calculate the execution time";
|
|
@@ -75,57 +76,27 @@ export declare const app: NoArg<"uni-run", {
|
|
|
75
76
|
minLength: 1;
|
|
76
77
|
description: "The prefix to show before the execution time";
|
|
77
78
|
}>;
|
|
78
|
-
readonly
|
|
79
|
-
aliases: ["
|
|
80
|
-
|
|
81
|
-
default: true;
|
|
82
|
-
description: "Clear the console before running the script";
|
|
83
|
-
}>;
|
|
84
|
-
readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
85
|
-
required: true;
|
|
86
|
-
default: false;
|
|
87
|
-
description: "Do not show any output of the script";
|
|
79
|
+
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
80
|
+
aliases: ["sh"];
|
|
81
|
+
description: "Run the script in a shell for more low-level control.";
|
|
88
82
|
}>;
|
|
89
83
|
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
90
84
|
required: true;
|
|
91
85
|
default: string;
|
|
92
|
-
description: "
|
|
93
|
-
}>;
|
|
94
|
-
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
95
|
-
required: true;
|
|
96
|
-
default: false;
|
|
97
|
-
description: "Run the script in a shell for more low-level control";
|
|
98
|
-
}>;
|
|
99
|
-
readonly 'safe-stdin': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
100
|
-
required: true;
|
|
101
|
-
default: false;
|
|
102
|
-
description: "Disable raw mode for stdin (useful for some scripts)";
|
|
86
|
+
description: "Set the current working directory";
|
|
103
87
|
}>;
|
|
104
88
|
readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
105
|
-
required: true;
|
|
106
|
-
default: false;
|
|
107
89
|
description: "Show information about the script";
|
|
108
90
|
}>;
|
|
109
91
|
readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
110
|
-
required: true;
|
|
111
|
-
default: false;
|
|
112
92
|
description: "Show the execution time at the start";
|
|
113
93
|
}>;
|
|
114
94
|
readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
115
|
-
required: true;
|
|
116
|
-
default: never[];
|
|
117
95
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
118
|
-
description: "
|
|
96
|
+
description: "Set environment variables";
|
|
119
97
|
}>;
|
|
120
98
|
readonly 'node-dev': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
121
|
-
|
|
122
|
-
default: false;
|
|
123
|
-
description: "Set NODE_ENV to \"development\"";
|
|
124
|
-
}>;
|
|
125
|
-
readonly tsn: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
126
|
-
required: true;
|
|
127
|
-
default: false;
|
|
128
|
-
description: "Run the script with ts-node (TypeScript)";
|
|
99
|
+
description: "Set env.NODE_ENV to \"development\"";
|
|
129
100
|
}>;
|
|
130
101
|
};
|
|
131
102
|
readonly customRenderHelp: {
|
|
@@ -150,50 +121,51 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
150
121
|
};
|
|
151
122
|
readonly trailingArguments: "--";
|
|
152
123
|
readonly flags: {
|
|
153
|
-
readonly '
|
|
154
|
-
aliases: ["
|
|
155
|
-
required: true;
|
|
156
|
-
default: true;
|
|
157
|
-
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
158
|
-
}>;
|
|
159
|
-
readonly watch: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
160
|
-
aliases: ["w"];
|
|
161
|
-
required: true;
|
|
162
|
-
default: true;
|
|
124
|
+
readonly 'do-not-watch': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
125
|
+
aliases: ["dw"];
|
|
163
126
|
description: "Watch for file changes and reload the script";
|
|
164
127
|
}>;
|
|
128
|
+
readonly 'disable-reload-key': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
129
|
+
aliases: ["dk"];
|
|
130
|
+
description: "Disable 'Ctrl+R' or 'F5' to reload the script";
|
|
131
|
+
}>;
|
|
132
|
+
readonly 'disable-raw-stdin': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
133
|
+
aliases: ["drs"];
|
|
134
|
+
description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
|
|
135
|
+
}>;
|
|
165
136
|
readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
description: "Exit after code execution, disabling `watch` and `reloadKey`";
|
|
137
|
+
aliases: ["x"];
|
|
138
|
+
description: "Exit the script after the first execution";
|
|
169
139
|
}>;
|
|
170
|
-
readonly
|
|
171
|
-
aliases: ["
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
140
|
+
readonly quiet: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
141
|
+
aliases: ["q"];
|
|
142
|
+
description: "Do not show any output of the script";
|
|
143
|
+
}>;
|
|
144
|
+
readonly keep: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
145
|
+
aliases: ["k"];
|
|
146
|
+
description: "Do not clear the console while starting the script";
|
|
175
147
|
}>;
|
|
176
148
|
readonly ext: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
177
149
|
aliases: ["e"];
|
|
178
|
-
required: true;
|
|
179
|
-
default: never[];
|
|
180
150
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
181
151
|
description: "Looks for changes only of the given extensions";
|
|
182
152
|
}>;
|
|
183
153
|
readonly focus: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
184
154
|
aliases: ["f"];
|
|
185
|
-
required: true;
|
|
186
|
-
default: never[];
|
|
187
155
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
188
156
|
description: "Only watch the given items. `chokidar` syntax";
|
|
189
157
|
}>;
|
|
190
158
|
readonly ignore: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
191
159
|
aliases: ["ig"];
|
|
192
|
-
required: true;
|
|
193
|
-
default: never[];
|
|
194
160
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
195
161
|
description: "Exclude the given items. `gitignore` syntax";
|
|
196
162
|
}>;
|
|
163
|
+
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
164
|
+
aliases: ["d"];
|
|
165
|
+
required: true;
|
|
166
|
+
default: 100;
|
|
167
|
+
description: "The delay to wait for the watcher to trigger";
|
|
168
|
+
}>;
|
|
197
169
|
readonly bench: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
198
170
|
aliases: ["b"];
|
|
199
171
|
description: "Calculate the execution time";
|
|
@@ -203,57 +175,27 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
203
175
|
minLength: 1;
|
|
204
176
|
description: "The prefix to show before the execution time";
|
|
205
177
|
}>;
|
|
206
|
-
readonly
|
|
207
|
-
aliases: ["
|
|
208
|
-
|
|
209
|
-
default: true;
|
|
210
|
-
description: "Clear the console before running the script";
|
|
211
|
-
}>;
|
|
212
|
-
readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
213
|
-
required: true;
|
|
214
|
-
default: false;
|
|
215
|
-
description: "Do not show any output of the script";
|
|
178
|
+
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
179
|
+
aliases: ["sh"];
|
|
180
|
+
description: "Run the script in a shell for more low-level control.";
|
|
216
181
|
}>;
|
|
217
182
|
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
218
183
|
required: true;
|
|
219
184
|
default: string;
|
|
220
|
-
description: "
|
|
221
|
-
}>;
|
|
222
|
-
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
223
|
-
required: true;
|
|
224
|
-
default: false;
|
|
225
|
-
description: "Run the script in a shell for more low-level control";
|
|
226
|
-
}>;
|
|
227
|
-
readonly 'safe-stdin': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
228
|
-
required: true;
|
|
229
|
-
default: false;
|
|
230
|
-
description: "Disable raw mode for stdin (useful for some scripts)";
|
|
185
|
+
description: "Set the current working directory";
|
|
231
186
|
}>;
|
|
232
187
|
readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
233
|
-
required: true;
|
|
234
|
-
default: false;
|
|
235
188
|
description: "Show information about the script";
|
|
236
189
|
}>;
|
|
237
190
|
readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
238
|
-
required: true;
|
|
239
|
-
default: false;
|
|
240
191
|
description: "Show the execution time at the start";
|
|
241
192
|
}>;
|
|
242
193
|
readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
243
|
-
required: true;
|
|
244
|
-
default: never[];
|
|
245
194
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
246
|
-
description: "
|
|
195
|
+
description: "Set environment variables";
|
|
247
196
|
}>;
|
|
248
197
|
readonly 'node-dev': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
249
|
-
|
|
250
|
-
default: false;
|
|
251
|
-
description: "Set NODE_ENV to \"development\"";
|
|
252
|
-
}>;
|
|
253
|
-
readonly tsn: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
254
|
-
required: true;
|
|
255
|
-
default: false;
|
|
256
|
-
description: "Run the script with ts-node (TypeScript)";
|
|
198
|
+
description: "Set env.NODE_ENV to \"development\"";
|
|
257
199
|
}>;
|
|
258
200
|
};
|
|
259
201
|
readonly customRenderHelp: {
|
package/dist/argHelper.d.ts
CHANGED
|
@@ -2,50 +2,51 @@ import NoArg from 'noarg';
|
|
|
2
2
|
import type { app } from './arg';
|
|
3
3
|
export declare const executionConfig: {
|
|
4
4
|
readonly flags: {
|
|
5
|
-
readonly '
|
|
6
|
-
aliases: ["
|
|
7
|
-
required: true;
|
|
8
|
-
default: true;
|
|
9
|
-
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
10
|
-
}>;
|
|
11
|
-
readonly watch: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
12
|
-
aliases: ["w"];
|
|
13
|
-
required: true;
|
|
14
|
-
default: true;
|
|
5
|
+
readonly 'do-not-watch': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
6
|
+
aliases: ["dw"];
|
|
15
7
|
description: "Watch for file changes and reload the script";
|
|
16
8
|
}>;
|
|
9
|
+
readonly 'disable-reload-key': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
10
|
+
aliases: ["dk"];
|
|
11
|
+
description: "Disable 'Ctrl+R' or 'F5' to reload the script";
|
|
12
|
+
}>;
|
|
13
|
+
readonly 'disable-raw-stdin': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
14
|
+
aliases: ["drs"];
|
|
15
|
+
description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
|
|
16
|
+
}>;
|
|
17
17
|
readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
description: "Exit after code execution, disabling `watch` and `reloadKey`";
|
|
18
|
+
aliases: ["x"];
|
|
19
|
+
description: "Exit the script after the first execution";
|
|
21
20
|
}>;
|
|
22
|
-
readonly
|
|
23
|
-
aliases: ["
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
readonly quiet: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
22
|
+
aliases: ["q"];
|
|
23
|
+
description: "Do not show any output of the script";
|
|
24
|
+
}>;
|
|
25
|
+
readonly keep: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
26
|
+
aliases: ["k"];
|
|
27
|
+
description: "Do not clear the console while starting the script";
|
|
27
28
|
}>;
|
|
28
29
|
readonly ext: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
29
30
|
aliases: ["e"];
|
|
30
|
-
required: true;
|
|
31
|
-
default: never[];
|
|
32
31
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
33
32
|
description: "Looks for changes only of the given extensions";
|
|
34
33
|
}>;
|
|
35
34
|
readonly focus: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
36
35
|
aliases: ["f"];
|
|
37
|
-
required: true;
|
|
38
|
-
default: never[];
|
|
39
36
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
40
37
|
description: "Only watch the given items. `chokidar` syntax";
|
|
41
38
|
}>;
|
|
42
39
|
readonly ignore: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
43
40
|
aliases: ["ig"];
|
|
44
|
-
required: true;
|
|
45
|
-
default: never[];
|
|
46
41
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
47
42
|
description: "Exclude the given items. `gitignore` syntax";
|
|
48
43
|
}>;
|
|
44
|
+
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
45
|
+
aliases: ["d"];
|
|
46
|
+
required: true;
|
|
47
|
+
default: 100;
|
|
48
|
+
description: "The delay to wait for the watcher to trigger";
|
|
49
|
+
}>;
|
|
49
50
|
readonly bench: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
50
51
|
aliases: ["b"];
|
|
51
52
|
description: "Calculate the execution time";
|
|
@@ -55,57 +56,27 @@ export declare const executionConfig: {
|
|
|
55
56
|
minLength: 1;
|
|
56
57
|
description: "The prefix to show before the execution time";
|
|
57
58
|
}>;
|
|
58
|
-
readonly
|
|
59
|
-
aliases: ["
|
|
60
|
-
|
|
61
|
-
default: true;
|
|
62
|
-
description: "Clear the console before running the script";
|
|
63
|
-
}>;
|
|
64
|
-
readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
65
|
-
required: true;
|
|
66
|
-
default: false;
|
|
67
|
-
description: "Do not show any output of the script";
|
|
59
|
+
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
60
|
+
aliases: ["sh"];
|
|
61
|
+
description: "Run the script in a shell for more low-level control.";
|
|
68
62
|
}>;
|
|
69
63
|
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
70
64
|
required: true;
|
|
71
65
|
default: string;
|
|
72
|
-
description: "
|
|
73
|
-
}>;
|
|
74
|
-
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
75
|
-
required: true;
|
|
76
|
-
default: false;
|
|
77
|
-
description: "Run the script in a shell for more low-level control";
|
|
78
|
-
}>;
|
|
79
|
-
readonly 'safe-stdin': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
80
|
-
required: true;
|
|
81
|
-
default: false;
|
|
82
|
-
description: "Disable raw mode for stdin (useful for some scripts)";
|
|
66
|
+
description: "Set the current working directory";
|
|
83
67
|
}>;
|
|
84
68
|
readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
85
|
-
required: true;
|
|
86
|
-
default: false;
|
|
87
69
|
description: "Show information about the script";
|
|
88
70
|
}>;
|
|
89
71
|
readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
90
|
-
required: true;
|
|
91
|
-
default: false;
|
|
92
72
|
description: "Show the execution time at the start";
|
|
93
73
|
}>;
|
|
94
74
|
readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
95
|
-
required: true;
|
|
96
|
-
default: never[];
|
|
97
75
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
98
|
-
description: "
|
|
76
|
+
description: "Set environment variables";
|
|
99
77
|
}>;
|
|
100
78
|
readonly 'node-dev': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
101
|
-
|
|
102
|
-
default: false;
|
|
103
|
-
description: "Set NODE_ENV to \"development\"";
|
|
104
|
-
}>;
|
|
105
|
-
readonly tsn: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
106
|
-
required: true;
|
|
107
|
-
default: false;
|
|
108
|
-
description: "Run the script with ts-node (TypeScript)";
|
|
79
|
+
description: "Set env.NODE_ENV to \"development\"";
|
|
109
80
|
}>;
|
|
110
81
|
};
|
|
111
82
|
readonly listArgument: {
|
|
@@ -123,18 +94,17 @@ export declare function mapFlagsToOptions(flags: NoArg.InferFlags<typeof app>):
|
|
|
123
94
|
cwd: string;
|
|
124
95
|
shell: boolean;
|
|
125
96
|
silent: boolean;
|
|
126
|
-
stdinSafeMode: boolean;
|
|
127
97
|
showInfo: boolean;
|
|
128
98
|
showTime: boolean;
|
|
129
99
|
benchmark: boolean;
|
|
130
100
|
benchmarkPrefix: string | undefined;
|
|
131
101
|
clearOnReload: boolean;
|
|
132
102
|
keystrokeReload: boolean;
|
|
103
|
+
stdinSafeMode: boolean;
|
|
133
104
|
watch: boolean;
|
|
134
105
|
watchDelay: number;
|
|
135
106
|
watchFocus: string[];
|
|
136
107
|
watchIgnore: string[];
|
|
137
108
|
watchExtensions: string[];
|
|
138
|
-
tsNode: boolean;
|
|
139
109
|
env: NodeJS.ProcessEnv;
|
|
140
110
|
};
|
package/dist/argHelper.js
CHANGED
|
@@ -8,35 +8,37 @@ exports.mapFlagsToOptions = mapFlagsToOptions;
|
|
|
8
8
|
const noarg_1 = __importDefault(require("noarg"));
|
|
9
9
|
exports.executionConfig = noarg_1.default.defineConfig({
|
|
10
10
|
flags: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.aliases('k')
|
|
14
|
-
.default(true)
|
|
15
|
-
.description("Reload the page when pressing 'Ctrl+R' or 'F5'"),
|
|
16
|
-
watch: noarg_1.default.boolean()
|
|
17
|
-
.aliases('w')
|
|
18
|
-
.default(true)
|
|
11
|
+
'do-not-watch': noarg_1.default.boolean()
|
|
12
|
+
.aliases('dw')
|
|
19
13
|
.description('Watch for file changes and reload the script'),
|
|
14
|
+
'disable-reload-key': noarg_1.default.boolean()
|
|
15
|
+
.aliases('dk')
|
|
16
|
+
.description("Disable 'Ctrl+R' or 'F5' to reload the script"),
|
|
17
|
+
'disable-raw-stdin': noarg_1.default.boolean()
|
|
18
|
+
.aliases('drs')
|
|
19
|
+
.description('Disable raw mode for stdin. Do not needed with `--disable-reload-key`'),
|
|
20
20
|
exit: noarg_1.default.boolean()
|
|
21
|
-
.
|
|
22
|
-
.description('Exit
|
|
23
|
-
|
|
24
|
-
.aliases('
|
|
25
|
-
.
|
|
26
|
-
|
|
21
|
+
.aliases('x')
|
|
22
|
+
.description('Exit the script after the first execution'),
|
|
23
|
+
quiet: noarg_1.default.boolean()
|
|
24
|
+
.aliases('q')
|
|
25
|
+
.description('Do not show any output of the script'),
|
|
26
|
+
keep: noarg_1.default.boolean()
|
|
27
|
+
.aliases('k')
|
|
28
|
+
.description('Do not clear the console while starting the script'),
|
|
27
29
|
ext: noarg_1.default.array(noarg_1.default.string())
|
|
28
30
|
.aliases('e')
|
|
29
|
-
.default([])
|
|
30
31
|
.description('Looks for changes only of the given extensions'),
|
|
31
32
|
focus: noarg_1.default.array(noarg_1.default.string())
|
|
32
33
|
.aliases('f')
|
|
33
|
-
.default([])
|
|
34
34
|
.description('Only watch the given items. `chokidar` syntax'),
|
|
35
35
|
ignore: noarg_1.default.array(noarg_1.default.string())
|
|
36
36
|
.aliases('ig')
|
|
37
|
-
.default([])
|
|
38
37
|
.description('Exclude the given items. `gitignore` syntax'),
|
|
39
|
-
|
|
38
|
+
delay: noarg_1.default.number()
|
|
39
|
+
.aliases('d')
|
|
40
|
+
.default(100)
|
|
41
|
+
.description('The delay to wait for the watcher to trigger'),
|
|
40
42
|
bench: noarg_1.default.boolean()
|
|
41
43
|
.aliases('b')
|
|
42
44
|
.description('Calculate the execution time'),
|
|
@@ -44,38 +46,16 @@ exports.executionConfig = noarg_1.default.defineConfig({
|
|
|
44
46
|
.aliases('bp')
|
|
45
47
|
.minLength(1)
|
|
46
48
|
.description('The prefix to show before the execution time'),
|
|
47
|
-
|
|
48
|
-
.aliases('
|
|
49
|
-
.
|
|
50
|
-
.description('Clear the console before running the script'),
|
|
51
|
-
silent: noarg_1.default.boolean()
|
|
52
|
-
.default(false)
|
|
53
|
-
.description('Do not show any output of the script'),
|
|
49
|
+
shell: noarg_1.default.boolean()
|
|
50
|
+
.aliases('sh')
|
|
51
|
+
.description('Run the script in a shell for more low-level control.'),
|
|
54
52
|
cwd: noarg_1.default.string()
|
|
55
53
|
.default(process.cwd())
|
|
56
|
-
.description('
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
'
|
|
61
|
-
.default(false)
|
|
62
|
-
.description('Disable raw mode for stdin (useful for some scripts)'),
|
|
63
|
-
info: noarg_1.default.boolean()
|
|
64
|
-
.default(false)
|
|
65
|
-
.description('Show information about the script'),
|
|
66
|
-
time: noarg_1.default.boolean()
|
|
67
|
-
.default(false)
|
|
68
|
-
.description('Show the execution time at the start'),
|
|
69
|
-
env: noarg_1.default.array(noarg_1.default.string())
|
|
70
|
-
.default([])
|
|
71
|
-
.description('Environment variables'),
|
|
72
|
-
// Extra flags
|
|
73
|
-
'node-dev': noarg_1.default.boolean()
|
|
74
|
-
.default(false)
|
|
75
|
-
.description('Set NODE_ENV to "development"'),
|
|
76
|
-
tsn: noarg_1.default.boolean()
|
|
77
|
-
.default(false)
|
|
78
|
-
.description('Run the script with ts-node (TypeScript)'),
|
|
54
|
+
.description('Set the current working directory'),
|
|
55
|
+
info: noarg_1.default.boolean().description('Show information about the script'),
|
|
56
|
+
time: noarg_1.default.boolean().description('Show the execution time at the start'),
|
|
57
|
+
env: noarg_1.default.array(noarg_1.default.string()).description('Set environment variables'),
|
|
58
|
+
'node-dev': noarg_1.default.boolean().description('Set env.NODE_ENV to "development"'),
|
|
79
59
|
},
|
|
80
60
|
listArgument: {
|
|
81
61
|
name: 'args for script',
|
|
@@ -88,25 +68,28 @@ exports.executionConfig = noarg_1.default.defineConfig({
|
|
|
88
68
|
},
|
|
89
69
|
});
|
|
90
70
|
function mapFlagsToOptions(flags) {
|
|
91
|
-
var _a;
|
|
71
|
+
var _a, _b, _c, _d, _e;
|
|
72
|
+
if (flags.exit) {
|
|
73
|
+
flags['disable-reload-key'] = true;
|
|
74
|
+
flags['do-not-watch'] = true;
|
|
75
|
+
}
|
|
92
76
|
return {
|
|
93
77
|
cwd: flags.cwd,
|
|
94
|
-
shell: flags.shell,
|
|
95
|
-
silent: flags.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
benchmark: (_a = flags.bench) !== null && _a !== void 0 ? _a : Boolean(flags['bench-prefix']),
|
|
78
|
+
shell: !!flags.shell,
|
|
79
|
+
silent: !!flags.quiet,
|
|
80
|
+
showInfo: !!flags.info,
|
|
81
|
+
showTime: !!flags.time,
|
|
82
|
+
benchmark: !!((_a = flags.bench) !== null && _a !== void 0 ? _a : flags['bench-prefix']),
|
|
100
83
|
benchmarkPrefix: flags['bench-prefix'],
|
|
101
|
-
clearOnReload: flags.
|
|
102
|
-
keystrokeReload: flags
|
|
103
|
-
|
|
84
|
+
clearOnReload: !flags.keep,
|
|
85
|
+
keystrokeReload: !flags['disable-reload-key'],
|
|
86
|
+
stdinSafeMode: !!flags['disable-raw-stdin'],
|
|
87
|
+
watch: !flags['do-not-watch'],
|
|
104
88
|
watchDelay: flags.delay,
|
|
105
|
-
watchFocus: flags.focus.length ? flags.focus : [flags.cwd],
|
|
106
|
-
watchIgnore: flags.ignore,
|
|
107
|
-
watchExtensions: flags.ext,
|
|
108
|
-
|
|
109
|
-
env: Object.assign(Object.assign({}, flags.env.reduce((acc, env) => {
|
|
89
|
+
watchFocus: ((_b = flags.focus) === null || _b === void 0 ? void 0 : _b.length) ? flags.focus : [flags.cwd],
|
|
90
|
+
watchIgnore: (_c = flags.ignore) !== null && _c !== void 0 ? _c : [],
|
|
91
|
+
watchExtensions: (_d = flags.ext) !== null && _d !== void 0 ? _d : [],
|
|
92
|
+
env: Object.assign(Object.assign({}, ((_e = flags.env) !== null && _e !== void 0 ? _e : []).reduce((acc, env) => {
|
|
110
93
|
const [key, value] = env.split('=');
|
|
111
94
|
acc[key] = value;
|
|
112
95
|
return acc;
|
package/dist/execution/index.js
CHANGED
|
@@ -99,17 +99,16 @@ class Execution {
|
|
|
99
99
|
this.clearBeforeStart();
|
|
100
100
|
this.renderInfoLogs();
|
|
101
101
|
this.isExecutionExecutedAnyTime = true;
|
|
102
|
-
if (this.preStartArgs)
|
|
102
|
+
if (this.preStartArgs) {
|
|
103
103
|
this.spawnSync(this.preStartArgs);
|
|
104
|
+
}
|
|
105
|
+
this.startBenchmark();
|
|
104
106
|
this.child = this.spawnAsync(this.startArgs);
|
|
105
107
|
this.child.on('exit', (code) => {
|
|
108
|
+
this.endBenchmark();
|
|
106
109
|
if (code && code > 0) {
|
|
107
110
|
console.log(colors_1.default.red(`Process exited with code: ${colors_1.default.yellow(String(code))}`));
|
|
108
111
|
}
|
|
109
|
-
if (this.isBenchmarkRunning) {
|
|
110
|
-
console.timeEnd(this.benchMarkText);
|
|
111
|
-
this.isBenchmarkRunning = false;
|
|
112
|
-
}
|
|
113
112
|
if (this.options.keystrokeReload) {
|
|
114
113
|
console.log(colors_1.default.blue.dim(`> Press ${colors_1.default.yellow('F5')} or ${colors_1.default.yellow('^R')} to reload...`));
|
|
115
114
|
}
|
|
@@ -157,6 +156,8 @@ class Execution {
|
|
|
157
156
|
if (this.options.showTime) {
|
|
158
157
|
console.log(colors_1.default.dim.bgGreen('TIME:'), colors_1.default.green(new Date().toLocaleString()));
|
|
159
158
|
}
|
|
159
|
+
}
|
|
160
|
+
startBenchmark() {
|
|
160
161
|
if (this.options.benchmark) {
|
|
161
162
|
if (this.isBenchmarkRunning) {
|
|
162
163
|
console.timeEnd(this.benchMarkText);
|
|
@@ -167,5 +168,11 @@ class Execution {
|
|
|
167
168
|
console.time(this.benchMarkText);
|
|
168
169
|
}
|
|
169
170
|
}
|
|
171
|
+
endBenchmark() {
|
|
172
|
+
if (this.isBenchmarkRunning) {
|
|
173
|
+
console.timeEnd(this.benchMarkText);
|
|
174
|
+
this.isBenchmarkRunning = false;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
170
177
|
}
|
|
171
178
|
exports.default = Execution;
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const as_1 = __importDefault(require("../helpers/as"));
|
|
7
7
|
const helpers_1 = require("./helpers");
|
|
8
|
-
const utils_1 = require("../helpers/utils");
|
|
9
8
|
exports.default = (0, as_1.default)([
|
|
10
9
|
{
|
|
11
10
|
name: 'JavaScript',
|
|
@@ -38,9 +37,7 @@ exports.default = (0, as_1.default)([
|
|
|
38
37
|
exts: ['ts', 'tsx', 'cts', 'ctsx', 'mts', 'mtsx'],
|
|
39
38
|
getRuntime(args, options, config) {
|
|
40
39
|
let installHints;
|
|
41
|
-
const runtime =
|
|
42
|
-
? 'ts-node'
|
|
43
|
-
: config['typescript-runtime'] || 'tsx';
|
|
40
|
+
const runtime = config['typescript-runtime'] || 'tsx';
|
|
44
41
|
switch (runtime) {
|
|
45
42
|
case 'tsx':
|
|
46
43
|
installHints = ['Please install tsx from https://tsx.is'];
|
|
@@ -190,7 +187,7 @@ exports.default = (0, as_1.default)([
|
|
|
190
187
|
name: 'C - GCC',
|
|
191
188
|
exts: ['c'],
|
|
192
189
|
getRuntime([script, ...args], options, config) {
|
|
193
|
-
const output = (0,
|
|
190
|
+
const output = (0, helpers_1.getUniqueCacheDir)('/c-gcc') + '/output';
|
|
194
191
|
return {
|
|
195
192
|
compile: ['gcc', script, '-o', output],
|
|
196
193
|
exec: [output, ...args],
|
|
@@ -235,7 +232,7 @@ exports.default = (0, as_1.default)([
|
|
|
235
232
|
name: 'Rust - rustc',
|
|
236
233
|
exts: ['rs'],
|
|
237
234
|
getRuntime([script, ...args], options, config) {
|
|
238
|
-
const output = (0, helpers_1.getUniqueCacheDir)('/rust') + '/output';
|
|
235
|
+
const output = (0, helpers_1.getUniqueCacheDir)('/rust-rustc') + '/output';
|
|
239
236
|
return {
|
|
240
237
|
compile: ['rustc', script, '-o', output],
|
|
241
238
|
exec: [output, ...args],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uni-run",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "Universal Runner for many language",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"tsc": "tsc --watch --noEmit",
|
|
10
10
|
"live": "node ./dist/__lab__/index.js",
|
|
11
11
|
"tsx": "tsx --watch ./src/__lab__/index.ts",
|
|
12
|
-
"lab": "run ./src/__lab__/index.ts --focus ./src --
|
|
12
|
+
"lab": "run ./src/__lab__/index.ts --focus ./src -- UNI_RUN_LAB_MODE"
|
|
13
13
|
},
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"bin": {
|