evergreen-trace-runtime 0.1.3 → 0.1.4
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/cli.js +4 -9
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -30,23 +30,18 @@ function run() {
|
|
|
30
30
|
// { stdio: "inherit" },
|
|
31
31
|
// );
|
|
32
32
|
|
|
33
|
-
const argv = process.argv.slice(2); // ["run", "src/server.ts",
|
|
34
|
-
const [cmd,
|
|
35
|
-
if (cmd !== "run" ||
|
|
33
|
+
const argv = process.argv.slice(2); // e.g. ["run", "node", "--import", "tsx", "src/server.ts", "--", "--port", "3000"]
|
|
34
|
+
const [cmd, ...nodeArgs] = argv;
|
|
35
|
+
if (cmd !== "run" || nodeArgs.length === 0) {
|
|
36
36
|
printUsage();
|
|
37
37
|
process.exit(1);
|
|
38
38
|
}
|
|
39
|
-
const entryPath = path.resolve(process.cwd(), entry);
|
|
40
39
|
const child = spawn(
|
|
41
40
|
process.execPath,
|
|
42
41
|
[
|
|
43
|
-
"--import",
|
|
44
|
-
"tsx",
|
|
45
|
-
"--watch",
|
|
46
42
|
"--require",
|
|
47
43
|
"evergreen-trace-runtime/register",
|
|
48
|
-
|
|
49
|
-
...rest, // app-level args only
|
|
44
|
+
...nodeArgs, // everything else comes from the caller
|
|
50
45
|
],
|
|
51
46
|
{ stdio: "inherit" },
|
|
52
47
|
);
|