uni-run 0.0.5 → 1.0.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.
- package/dist/arg-helper.d.ts +20 -6
- package/dist/arg-helper.js +23 -12
- package/dist/arg.d.ts +54 -12
- package/dist/arg.js +4 -1
- package/dist/builtin-bin/Executor.d.ts +4 -1
- package/dist/builtin-bin/Executor.js +1 -1
- package/dist/builtin-bin/index.js +28 -7
- package/dist/execution/index.d.ts +1 -0
- package/dist/execution/index.js +5 -4
- package/dist/index.js +14 -0
- package/package.json +4 -5
package/dist/arg-helper.d.ts
CHANGED
|
@@ -6,7 +6,12 @@ export declare const executionConfig: {
|
|
|
6
6
|
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
7
7
|
required: true;
|
|
8
8
|
default: string;
|
|
9
|
-
description: "
|
|
9
|
+
description: "Current working directory";
|
|
10
|
+
}>;
|
|
11
|
+
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
12
|
+
required: true;
|
|
13
|
+
default: false;
|
|
14
|
+
description: "Run the script in a shell for more low-level control";
|
|
10
15
|
}>;
|
|
11
16
|
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
12
17
|
description: "Clear the console before running the script";
|
|
@@ -14,8 +19,8 @@ export declare const executionConfig: {
|
|
|
14
19
|
default: true;
|
|
15
20
|
aliases: [string];
|
|
16
21
|
}>;
|
|
17
|
-
readonly
|
|
18
|
-
description: "Reload the page when pressing
|
|
22
|
+
readonly reloadKey: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
23
|
+
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
19
24
|
required: true;
|
|
20
25
|
default: true;
|
|
21
26
|
aliases: [string];
|
|
@@ -26,7 +31,7 @@ export declare const executionConfig: {
|
|
|
26
31
|
default: true;
|
|
27
32
|
aliases: [string];
|
|
28
33
|
}>;
|
|
29
|
-
readonly
|
|
34
|
+
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
30
35
|
description: "The delay to wait for the watcher to trigger";
|
|
31
36
|
required: true;
|
|
32
37
|
default: 100;
|
|
@@ -40,10 +45,11 @@ export declare const executionConfig: {
|
|
|
40
45
|
aliases: [string];
|
|
41
46
|
}>;
|
|
42
47
|
readonly ignore: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
48
|
+
description: "Ignore the given folders/files";
|
|
43
49
|
required: true;
|
|
44
50
|
default: never[];
|
|
45
51
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
46
|
-
|
|
52
|
+
aliases: [string];
|
|
47
53
|
}>;
|
|
48
54
|
readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
49
55
|
required: true;
|
|
@@ -51,12 +57,20 @@ export declare const executionConfig: {
|
|
|
51
57
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
52
58
|
description: "Environment variables";
|
|
53
59
|
}>;
|
|
60
|
+
readonly nodeDev: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
61
|
+
required: true;
|
|
62
|
+
default: false;
|
|
63
|
+
description: "Set NODE_ENV to \"development\"";
|
|
64
|
+
}>;
|
|
54
65
|
};
|
|
55
66
|
readonly listArgument: {
|
|
56
|
-
readonly name: "args";
|
|
67
|
+
readonly name: "args for script";
|
|
57
68
|
readonly description: "The arguments to pass to the script";
|
|
58
69
|
readonly type: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
59
70
|
};
|
|
60
71
|
readonly trailingArguments: "--";
|
|
72
|
+
readonly customRenderHelp: {
|
|
73
|
+
readonly helpUsageTrailingArgsLabel: "...[args/flags for script]";
|
|
74
|
+
};
|
|
61
75
|
};
|
|
62
76
|
export declare function mapFlagsToOptions(flags: NoArg.InferFlags<typeof app>, watchExtensions?: string[]): ExecuteOptions;
|
package/dist/arg-helper.js
CHANGED
|
@@ -7,53 +7,64 @@ exports.executionConfig = noarg_1.default.defineConfig({
|
|
|
7
7
|
flags: {
|
|
8
8
|
cwd: noarg_1.default.string()
|
|
9
9
|
.default(process.cwd())
|
|
10
|
-
.description('
|
|
10
|
+
.description('Current working directory'),
|
|
11
|
+
shell: noarg_1.default.boolean()
|
|
12
|
+
.default(false)
|
|
13
|
+
.description('Run the script in a shell for more low-level control'),
|
|
11
14
|
clear: noarg_1.default.boolean()
|
|
12
15
|
.default(true)
|
|
13
16
|
.description('Clear the console before running the script')
|
|
14
17
|
.aliases('c'),
|
|
15
|
-
|
|
18
|
+
reloadKey: noarg_1.default.boolean()
|
|
16
19
|
.default(true)
|
|
17
|
-
.description(
|
|
18
|
-
.aliases('
|
|
20
|
+
.description("Reload the page when pressing 'Ctrl+R' or 'F5'")
|
|
21
|
+
.aliases('rk'),
|
|
19
22
|
watch: noarg_1.default.boolean()
|
|
20
23
|
.default(true)
|
|
21
24
|
.description('Watch for changes')
|
|
22
25
|
.aliases('w'),
|
|
23
|
-
|
|
26
|
+
delay: noarg_1.default.number()
|
|
24
27
|
.default(100)
|
|
25
28
|
.description('The delay to wait for the watcher to trigger')
|
|
26
|
-
.aliases('
|
|
29
|
+
.aliases('d'),
|
|
27
30
|
ext: noarg_1.default.array(noarg_1.default.string())
|
|
28
31
|
.default([])
|
|
29
32
|
.description('Looks for changes only of the given extensions')
|
|
30
33
|
.aliases('e'),
|
|
31
34
|
ignore: noarg_1.default.array(noarg_1.default.string())
|
|
32
35
|
.default([])
|
|
33
|
-
.description('Ignore the given
|
|
36
|
+
.description('Ignore the given folders/files')
|
|
37
|
+
.aliases('ig'),
|
|
34
38
|
env: noarg_1.default.array(noarg_1.default.string())
|
|
35
39
|
.default([])
|
|
36
40
|
.description('Environment variables'),
|
|
41
|
+
nodeDev: noarg_1.default.boolean()
|
|
42
|
+
.default(false)
|
|
43
|
+
.description('Set NODE_ENV to "development"'),
|
|
37
44
|
},
|
|
38
45
|
listArgument: {
|
|
39
|
-
name: 'args',
|
|
46
|
+
name: 'args for script',
|
|
40
47
|
description: 'The arguments to pass to the script',
|
|
41
48
|
type: noarg_1.default.string(),
|
|
42
49
|
},
|
|
43
50
|
trailingArguments: '--',
|
|
51
|
+
customRenderHelp: {
|
|
52
|
+
helpUsageTrailingArgsLabel: '...[args/flags for script]',
|
|
53
|
+
},
|
|
44
54
|
});
|
|
45
55
|
function mapFlagsToOptions(flags, watchExtensions) {
|
|
46
56
|
return {
|
|
47
57
|
cwd: flags.cwd,
|
|
58
|
+
shell: flags.shell,
|
|
48
59
|
clearOnReload: flags.clear,
|
|
49
|
-
readlineReload: flags.
|
|
50
|
-
env: flags.env.reduce((acc, env) => {
|
|
60
|
+
readlineReload: flags.reloadKey,
|
|
61
|
+
env: Object.assign(Object.assign({}, flags.env.reduce((acc, env) => {
|
|
51
62
|
const [key, value] = env.split('=');
|
|
52
63
|
acc[key] = value;
|
|
53
64
|
return acc;
|
|
54
|
-
}, {}),
|
|
65
|
+
}, {})), (flags.nodeDev ? { NODE_ENV: 'development' } : {})),
|
|
55
66
|
watch: flags.watch,
|
|
56
|
-
watchDelay: flags.
|
|
67
|
+
watchDelay: flags.delay,
|
|
57
68
|
watchExtensions: flags.ext.length ? flags.ext : watchExtensions !== null && watchExtensions !== void 0 ? watchExtensions : [],
|
|
58
69
|
watchIgnore: flags.ignore,
|
|
59
70
|
};
|
package/dist/arg.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const app: NoArg<"uni-run", {
|
|
|
16
16
|
readonly description: "Run a script";
|
|
17
17
|
}];
|
|
18
18
|
readonly listArgument: {
|
|
19
|
-
readonly name: "args";
|
|
19
|
+
readonly name: "args for script";
|
|
20
20
|
readonly description: "The arguments to pass to the script";
|
|
21
21
|
readonly type: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
22
22
|
};
|
|
@@ -25,7 +25,12 @@ export declare const app: NoArg<"uni-run", {
|
|
|
25
25
|
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
26
26
|
required: true;
|
|
27
27
|
default: string;
|
|
28
|
-
description: "
|
|
28
|
+
description: "Current working directory";
|
|
29
|
+
}>;
|
|
30
|
+
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
31
|
+
required: true;
|
|
32
|
+
default: false;
|
|
33
|
+
description: "Run the script in a shell for more low-level control";
|
|
29
34
|
}>;
|
|
30
35
|
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
31
36
|
description: "Clear the console before running the script";
|
|
@@ -33,8 +38,8 @@ export declare const app: NoArg<"uni-run", {
|
|
|
33
38
|
default: true;
|
|
34
39
|
aliases: [string];
|
|
35
40
|
}>;
|
|
36
|
-
readonly
|
|
37
|
-
description: "Reload the page when pressing
|
|
41
|
+
readonly reloadKey: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
42
|
+
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
38
43
|
required: true;
|
|
39
44
|
default: true;
|
|
40
45
|
aliases: [string];
|
|
@@ -45,7 +50,7 @@ export declare const app: NoArg<"uni-run", {
|
|
|
45
50
|
default: true;
|
|
46
51
|
aliases: [string];
|
|
47
52
|
}>;
|
|
48
|
-
readonly
|
|
53
|
+
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
49
54
|
description: "The delay to wait for the watcher to trigger";
|
|
50
55
|
required: true;
|
|
51
56
|
default: 100;
|
|
@@ -59,10 +64,11 @@ export declare const app: NoArg<"uni-run", {
|
|
|
59
64
|
aliases: [string];
|
|
60
65
|
}>;
|
|
61
66
|
readonly ignore: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
67
|
+
description: "Ignore the given folders/files";
|
|
62
68
|
required: true;
|
|
63
69
|
default: never[];
|
|
64
70
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
65
|
-
|
|
71
|
+
aliases: [string];
|
|
66
72
|
}>;
|
|
67
73
|
readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
68
74
|
required: true;
|
|
@@ -70,6 +76,14 @@ export declare const app: NoArg<"uni-run", {
|
|
|
70
76
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
71
77
|
description: "Environment variables";
|
|
72
78
|
}>;
|
|
79
|
+
readonly nodeDev: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
80
|
+
required: true;
|
|
81
|
+
default: false;
|
|
82
|
+
description: "Set NODE_ENV to \"development\"";
|
|
83
|
+
}>;
|
|
84
|
+
};
|
|
85
|
+
readonly customRenderHelp: {
|
|
86
|
+
readonly helpUsageTrailingArgsLabel: "...[args/flags for script]";
|
|
73
87
|
};
|
|
74
88
|
}>;
|
|
75
89
|
export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProgram<"exec", {
|
|
@@ -84,7 +98,7 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
84
98
|
readonly arguments: [];
|
|
85
99
|
readonly optionalArguments: [];
|
|
86
100
|
readonly listArgument: {
|
|
87
|
-
readonly name: "args";
|
|
101
|
+
readonly name: "args for script";
|
|
88
102
|
readonly description: "The arguments to pass to the script";
|
|
89
103
|
readonly type: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
90
104
|
};
|
|
@@ -93,7 +107,12 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
93
107
|
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
94
108
|
required: true;
|
|
95
109
|
default: string;
|
|
96
|
-
description: "
|
|
110
|
+
description: "Current working directory";
|
|
111
|
+
}>;
|
|
112
|
+
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
113
|
+
required: true;
|
|
114
|
+
default: false;
|
|
115
|
+
description: "Run the script in a shell for more low-level control";
|
|
97
116
|
}>;
|
|
98
117
|
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
99
118
|
description: "Clear the console before running the script";
|
|
@@ -101,8 +120,8 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
101
120
|
default: true;
|
|
102
121
|
aliases: [string];
|
|
103
122
|
}>;
|
|
104
|
-
readonly
|
|
105
|
-
description: "Reload the page when pressing
|
|
123
|
+
readonly reloadKey: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
124
|
+
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
106
125
|
required: true;
|
|
107
126
|
default: true;
|
|
108
127
|
aliases: [string];
|
|
@@ -113,7 +132,7 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
113
132
|
default: true;
|
|
114
133
|
aliases: [string];
|
|
115
134
|
}>;
|
|
116
|
-
readonly
|
|
135
|
+
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
117
136
|
description: "The delay to wait for the watcher to trigger";
|
|
118
137
|
required: true;
|
|
119
138
|
default: 100;
|
|
@@ -127,10 +146,11 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
127
146
|
aliases: [string];
|
|
128
147
|
}>;
|
|
129
148
|
readonly ignore: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
149
|
+
description: "Ignore the given folders/files";
|
|
130
150
|
required: true;
|
|
131
151
|
default: never[];
|
|
132
152
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
133
|
-
|
|
153
|
+
aliases: [string];
|
|
134
154
|
}>;
|
|
135
155
|
readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
136
156
|
required: true;
|
|
@@ -138,6 +158,28 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
|
|
|
138
158
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
139
159
|
description: "Environment variables";
|
|
140
160
|
}>;
|
|
161
|
+
readonly nodeDev: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
162
|
+
required: true;
|
|
163
|
+
default: false;
|
|
164
|
+
description: "Set NODE_ENV to \"development\"";
|
|
165
|
+
}>;
|
|
166
|
+
};
|
|
167
|
+
readonly customRenderHelp: {
|
|
168
|
+
readonly helpUsageTrailingArgsLabel: "...[args/flags for script]";
|
|
141
169
|
};
|
|
142
170
|
globalFlags: {};
|
|
143
171
|
}>;
|
|
172
|
+
export declare const support: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProgram<"support", {
|
|
173
|
+
readonly allowEqualAssign: true;
|
|
174
|
+
readonly booleanNotSyntaxEnding: "\\";
|
|
175
|
+
readonly allowDuplicateFlagForList: true;
|
|
176
|
+
readonly splitListByComma: true;
|
|
177
|
+
}, {
|
|
178
|
+
readonly help: true;
|
|
179
|
+
}, {
|
|
180
|
+
readonly description: "List supported scripts";
|
|
181
|
+
readonly arguments: [];
|
|
182
|
+
readonly optionalArguments: [];
|
|
183
|
+
readonly flags: {};
|
|
184
|
+
globalFlags: {};
|
|
185
|
+
}>;
|
package/dist/arg.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.exec = exports.app = void 0;
|
|
3
|
+
exports.support = exports.exec = exports.app = void 0;
|
|
4
4
|
const noarg_1 = require("noarg");
|
|
5
5
|
const arg_helper_1 = require("./arg-helper");
|
|
6
6
|
exports.app = noarg_1.default.create('uni-run', Object.assign(Object.assign({}, arg_helper_1.executionConfig), { description: 'A universal runner for scripts', system: { splitListByComma: true }, arguments: [
|
|
7
7
|
{ name: 'script', type: noarg_1.default.string(), description: 'Run a script' },
|
|
8
8
|
] }));
|
|
9
9
|
exports.exec = exports.app.create('exec', Object.assign(Object.assign({}, arg_helper_1.executionConfig), { description: 'Execute a script with the given binary' }));
|
|
10
|
+
exports.support = exports.app.create('support', {
|
|
11
|
+
description: 'List supported scripts',
|
|
12
|
+
});
|
|
@@ -5,7 +5,10 @@ type ExecutionBinConfig = {
|
|
|
5
5
|
runArgs?: string[];
|
|
6
6
|
checkInstallationArgs?: string[];
|
|
7
7
|
howToInstall?: () => void;
|
|
8
|
-
installCommands?:
|
|
8
|
+
installCommands?: {
|
|
9
|
+
command: string;
|
|
10
|
+
args: string[];
|
|
11
|
+
}[];
|
|
9
12
|
};
|
|
10
13
|
export default class Executor {
|
|
11
14
|
name: string;
|
|
@@ -35,7 +35,7 @@ class Executor {
|
|
|
35
35
|
var _a;
|
|
36
36
|
if (!ans)
|
|
37
37
|
return;
|
|
38
|
-
(_a = this.config.installCommands) === null || _a === void 0 ? void 0 : _a.forEach((
|
|
38
|
+
(_a = this.config.installCommands) === null || _a === void 0 ? void 0 : _a.forEach(({ command, args }) => {
|
|
39
39
|
if (!command)
|
|
40
40
|
return;
|
|
41
41
|
(0, cross_spawn_1.sync)(command, args, { stdio: 'inherit' });
|
|
@@ -8,7 +8,7 @@ exports.default = [
|
|
|
8
8
|
watchExtensions: ['html', 'css', 'json'],
|
|
9
9
|
checkInstallationArgs: ['--version'],
|
|
10
10
|
howToInstall: () => {
|
|
11
|
-
console.log('Please install Node.js from https://nodejs.org
|
|
11
|
+
console.log('Please install Node.js from https://nodejs.org');
|
|
12
12
|
},
|
|
13
13
|
}),
|
|
14
14
|
new Executor_1.default('TypeScript', {
|
|
@@ -27,7 +27,7 @@ exports.default = [
|
|
|
27
27
|
'mjsx',
|
|
28
28
|
],
|
|
29
29
|
checkInstallationArgs: ['--version'],
|
|
30
|
-
installCommands: [
|
|
30
|
+
installCommands: [{ command: 'npm', args: ['install', '-g', 'ts-node'] }],
|
|
31
31
|
howToInstall: () => {
|
|
32
32
|
console.log('Please install ts-node from https://www.npmjs.com/package/ts-node');
|
|
33
33
|
},
|
|
@@ -37,7 +37,7 @@ exports.default = [
|
|
|
37
37
|
extensions: ['py'],
|
|
38
38
|
checkInstallationArgs: ['--version'],
|
|
39
39
|
howToInstall: () => {
|
|
40
|
-
console.log('Please install Python from https://www.python.org
|
|
40
|
+
console.log('Please install Python from https://www.python.org');
|
|
41
41
|
},
|
|
42
42
|
}),
|
|
43
43
|
new Executor_1.default('Java - Oracle', {
|
|
@@ -45,7 +45,7 @@ exports.default = [
|
|
|
45
45
|
extensions: ['java'],
|
|
46
46
|
checkInstallationArgs: ['--version'],
|
|
47
47
|
howToInstall: () => {
|
|
48
|
-
console.log('Please install Java from https://www.oracle.com/java
|
|
48
|
+
console.log('Please install Java from https://www.oracle.com/java');
|
|
49
49
|
},
|
|
50
50
|
}),
|
|
51
51
|
new Executor_1.default('Powershell', {
|
|
@@ -56,7 +56,7 @@ exports.default = [
|
|
|
56
56
|
console.log('Please install Powershell from https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell');
|
|
57
57
|
},
|
|
58
58
|
}),
|
|
59
|
-
new Executor_1.default('
|
|
59
|
+
new Executor_1.default('Command Prompt', {
|
|
60
60
|
command: 'cmd',
|
|
61
61
|
runArgs: ['/c'],
|
|
62
62
|
extensions: ['cmd', 'bat'],
|
|
@@ -70,7 +70,7 @@ exports.default = [
|
|
|
70
70
|
extensions: ['sh'],
|
|
71
71
|
checkInstallationArgs: ['--version'],
|
|
72
72
|
howToInstall: () => {
|
|
73
|
-
console.log('Please install Bash from https://www.gnu.org/software/bash
|
|
73
|
+
console.log('Please install Bash from https://www.gnu.org/software/bash');
|
|
74
74
|
},
|
|
75
75
|
}),
|
|
76
76
|
new Executor_1.default('Lua', {
|
|
@@ -78,7 +78,28 @@ exports.default = [
|
|
|
78
78
|
extensions: ['lua'],
|
|
79
79
|
checkInstallationArgs: ['--version'],
|
|
80
80
|
howToInstall: () => {
|
|
81
|
-
console.log('Please install Lua from https://www.lua.org
|
|
81
|
+
console.log('Please install Lua from https://www.lua.org');
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
new Executor_1.default('SASS (CSS)', {
|
|
85
|
+
command: 'sass',
|
|
86
|
+
extensions: ['sass', 'scss'],
|
|
87
|
+
checkInstallationArgs: ['--version'],
|
|
88
|
+
installCommands: [{ command: 'npm', args: ['install', '-g', 'sass'] }],
|
|
89
|
+
howToInstall: () => {
|
|
90
|
+
console.log('Please install SASS from https://sass-lang.com');
|
|
91
|
+
},
|
|
92
|
+
}),
|
|
93
|
+
new Executor_1.default('HTML Server', {
|
|
94
|
+
command: 'http-server',
|
|
95
|
+
extensions: ['html', 'htm'],
|
|
96
|
+
watchExtensions: ['css', 'js', 'json'],
|
|
97
|
+
checkInstallationArgs: ['--version'],
|
|
98
|
+
installCommands: [
|
|
99
|
+
{ command: 'npm', args: ['install', '-g', 'http-server'] },
|
|
100
|
+
],
|
|
101
|
+
howToInstall: () => {
|
|
102
|
+
console.log('Please install http-server from https://www.npmjs.com/package/http-server');
|
|
82
103
|
},
|
|
83
104
|
}),
|
|
84
105
|
];
|
package/dist/execution/index.js
CHANGED
|
@@ -23,13 +23,12 @@ class Execution {
|
|
|
23
23
|
readline.emitKeypressEvents(process.stdin);
|
|
24
24
|
(_b = (_a = process.stdin).setRawMode) === null || _b === void 0 ? void 0 : _b.call(_a, true);
|
|
25
25
|
process.stdin.on('keypress', (_, key) => {
|
|
26
|
-
if (key.name === 'f5')
|
|
27
|
-
return this.runProcess();
|
|
28
|
-
if ((key.ctrl || key.meta) && key.name === 'r')
|
|
26
|
+
if (key.name === 'f5' || (key.ctrl && key.name === 'r')) {
|
|
29
27
|
return this.runProcess();
|
|
28
|
+
}
|
|
30
29
|
if (key.ctrl && key.name === 'c') {
|
|
31
30
|
this.killProcess();
|
|
32
|
-
process.exit(0);
|
|
31
|
+
return process.exit(0);
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
34
|
}
|
|
@@ -46,7 +45,9 @@ class Execution {
|
|
|
46
45
|
this.clearBeforeStart();
|
|
47
46
|
this.child = (0, cross_spawn_1.spawn)(this.command, this.args, {
|
|
48
47
|
stdio: 'inherit',
|
|
48
|
+
argv0: this.command,
|
|
49
49
|
cwd: this.options.cwd,
|
|
50
|
+
shell: this.options.shell,
|
|
50
51
|
env: Object.assign({}, this.options.env),
|
|
51
52
|
});
|
|
52
53
|
this.child.on('error', console.error);
|
package/dist/index.js
CHANGED
|
@@ -18,3 +18,17 @@ arg.app.on(([script, listArs, trailingArgs], flags) => {
|
|
|
18
18
|
arg.exec.on(([listArs, trailingArgs], flags) => {
|
|
19
19
|
execution_1.default.start([...listArs, ...trailingArgs], (0, arg_helper_1.mapFlagsToOptions)(flags));
|
|
20
20
|
});
|
|
21
|
+
arg.support.on(() => {
|
|
22
|
+
console.log('Supported scripts:');
|
|
23
|
+
builtin_bin_1.default
|
|
24
|
+
.sort((a, b) => {
|
|
25
|
+
if (a.name < b.name)
|
|
26
|
+
return -1;
|
|
27
|
+
if (a.name > b.name)
|
|
28
|
+
return 1;
|
|
29
|
+
return 0;
|
|
30
|
+
})
|
|
31
|
+
.forEach((bin) => {
|
|
32
|
+
console.log(`- ${bin.name}`);
|
|
33
|
+
});
|
|
34
|
+
});
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uni-run",
|
|
3
3
|
"description": "Universal Runner for many language",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"ts": "
|
|
8
|
-
"js": "
|
|
7
|
+
"ts": "run ./src/__lab__/index.ts",
|
|
8
|
+
"js": "run ./dist/__lab__/index.js",
|
|
9
9
|
"dev": "tsc --watch",
|
|
10
10
|
"build": "node ./build.cjs"
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
13
|
-
"r": "./dist/bin.js",
|
|
14
13
|
"run": "./dist/bin.js",
|
|
15
14
|
"uni-run": "./dist/bin.js"
|
|
16
15
|
},
|
|
@@ -19,7 +18,7 @@
|
|
|
19
18
|
"chokidar": "^3.6.0",
|
|
20
19
|
"cross-spawn": "^7.0.3",
|
|
21
20
|
"ignore": "^5.3.2",
|
|
22
|
-
"noarg": "^3.0
|
|
21
|
+
"noarg": "^3.1.0"
|
|
23
22
|
},
|
|
24
23
|
"devDependencies": {
|
|
25
24
|
"@types/cross-spawn": "^6.0.6",
|