uni-run 1.1.10 → 1.1.12

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 CHANGED
@@ -1,5 +1,3 @@
1
- Here is the corrected grammar for your document:
2
-
3
1
  # uni-run
4
2
 
5
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.
@@ -16,4 +16,6 @@ export default class Execution {
16
16
  private killProcess;
17
17
  private clearBeforeStart;
18
18
  private renderInfoLogs;
19
+ private startBenchmark;
20
+ private endBenchmark;
19
21
  }
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-run",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "Universal Runner for many language",
5
5
  "type": "commonjs",
6
6
  "scripts": {