uni-run 1.0.5 → 1.0.7
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 +122 -0
- package/dist/app.cjs +60 -0
- package/dist/app.d.mts +1 -0
- package/dist/{index.js → app.mjs} +8 -10
- package/dist/{arg-helper.js → arg-helper.cjs} +49 -33
- package/dist/{arg-helper.d.ts → arg-helper.d.cts} +60 -46
- package/dist/arg-helper.d.mts +129 -0
- package/dist/arg-helper.mjs +98 -0
- package/dist/{arg.js → arg.cjs} +5 -2
- package/dist/{arg.d.ts → arg.d.cts} +109 -83
- package/dist/arg.d.mts +257 -0
- package/dist/arg.mjs +9 -0
- package/dist/{bin.js → bin.cjs} +2 -2
- package/dist/{bin.d.ts → bin.d.cts} +1 -1
- package/dist/bin.d.mts +2 -0
- package/dist/bin.mjs +4 -0
- package/dist/builtin-bin/{Executor.js → Executor.cjs} +5 -2
- package/dist/builtin-bin/{Executor.d.ts → Executor.d.cts} +1 -1
- package/dist/builtin-bin/Executor.d.mts +21 -0
- package/dist/builtin-bin/Executor.mjs +61 -0
- package/dist/builtin-bin/{index.js → index.cjs} +4 -1
- package/dist/builtin-bin/{index.d.ts → index.d.cts} +1 -1
- package/dist/builtin-bin/index.d.mts +3 -0
- package/dist/builtin-bin/index.mjs +94 -0
- package/dist/execution/gitignore.cjs +40 -0
- package/dist/execution/gitignore.d.mts +1 -0
- package/dist/execution/gitignore.mjs +11 -0
- package/dist/execution/{index.js → index.cjs} +37 -9
- package/dist/execution/{index.d.ts → index.d.cts} +1 -1
- package/dist/execution/index.d.mts +15 -0
- package/dist/execution/index.mjs +105 -0
- package/dist/execution/kill-process.cjs +50 -0
- package/dist/execution/{kill-process.d.ts → kill-process.d.cts} +1 -1
- package/dist/execution/kill-process.d.mts +2 -0
- package/dist/execution/{kill-process.js → kill-process.mjs} +4 -7
- package/dist/execution/watcher.cjs +60 -0
- package/dist/execution/watcher.d.cts +6 -0
- package/dist/execution/watcher.d.mts +6 -0
- package/dist/execution/watcher.mjs +31 -0
- package/dist/index.cjs +19 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.mjs +13 -0
- package/dist/lib/colors.cjs +32 -0
- package/dist/lib/colors.d.cts +3 -0
- package/dist/lib/colors.d.mts +3 -0
- package/dist/lib/colors.mjs +4 -0
- package/dist/lib/currentModule.cjs +19 -0
- package/dist/lib/currentModule.d.cts +5 -0
- package/dist/lib/currentModule.d.mts +5 -0
- package/dist/lib/currentModule.mjs +17 -0
- package/dist/utils/debounce.d.mts +1 -0
- package/dist/utils/debounce.mjs +7 -0
- package/package.json +11 -8
- package/dist/execution/gitignore.js +0 -14
- package/dist/execution/watcher.d.ts +0 -6
- package/dist/execution/watcher.js +0 -38
- package/dist/lib/colors.d.ts +0 -2
- package/dist/lib/colors.js +0 -4
- /package/dist/{index.d.ts → app.d.cts} +0 -0
- /package/dist/execution/{gitignore.d.ts → gitignore.d.cts} +0 -0
- /package/dist/utils/{debounce.js → debounce.cjs} +0 -0
- /package/dist/utils/{debounce.d.ts → debounce.d.cts} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# uni-run
|
|
2
|
+
|
|
3
|
+
`uni-run` is a versatile CLI tool designed to run various types of scripts, including but not limited to JavaScript, TypeScript, Python, Java, HTML, SASS, Lua and more. It provides a unified interface to execute scripts with additional features like watching for file changes, benchmarking execution time, and more.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Watch Mode**: Automatically re-run scripts when files change.
|
|
8
|
+
- **Benchmarking**: Measure and display the execution time of scripts.
|
|
9
|
+
- **Environment Variables**: Set environment variables for the script execution.
|
|
10
|
+
- **Shell Execution**: Run scripts in a shell for more control.
|
|
11
|
+
- **Console Clearing**: Clear the console before running the script.
|
|
12
|
+
- **Reload Key**: Enable reloading the script with a specific key combination.
|
|
13
|
+
- **Information Display**: Show detailed information about the script execution.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
To install `uni-run`, use npm:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm install -g uni-run
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## CLI Usage
|
|
24
|
+
|
|
25
|
+
### Basic Command
|
|
26
|
+
|
|
27
|
+
To run a script, use the following command:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
run script.ext [options] -- [args for internal bin]
|
|
31
|
+
uni-run script.ext [options] -- [args for internal bin]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Examples
|
|
35
|
+
|
|
36
|
+
#### Running a JavaScript File
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
run ./scripts/main.js
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### Running a TypeScript File
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
run ./scripts/main.ts
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### Running a Python File
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
run ./scripts/main.py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Running a Java File
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
run ./scripts/Main.java
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### Running with script argv
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
run ./scripts/main.js -- --some someValue
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Here `--some someValue` will be passed to `node` and will be ignored by uni-run.
|
|
67
|
+
|
|
68
|
+
## API
|
|
69
|
+
|
|
70
|
+
The `uni-run` package provides a simple API to manage and execute scripts.
|
|
71
|
+
|
|
72
|
+
#### `addBin(bin: Executor)`:
|
|
73
|
+
|
|
74
|
+
The `Executor` class is imported from `uni-run` and is used to manage script execution.
|
|
75
|
+
Adds a new `Executor` instance to the list of built-in binaries.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import uniRun, { Executor } from 'uni-run'
|
|
79
|
+
|
|
80
|
+
const executor = new Executor('Name', {
|
|
81
|
+
extensions: ['something'],
|
|
82
|
+
run(args, options) {
|
|
83
|
+
return ['something-binary', ...args]
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
uniRun.addBin(executor)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### `start(args?: string[])`:
|
|
91
|
+
|
|
92
|
+
Starts the application with the provided arguments.
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import uniRun from 'uni-run'
|
|
96
|
+
|
|
97
|
+
uniRun.start(['arg1', 'arg2'])
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Example Usage
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import uniRun, { Executor } from 'uni-run'
|
|
104
|
+
|
|
105
|
+
// Create a new Executor instance
|
|
106
|
+
const executor = new Executor('Name', {
|
|
107
|
+
extensions: ['some'],
|
|
108
|
+
run(args, options) {
|
|
109
|
+
return ['something-binary', ...args]
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
// Add the Executor to uni-run
|
|
114
|
+
uniRun.addBin(executor)
|
|
115
|
+
|
|
116
|
+
// Start the application with arguments
|
|
117
|
+
uniRun.start(['arg1.some'])
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
This project is licensed under the MIT License.
|
package/dist/app.cjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const arg = __importStar(require("./arg.cjs"));
|
|
30
|
+
const execution_1 = __importDefault(require("./execution/index.cjs"));
|
|
31
|
+
const builtin_bin_1 = __importDefault(require("./builtin-bin/index.cjs"));
|
|
32
|
+
const arg_helper_1 = require("./arg-helper.cjs");
|
|
33
|
+
arg.app.on(([script, listArs, trailingArgs], flags) => {
|
|
34
|
+
const bin = builtin_bin_1.default.find((bin) => bin.isSupported(script));
|
|
35
|
+
if (!bin) {
|
|
36
|
+
console.log('Unsupported script:', script);
|
|
37
|
+
return console.log('You may try "ur exec bin script.ext - --flags"');
|
|
38
|
+
}
|
|
39
|
+
const executionOptions = (0, arg_helper_1.mapFlagsToOptions)(flags, bin);
|
|
40
|
+
bin.start(executionOptions, [script, ...listArs, ...trailingArgs]);
|
|
41
|
+
});
|
|
42
|
+
arg.exec.on(([listArs, trailingArgs], flags) => {
|
|
43
|
+
execution_1.default.start([...listArs, ...trailingArgs], (0, arg_helper_1.mapFlagsToOptions)(flags));
|
|
44
|
+
});
|
|
45
|
+
arg.list.on(() => {
|
|
46
|
+
console.log('Supported scripts:');
|
|
47
|
+
builtin_bin_1.default
|
|
48
|
+
.sort((a, b) => {
|
|
49
|
+
const aName = a.getName();
|
|
50
|
+
const bName = b.getName();
|
|
51
|
+
if (aName < bName)
|
|
52
|
+
return -1;
|
|
53
|
+
if (aName > bName)
|
|
54
|
+
return 1;
|
|
55
|
+
return 0;
|
|
56
|
+
})
|
|
57
|
+
.forEach((bin) => {
|
|
58
|
+
console.log(`- ${bin.getName()}`);
|
|
59
|
+
});
|
|
60
|
+
});
|
package/dist/app.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const builtin_bin_1 = require("./builtin-bin");
|
|
6
|
-
const arg_helper_1 = require("./arg-helper");
|
|
1
|
+
import * as arg from "./arg.mjs";
|
|
2
|
+
import Execution from "./execution/index.mjs";
|
|
3
|
+
import builtinBin from "./builtin-bin/index.mjs";
|
|
4
|
+
import { mapFlagsToOptions } from "./arg-helper.mjs";
|
|
7
5
|
arg.app.on(([script, listArs, trailingArgs], flags) => {
|
|
8
|
-
const bin =
|
|
6
|
+
const bin = builtinBin.find((bin) => bin.isSupported(script));
|
|
9
7
|
if (!bin) {
|
|
10
8
|
console.log('Unsupported script:', script);
|
|
11
9
|
return console.log('You may try "ur exec bin script.ext - --flags"');
|
|
12
10
|
}
|
|
13
|
-
const executionOptions =
|
|
11
|
+
const executionOptions = mapFlagsToOptions(flags, bin);
|
|
14
12
|
bin.start(executionOptions, [script, ...listArs, ...trailingArgs]);
|
|
15
13
|
});
|
|
16
14
|
arg.exec.on(([listArs, trailingArgs], flags) => {
|
|
17
|
-
|
|
15
|
+
Execution.start([...listArs, ...trailingArgs], mapFlagsToOptions(flags));
|
|
18
16
|
});
|
|
19
17
|
arg.list.on(() => {
|
|
20
18
|
console.log('Supported scripts:');
|
|
21
|
-
|
|
19
|
+
builtinBin
|
|
22
20
|
.sort((a, b) => {
|
|
23
21
|
const aName = a.getName();
|
|
24
22
|
const bName = b.getName();
|
|
@@ -1,10 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.executionConfig = void 0;
|
|
4
7
|
exports.mapFlagsToOptions = mapFlagsToOptions;
|
|
5
|
-
const noarg_1 = require("noarg");
|
|
8
|
+
const noarg_1 = __importDefault(require("noarg"));
|
|
6
9
|
exports.executionConfig = noarg_1.default.defineConfig({
|
|
7
10
|
flags: {
|
|
11
|
+
reloadKey: noarg_1.default.boolean()
|
|
12
|
+
.aliases('rk')
|
|
13
|
+
.default(true)
|
|
14
|
+
.description("Reload the page when pressing 'Ctrl+R' or 'F5'"),
|
|
15
|
+
watch: noarg_1.default.boolean()
|
|
16
|
+
.aliases('w')
|
|
17
|
+
.default(true)
|
|
18
|
+
.description('Watch for changes'),
|
|
19
|
+
exit: noarg_1.default.boolean()
|
|
20
|
+
.default(false)
|
|
21
|
+
.description('Exit after code execution, disabling `watch` and `reloadKey`'),
|
|
22
|
+
clear: noarg_1.default.boolean()
|
|
23
|
+
.aliases('c')
|
|
24
|
+
.default(true)
|
|
25
|
+
.description('Clear the console before running the script'),
|
|
26
|
+
delay: noarg_1.default.number()
|
|
27
|
+
.aliases('d')
|
|
28
|
+
.default(100)
|
|
29
|
+
.description('The delay to wait for the watcher to trigger'),
|
|
30
|
+
ext: noarg_1.default.array(noarg_1.default.string())
|
|
31
|
+
.aliases('e')
|
|
32
|
+
.default([])
|
|
33
|
+
.description('Looks for changes only of the given extensions'),
|
|
34
|
+
include: noarg_1.default.array(noarg_1.default.string())
|
|
35
|
+
.aliases('in')
|
|
36
|
+
.default([])
|
|
37
|
+
.description('Only watch the given folders/files'),
|
|
38
|
+
exclude: noarg_1.default.array(noarg_1.default.string())
|
|
39
|
+
.aliases('ex')
|
|
40
|
+
.default([])
|
|
41
|
+
.description('Exclude the given folders/files'),
|
|
42
|
+
bench: noarg_1.default.boolean()
|
|
43
|
+
.aliases('b')
|
|
44
|
+
.description('Calculate the execution time'),
|
|
45
|
+
benchPrefix: noarg_1.default.string()
|
|
46
|
+
.aliases('bp')
|
|
47
|
+
.minLength(1)
|
|
48
|
+
.description('The prefix to show before the execution time'),
|
|
8
49
|
cwd: noarg_1.default.string()
|
|
9
50
|
.default(process.cwd())
|
|
10
51
|
.description('Current working directory'),
|
|
@@ -17,37 +58,10 @@ exports.executionConfig = noarg_1.default.defineConfig({
|
|
|
17
58
|
time: noarg_1.default.boolean()
|
|
18
59
|
.default(false)
|
|
19
60
|
.description('Show the execution time at the start'),
|
|
20
|
-
bench: noarg_1.default.boolean()
|
|
21
|
-
.default(false)
|
|
22
|
-
.description('Show the execution time'),
|
|
23
|
-
benchPrefix: noarg_1.default.string().description('The prefix for the benchmark to show at the start of the line'),
|
|
24
|
-
clear: noarg_1.default.boolean()
|
|
25
|
-
.default(true)
|
|
26
|
-
.description('Clear the console before running the script')
|
|
27
|
-
.aliases('c'),
|
|
28
|
-
reloadKey: noarg_1.default.boolean()
|
|
29
|
-
.default(true)
|
|
30
|
-
.description("Reload the page when pressing 'Ctrl+R' or 'F5'")
|
|
31
|
-
.aliases('rk'),
|
|
32
|
-
watch: noarg_1.default.boolean()
|
|
33
|
-
.default(true)
|
|
34
|
-
.description('Watch for changes')
|
|
35
|
-
.aliases('w'),
|
|
36
|
-
delay: noarg_1.default.number()
|
|
37
|
-
.default(100)
|
|
38
|
-
.description('The delay to wait for the watcher to trigger')
|
|
39
|
-
.aliases('d'),
|
|
40
|
-
ext: noarg_1.default.array(noarg_1.default.string())
|
|
41
|
-
.default([])
|
|
42
|
-
.description('Looks for changes only of the given extensions')
|
|
43
|
-
.aliases('e'),
|
|
44
|
-
ignore: noarg_1.default.array(noarg_1.default.string())
|
|
45
|
-
.default([])
|
|
46
|
-
.description('Ignore the given folders/files')
|
|
47
|
-
.aliases('ig'),
|
|
48
61
|
env: noarg_1.default.array(noarg_1.default.string())
|
|
49
62
|
.default([])
|
|
50
63
|
.description('Environment variables'),
|
|
64
|
+
// Extra flags
|
|
51
65
|
nodeDev: noarg_1.default.boolean()
|
|
52
66
|
.default(false)
|
|
53
67
|
.description('Set NODE_ENV to "development"'),
|
|
@@ -66,18 +80,20 @@ exports.executionConfig = noarg_1.default.defineConfig({
|
|
|
66
80
|
},
|
|
67
81
|
});
|
|
68
82
|
function mapFlagsToOptions(flags, bin) {
|
|
83
|
+
var _a;
|
|
69
84
|
return {
|
|
70
85
|
cwd: flags.cwd,
|
|
71
86
|
shell: flags.shell,
|
|
72
87
|
showInfo: flags.info,
|
|
73
88
|
showTime: flags.time,
|
|
74
|
-
benchmark: flags.bench,
|
|
89
|
+
benchmark: (_a = flags.bench) !== null && _a !== void 0 ? _a : Boolean(flags.benchPrefix),
|
|
75
90
|
benchmarkPrefix: flags.benchPrefix,
|
|
76
91
|
clearOnReload: flags.clear,
|
|
77
|
-
|
|
78
|
-
watch: flags.watch,
|
|
92
|
+
keystrokeReload: flags.exit ? false : flags.reloadKey,
|
|
93
|
+
watch: flags.exit ? false : flags.watch,
|
|
79
94
|
watchDelay: flags.delay,
|
|
80
|
-
|
|
95
|
+
watchInclude: flags.include,
|
|
96
|
+
watchExclude: flags.exclude,
|
|
81
97
|
watchExtensions: (flags.ext.length ? flags.ext : bin === null || bin === void 0 ? void 0 : bin.getRelatedExts()) || [],
|
|
82
98
|
tsNode: flags['tsn'],
|
|
83
99
|
env: Object.assign(Object.assign({}, flags.env.reduce((acc, env) => {
|
|
@@ -1,73 +1,86 @@
|
|
|
1
|
-
import NoArg from
|
|
2
|
-
import type { app } from
|
|
3
|
-
import Executor from
|
|
1
|
+
import NoArg from "noarg";
|
|
2
|
+
import type { app } from "./arg.cjs";
|
|
3
|
+
import Executor from "./builtin-bin/Executor.cjs";
|
|
4
4
|
export declare const executionConfig: {
|
|
5
5
|
readonly flags: {
|
|
6
|
-
readonly
|
|
7
|
-
|
|
8
|
-
default: string;
|
|
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";
|
|
15
|
-
}>;
|
|
16
|
-
readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
6
|
+
readonly reloadKey: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
7
|
+
aliases: ["rk"];
|
|
17
8
|
required: true;
|
|
18
|
-
default:
|
|
19
|
-
description: "
|
|
9
|
+
default: true;
|
|
10
|
+
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
20
11
|
}>;
|
|
21
|
-
readonly
|
|
12
|
+
readonly watch: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
13
|
+
aliases: ["w"];
|
|
22
14
|
required: true;
|
|
23
|
-
default:
|
|
24
|
-
description: "
|
|
15
|
+
default: true;
|
|
16
|
+
description: "Watch for changes";
|
|
25
17
|
}>;
|
|
26
|
-
readonly
|
|
18
|
+
readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
27
19
|
required: true;
|
|
28
20
|
default: false;
|
|
29
|
-
description: "
|
|
30
|
-
}>;
|
|
31
|
-
readonly benchPrefix: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
32
|
-
description: "The prefix for the benchmark to show at the start of the line";
|
|
21
|
+
description: "Exit after code execution, disabling `watch` and `reloadKey`";
|
|
33
22
|
}>;
|
|
34
23
|
readonly clear: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
35
|
-
|
|
24
|
+
aliases: ["c"];
|
|
36
25
|
required: true;
|
|
37
26
|
default: true;
|
|
38
|
-
|
|
39
|
-
}>;
|
|
40
|
-
readonly reloadKey: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
41
|
-
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
42
|
-
required: true;
|
|
43
|
-
default: true;
|
|
44
|
-
aliases: [string];
|
|
45
|
-
}>;
|
|
46
|
-
readonly watch: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
47
|
-
description: "Watch for changes";
|
|
48
|
-
required: true;
|
|
49
|
-
default: true;
|
|
50
|
-
aliases: [string];
|
|
27
|
+
description: "Clear the console before running the script";
|
|
51
28
|
}>;
|
|
52
29
|
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
53
|
-
|
|
30
|
+
aliases: ["d"];
|
|
54
31
|
required: true;
|
|
55
32
|
default: 100;
|
|
56
|
-
|
|
33
|
+
description: "The delay to wait for the watcher to trigger";
|
|
57
34
|
}>;
|
|
58
35
|
readonly ext: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
36
|
+
aliases: ["e"];
|
|
37
|
+
required: true;
|
|
38
|
+
default: never[];
|
|
39
|
+
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
59
40
|
description: "Looks for changes only of the given extensions";
|
|
41
|
+
}>;
|
|
42
|
+
readonly include: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
43
|
+
aliases: ["in"];
|
|
60
44
|
required: true;
|
|
61
45
|
default: never[];
|
|
62
46
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
63
|
-
|
|
47
|
+
description: "Only watch the given folders/files";
|
|
64
48
|
}>;
|
|
65
|
-
readonly
|
|
66
|
-
|
|
49
|
+
readonly exclude: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
50
|
+
aliases: ["ex"];
|
|
67
51
|
required: true;
|
|
68
52
|
default: never[];
|
|
69
53
|
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
70
|
-
|
|
54
|
+
description: "Exclude the given folders/files";
|
|
55
|
+
}>;
|
|
56
|
+
readonly bench: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
57
|
+
aliases: ["b"];
|
|
58
|
+
description: "Calculate the execution time";
|
|
59
|
+
}>;
|
|
60
|
+
readonly benchPrefix: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
61
|
+
aliases: ["bp"];
|
|
62
|
+
minLength: 1;
|
|
63
|
+
description: "The prefix to show before the execution time";
|
|
64
|
+
}>;
|
|
65
|
+
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
66
|
+
required: true;
|
|
67
|
+
default: string;
|
|
68
|
+
description: "Current working directory";
|
|
69
|
+
}>;
|
|
70
|
+
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
71
|
+
required: true;
|
|
72
|
+
default: false;
|
|
73
|
+
description: "Run the script in a shell for more low-level control";
|
|
74
|
+
}>;
|
|
75
|
+
readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
76
|
+
required: true;
|
|
77
|
+
default: false;
|
|
78
|
+
description: "Show information about the script";
|
|
79
|
+
}>;
|
|
80
|
+
readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
81
|
+
required: true;
|
|
82
|
+
default: false;
|
|
83
|
+
description: "Show the execution time at the start";
|
|
71
84
|
}>;
|
|
72
85
|
readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
73
86
|
required: true;
|
|
@@ -105,10 +118,11 @@ export declare function mapFlagsToOptions(flags: NoArg.InferFlags<typeof app>, b
|
|
|
105
118
|
benchmark: boolean;
|
|
106
119
|
benchmarkPrefix: string | undefined;
|
|
107
120
|
clearOnReload: boolean;
|
|
108
|
-
|
|
121
|
+
keystrokeReload: boolean;
|
|
109
122
|
watch: boolean;
|
|
110
123
|
watchDelay: number;
|
|
111
|
-
|
|
124
|
+
watchInclude: string[];
|
|
125
|
+
watchExclude: string[];
|
|
112
126
|
watchExtensions: string[];
|
|
113
127
|
tsNode: boolean;
|
|
114
128
|
env: NodeJS.ProcessEnv;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import NoArg from "noarg";
|
|
2
|
+
import type { app } from "./arg.mjs";
|
|
3
|
+
import Executor from "./builtin-bin/Executor.mjs";
|
|
4
|
+
export declare const executionConfig: {
|
|
5
|
+
readonly flags: {
|
|
6
|
+
readonly reloadKey: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
7
|
+
aliases: ["rk"];
|
|
8
|
+
required: true;
|
|
9
|
+
default: true;
|
|
10
|
+
description: "Reload the page when pressing 'Ctrl+R' or 'F5'";
|
|
11
|
+
}>;
|
|
12
|
+
readonly watch: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
13
|
+
aliases: ["w"];
|
|
14
|
+
required: true;
|
|
15
|
+
default: true;
|
|
16
|
+
description: "Watch for changes";
|
|
17
|
+
}>;
|
|
18
|
+
readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
19
|
+
required: true;
|
|
20
|
+
default: false;
|
|
21
|
+
description: "Exit after code execution, disabling `watch` and `reloadKey`";
|
|
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";
|
|
28
|
+
}>;
|
|
29
|
+
readonly delay: import("noarg/dist/schema/TypeNumber.cjs").TypeNumber<{
|
|
30
|
+
aliases: ["d"];
|
|
31
|
+
required: true;
|
|
32
|
+
default: 100;
|
|
33
|
+
description: "The delay to wait for the watcher to trigger";
|
|
34
|
+
}>;
|
|
35
|
+
readonly ext: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
36
|
+
aliases: ["e"];
|
|
37
|
+
required: true;
|
|
38
|
+
default: never[];
|
|
39
|
+
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
40
|
+
description: "Looks for changes only of the given extensions";
|
|
41
|
+
}>;
|
|
42
|
+
readonly include: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
43
|
+
aliases: ["in"];
|
|
44
|
+
required: true;
|
|
45
|
+
default: never[];
|
|
46
|
+
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
47
|
+
description: "Only watch the given folders/files";
|
|
48
|
+
}>;
|
|
49
|
+
readonly exclude: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
50
|
+
aliases: ["ex"];
|
|
51
|
+
required: true;
|
|
52
|
+
default: never[];
|
|
53
|
+
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
54
|
+
description: "Exclude the given folders/files";
|
|
55
|
+
}>;
|
|
56
|
+
readonly bench: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
57
|
+
aliases: ["b"];
|
|
58
|
+
description: "Calculate the execution time";
|
|
59
|
+
}>;
|
|
60
|
+
readonly benchPrefix: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
61
|
+
aliases: ["bp"];
|
|
62
|
+
minLength: 1;
|
|
63
|
+
description: "The prefix to show before the execution time";
|
|
64
|
+
}>;
|
|
65
|
+
readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
|
|
66
|
+
required: true;
|
|
67
|
+
default: string;
|
|
68
|
+
description: "Current working directory";
|
|
69
|
+
}>;
|
|
70
|
+
readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
71
|
+
required: true;
|
|
72
|
+
default: false;
|
|
73
|
+
description: "Run the script in a shell for more low-level control";
|
|
74
|
+
}>;
|
|
75
|
+
readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
76
|
+
required: true;
|
|
77
|
+
default: false;
|
|
78
|
+
description: "Show information about the script";
|
|
79
|
+
}>;
|
|
80
|
+
readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
81
|
+
required: true;
|
|
82
|
+
default: false;
|
|
83
|
+
description: "Show the execution time at the start";
|
|
84
|
+
}>;
|
|
85
|
+
readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
|
|
86
|
+
required: true;
|
|
87
|
+
default: never[];
|
|
88
|
+
schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
89
|
+
description: "Environment variables";
|
|
90
|
+
}>;
|
|
91
|
+
readonly nodeDev: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
92
|
+
required: true;
|
|
93
|
+
default: false;
|
|
94
|
+
description: "Set NODE_ENV to \"development\"";
|
|
95
|
+
}>;
|
|
96
|
+
readonly tsn: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
|
|
97
|
+
required: true;
|
|
98
|
+
default: false;
|
|
99
|
+
description: "Run the script with ts-node";
|
|
100
|
+
}>;
|
|
101
|
+
};
|
|
102
|
+
readonly listArgument: {
|
|
103
|
+
readonly name: "args for script";
|
|
104
|
+
readonly description: "The arguments to pass to the script";
|
|
105
|
+
readonly type: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
|
|
106
|
+
};
|
|
107
|
+
readonly trailingArguments: "--";
|
|
108
|
+
readonly customRenderHelp: {
|
|
109
|
+
readonly helpUsageTrailingArgsLabel: "...[args/flags for script]";
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export type ExecuteOptions = ReturnType<typeof mapFlagsToOptions>;
|
|
113
|
+
export declare function mapFlagsToOptions(flags: NoArg.InferFlags<typeof app>, bin?: Executor): {
|
|
114
|
+
cwd: string;
|
|
115
|
+
shell: boolean;
|
|
116
|
+
showInfo: boolean;
|
|
117
|
+
showTime: boolean;
|
|
118
|
+
benchmark: boolean;
|
|
119
|
+
benchmarkPrefix: string | undefined;
|
|
120
|
+
clearOnReload: boolean;
|
|
121
|
+
keystrokeReload: boolean;
|
|
122
|
+
watch: boolean;
|
|
123
|
+
watchDelay: number;
|
|
124
|
+
watchInclude: string[];
|
|
125
|
+
watchExclude: string[];
|
|
126
|
+
watchExtensions: string[];
|
|
127
|
+
tsNode: boolean;
|
|
128
|
+
env: NodeJS.ProcessEnv;
|
|
129
|
+
};
|