uni-run 1.1.15 → 1.1.16
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 +3 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +22 -0
- package/dist/scriptExecutors/checkRuntime.js +10 -11
- package/dist/scriptExecutors/index.js +26 -78
- package/dist/scriptExecutors/types.t.d.ts +2 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ module.exports = [
|
|
|
90
90
|
exts: ['ext'],
|
|
91
91
|
getRuntime(args, options, config) {
|
|
92
92
|
return {
|
|
93
|
-
|
|
93
|
+
exec: ['YOUR_BIN', ...args],
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
},
|
|
@@ -115,7 +115,7 @@ uniRun.addExecutorBefore({
|
|
|
115
115
|
exts: ['ext'],
|
|
116
116
|
getRuntime(args, options, config) {
|
|
117
117
|
return {
|
|
118
|
-
|
|
118
|
+
exec: ['YOUR_BIN', ...args],
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
})
|
|
@@ -142,7 +142,7 @@ uniRun.addExecutorBefore({
|
|
|
142
142
|
exts: ['ext'],
|
|
143
143
|
getRuntime(args, options, config) {
|
|
144
144
|
return {
|
|
145
|
-
|
|
145
|
+
exec: ['YOUR_BIN', ...args],
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
})
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import './app';
|
|
2
|
+
import getConfig from './helpers/getConfig';
|
|
3
|
+
import currentModule from './lib/currentModule';
|
|
4
|
+
import getUserExecutors from './helpers/getUserExecutors';
|
|
2
5
|
import { ScriptExecutorOptions } from './scriptExecutors/types.t';
|
|
6
|
+
export { currentModule, getConfig, getUserExecutors };
|
|
7
|
+
export * from './scriptExecutors/types.t';
|
|
3
8
|
declare const _default: {
|
|
4
9
|
addExecutorBefore(executor: ScriptExecutorOptions): void;
|
|
5
10
|
addExecutorAfter(executor: ScriptExecutorOptions): void;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
18
|
};
|
|
5
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.getUserExecutors = exports.getConfig = exports.currentModule = void 0;
|
|
6
21
|
require("./app");
|
|
7
22
|
const arg_1 = require("./arg");
|
|
23
|
+
const getConfig_1 = __importDefault(require("./helpers/getConfig"));
|
|
24
|
+
exports.getConfig = getConfig_1.default;
|
|
25
|
+
const currentModule_1 = __importDefault(require("./lib/currentModule"));
|
|
26
|
+
exports.currentModule = currentModule_1.default;
|
|
8
27
|
const scriptExecutors_1 = __importDefault(require("./scriptExecutors"));
|
|
28
|
+
const getUserExecutors_1 = __importDefault(require("./helpers/getUserExecutors"));
|
|
29
|
+
exports.getUserExecutors = getUserExecutors_1.default;
|
|
30
|
+
__exportStar(require("./scriptExecutors/types.t"), exports);
|
|
9
31
|
exports.default = {
|
|
10
32
|
addExecutorBefore(executor) {
|
|
11
33
|
scriptExecutors_1.default.unshift(executor);
|
|
@@ -18,29 +18,28 @@ const confirm_1 = __importDefault(require("@inquirer/confirm"));
|
|
|
18
18
|
const cross_spawn_1 = require("cross-spawn");
|
|
19
19
|
function default_1(runtime) {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
var _a, _b
|
|
22
|
-
|
|
23
|
-
if (!install)
|
|
21
|
+
var _a, _b;
|
|
22
|
+
if (!runtime.install && !runtime.installHints)
|
|
24
23
|
return true;
|
|
25
|
-
|
|
24
|
+
const command = runtime.exec[0];
|
|
25
|
+
if (!command)
|
|
26
26
|
return true;
|
|
27
|
-
const
|
|
28
|
-
const result = (0, cross_spawn_1.sync)(checkCmd, checkArgs, { stdio: 'ignore' });
|
|
27
|
+
const result = (0, cross_spawn_1.sync)('which', [command], { stdio: 'ignore' });
|
|
29
28
|
if (result.status === 0)
|
|
30
29
|
return true;
|
|
31
|
-
console.error(colors_1.default.yellow(
|
|
32
|
-
if (!((
|
|
30
|
+
console.error(colors_1.default.yellow(command) + colors_1.default.red(' is not installed.'));
|
|
31
|
+
if (!((_a = runtime.install) === null || _a === void 0 ? void 0 : _a.length))
|
|
33
32
|
return false;
|
|
34
33
|
const ans = yield (0, confirm_1.default)({ message: 'Do you want to install it?' }, { clearPromptOnDone: true });
|
|
35
34
|
process.stdin.resume();
|
|
36
35
|
if (ans) {
|
|
37
|
-
const [installCmd, ...installArgs] = install
|
|
36
|
+
const [installCmd, ...installArgs] = runtime.install;
|
|
38
37
|
const result = (0, cross_spawn_1.sync)(installCmd, installArgs, { stdio: 'inherit' });
|
|
39
38
|
return result.status === 0;
|
|
40
39
|
}
|
|
41
|
-
if ((
|
|
40
|
+
if ((_b = runtime.installHints) === null || _b === void 0 ? void 0 : _b.length) {
|
|
42
41
|
console.log(colors_1.default.bold('How to install:'));
|
|
43
|
-
|
|
42
|
+
runtime.installHints.forEach((hint) => console.log(hint));
|
|
44
43
|
}
|
|
45
44
|
return false;
|
|
46
45
|
});
|
|
@@ -25,10 +25,7 @@ exports.default = (0, as_1.default)([
|
|
|
25
25
|
}
|
|
26
26
|
return {
|
|
27
27
|
exec: [runtime, ...args],
|
|
28
|
-
|
|
29
|
-
check: [runtime, '--version'],
|
|
30
|
-
hints: installHints,
|
|
31
|
-
},
|
|
28
|
+
installHints,
|
|
32
29
|
};
|
|
33
30
|
},
|
|
34
31
|
},
|
|
@@ -57,10 +54,7 @@ exports.default = (0, as_1.default)([
|
|
|
57
54
|
return {
|
|
58
55
|
exec: [runtime, ...args],
|
|
59
56
|
watchExts: ['js', 'javascript', 'jsx', 'cjs', 'cjsx', 'mjs', 'mjsx'],
|
|
60
|
-
|
|
61
|
-
check: [runtime, '--version'],
|
|
62
|
-
hints: installHints,
|
|
63
|
-
},
|
|
57
|
+
installHints,
|
|
64
58
|
};
|
|
65
59
|
},
|
|
66
60
|
},
|
|
@@ -70,10 +64,7 @@ exports.default = (0, as_1.default)([
|
|
|
70
64
|
getRuntime(args, options, config) {
|
|
71
65
|
return {
|
|
72
66
|
exec: ['python', ...args],
|
|
73
|
-
|
|
74
|
-
check: ['python', '--version'],
|
|
75
|
-
hints: ['Please install Python from https://www.python.org'],
|
|
76
|
-
},
|
|
67
|
+
installHints: ['Please install Python from https://www.python.org'],
|
|
77
68
|
};
|
|
78
69
|
},
|
|
79
70
|
},
|
|
@@ -83,10 +74,7 @@ exports.default = (0, as_1.default)([
|
|
|
83
74
|
getRuntime(args, options, config) {
|
|
84
75
|
return {
|
|
85
76
|
exec: ['java', ...args],
|
|
86
|
-
|
|
87
|
-
check: ['java', '--version'],
|
|
88
|
-
hints: ['Please install Java from https://www.oracle.com/java'],
|
|
89
|
-
},
|
|
77
|
+
installHints: ['Please install Java from https://www.oracle.com/java'],
|
|
90
78
|
};
|
|
91
79
|
},
|
|
92
80
|
},
|
|
@@ -96,12 +84,9 @@ exports.default = (0, as_1.default)([
|
|
|
96
84
|
getRuntime(args, options, config) {
|
|
97
85
|
return {
|
|
98
86
|
exec: ['powershell', '-File', ...args],
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
'Please install Powershell from https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell',
|
|
103
|
-
],
|
|
104
|
-
},
|
|
87
|
+
installHints: [
|
|
88
|
+
'Please install Powershell from https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell',
|
|
89
|
+
],
|
|
105
90
|
};
|
|
106
91
|
},
|
|
107
92
|
},
|
|
@@ -111,10 +96,7 @@ exports.default = (0, as_1.default)([
|
|
|
111
96
|
getRuntime(args, options, config) {
|
|
112
97
|
return {
|
|
113
98
|
exec: ['cmd', '/c', ...args],
|
|
114
|
-
|
|
115
|
-
check: ['cmd', '/c', 'echo ok'],
|
|
116
|
-
hints: ['Please install Command Prompt from Windows'],
|
|
117
|
-
},
|
|
99
|
+
installHints: ['Please install Command Prompt from Windows'],
|
|
118
100
|
};
|
|
119
101
|
},
|
|
120
102
|
},
|
|
@@ -124,10 +106,9 @@ exports.default = (0, as_1.default)([
|
|
|
124
106
|
getRuntime(args, options, config) {
|
|
125
107
|
return {
|
|
126
108
|
exec: ['bash', ...args],
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
109
|
+
installHints: [
|
|
110
|
+
'Please install Bash from https://www.gnu.org/software/bash',
|
|
111
|
+
],
|
|
131
112
|
};
|
|
132
113
|
},
|
|
133
114
|
},
|
|
@@ -137,10 +118,7 @@ exports.default = (0, as_1.default)([
|
|
|
137
118
|
getRuntime(args, options, config) {
|
|
138
119
|
return {
|
|
139
120
|
exec: ['fish', ...args],
|
|
140
|
-
|
|
141
|
-
check: ['fish', '--version'],
|
|
142
|
-
hints: ['Please install Fish from https://fishshell.com'],
|
|
143
|
-
},
|
|
121
|
+
installHints: ['Please install Fish from https://fishshell.com'],
|
|
144
122
|
};
|
|
145
123
|
},
|
|
146
124
|
},
|
|
@@ -150,10 +128,7 @@ exports.default = (0, as_1.default)([
|
|
|
150
128
|
getRuntime(args, options, config) {
|
|
151
129
|
return {
|
|
152
130
|
exec: ['lua', ...args],
|
|
153
|
-
|
|
154
|
-
check: ['lua', '-v'],
|
|
155
|
-
hints: ['Please install Lua from https://www.lua.org'],
|
|
156
|
-
},
|
|
131
|
+
installHints: ['Please install Lua from https://www.lua.org'],
|
|
157
132
|
};
|
|
158
133
|
},
|
|
159
134
|
},
|
|
@@ -163,10 +138,7 @@ exports.default = (0, as_1.default)([
|
|
|
163
138
|
getRuntime(args, options, config) {
|
|
164
139
|
return {
|
|
165
140
|
exec: ['ruby', ...args],
|
|
166
|
-
|
|
167
|
-
check: ['ruby', '-v'],
|
|
168
|
-
hints: ['Please install Ruby from https://www.ruby-lang.org'],
|
|
169
|
-
},
|
|
141
|
+
installHints: ['Please install Ruby from https://www.ruby-lang.org'],
|
|
170
142
|
};
|
|
171
143
|
},
|
|
172
144
|
},
|
|
@@ -176,10 +148,7 @@ exports.default = (0, as_1.default)([
|
|
|
176
148
|
getRuntime(args, options, config) {
|
|
177
149
|
return {
|
|
178
150
|
exec: ['go', 'run', ...args],
|
|
179
|
-
|
|
180
|
-
check: ['go', 'version'],
|
|
181
|
-
hints: ['Please install Ruby from https://www.ruby-lang.org'],
|
|
182
|
-
},
|
|
151
|
+
installHints: ['Please install Ruby from https://www.ruby-lang.org'],
|
|
183
152
|
};
|
|
184
153
|
},
|
|
185
154
|
},
|
|
@@ -191,10 +160,7 @@ exports.default = (0, as_1.default)([
|
|
|
191
160
|
return {
|
|
192
161
|
compile: ['gcc', script, '-o', output],
|
|
193
162
|
exec: [output, ...args],
|
|
194
|
-
|
|
195
|
-
check: ['gcc', '--version'],
|
|
196
|
-
hints: ['Please install GCC from https://gcc.gnu.org'],
|
|
197
|
-
},
|
|
163
|
+
installHints: ['Please install GCC from https://gcc.gnu.org'],
|
|
198
164
|
};
|
|
199
165
|
},
|
|
200
166
|
},
|
|
@@ -206,10 +172,7 @@ exports.default = (0, as_1.default)([
|
|
|
206
172
|
return {
|
|
207
173
|
compile: ['g++', script, '-o', output],
|
|
208
174
|
exec: [output, ...args],
|
|
209
|
-
|
|
210
|
-
check: ['g++', '--version'],
|
|
211
|
-
hints: ['Please install GCC from https://gcc.gnu.org'],
|
|
212
|
-
},
|
|
175
|
+
installHints: ['Please install GCC from https://gcc.gnu.org'],
|
|
213
176
|
};
|
|
214
177
|
},
|
|
215
178
|
},
|
|
@@ -221,10 +184,7 @@ exports.default = (0, as_1.default)([
|
|
|
221
184
|
return {
|
|
222
185
|
compile: ['mcs', '-out:' + output, script],
|
|
223
186
|
exec: [output, ...args],
|
|
224
|
-
|
|
225
|
-
check: ['mcs', '--version'],
|
|
226
|
-
hints: ['Please install Mono from https://www.mono-project.com'],
|
|
227
|
-
},
|
|
187
|
+
installHints: ['Please install Mono from https://www.mono-project.com'],
|
|
228
188
|
};
|
|
229
189
|
},
|
|
230
190
|
},
|
|
@@ -236,10 +196,7 @@ exports.default = (0, as_1.default)([
|
|
|
236
196
|
return {
|
|
237
197
|
compile: ['rustc', script, '-o', output],
|
|
238
198
|
exec: [output, ...args],
|
|
239
|
-
|
|
240
|
-
check: ['rustc', '--version'],
|
|
241
|
-
hints: ['Please install Rust from https://www.rust-lang.org'],
|
|
242
|
-
},
|
|
199
|
+
installHints: ['Please install Rust from https://www.rust-lang.org'],
|
|
243
200
|
};
|
|
244
201
|
},
|
|
245
202
|
},
|
|
@@ -249,11 +206,8 @@ exports.default = (0, as_1.default)([
|
|
|
249
206
|
getRuntime(args, options, config) {
|
|
250
207
|
return {
|
|
251
208
|
exec: ['sass', ...args],
|
|
252
|
-
install:
|
|
253
|
-
|
|
254
|
-
command: ['npm', 'install', '-g', 'sass'],
|
|
255
|
-
hints: ['Please install SASS from https://sass-lang.com'],
|
|
256
|
-
},
|
|
209
|
+
install: ['npm', 'install', '-g', 'sass'],
|
|
210
|
+
installHints: ['Please install SASS from https://sass-lang.com'],
|
|
257
211
|
};
|
|
258
212
|
},
|
|
259
213
|
},
|
|
@@ -263,10 +217,7 @@ exports.default = (0, as_1.default)([
|
|
|
263
217
|
getRuntime(args, options, config) {
|
|
264
218
|
return {
|
|
265
219
|
exec: ['php', ...args],
|
|
266
|
-
|
|
267
|
-
check: ['php', '--version'],
|
|
268
|
-
hints: ['Please install PHP from https://www.php.net'],
|
|
269
|
-
},
|
|
220
|
+
installHints: ['Please install PHP from https://www.php.net'],
|
|
270
221
|
};
|
|
271
222
|
},
|
|
272
223
|
},
|
|
@@ -277,13 +228,10 @@ exports.default = (0, as_1.default)([
|
|
|
277
228
|
return {
|
|
278
229
|
exec: ['light-express-server', script, ...args],
|
|
279
230
|
watchExts: ['css', 'js', 'javascript'],
|
|
280
|
-
install:
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
'Please install light-express-server from https://www.npmjs.com/package/light-express-server',
|
|
285
|
-
],
|
|
286
|
-
},
|
|
231
|
+
install: ['npm', 'install', '-g', 'light-express-server'],
|
|
232
|
+
installHints: [
|
|
233
|
+
'Please install light-express-server from https://www.npmjs.com/package/light-express-server',
|
|
234
|
+
],
|
|
287
235
|
};
|
|
288
236
|
},
|
|
289
237
|
},
|
|
@@ -7,11 +7,8 @@ export type RuntimeOptions = {
|
|
|
7
7
|
exec: string[];
|
|
8
8
|
compile?: string[];
|
|
9
9
|
watchExts?: string[];
|
|
10
|
-
install?:
|
|
11
|
-
|
|
12
|
-
hints?: string[];
|
|
13
|
-
command?: string[];
|
|
14
|
-
};
|
|
10
|
+
install?: string[];
|
|
11
|
+
installHints?: string[];
|
|
15
12
|
};
|
|
16
13
|
export type ScriptExecutorOptions = {
|
|
17
14
|
name: string;
|