Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: broken shebang parameters of
cli-ts-node-commonjs
and `cli-ts-…
…node-esm` on some linux distros (#8821) Changed to nodejs workaround instead of relying on shebang parameters, as they work a bit differently on some linux distros, and using the "-S" parameter breaks the CLI on Windows Closes #8818
- Loading branch information
Showing
2 changed files
with
22 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#!/usr/bin/env node --require ts-node/register | ||
#!/usr/bin/env node | ||
require("ts-node").register() | ||
import "./cli" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
#!/usr/bin/env node --loader ts-node/esm --no-warnings | ||
import "./cli" | ||
#!/usr/bin/env node | ||
import { spawnSync } from "child_process" | ||
|
||
if ((process.env["NODE_OPTIONS"] || "").includes("--loader ts-node")) | ||
require("./cli") | ||
else | ||
spawnSync(process.argv[0], process.argv.slice(1), { | ||
stdio: "inherit", | ||
env: { | ||
...process.env, | ||
NODE_OPTIONS: [ | ||
process.env["NODE_OPTIONS"], | ||
"--loader ts-node/esm", | ||
"--no-warnings", | ||
] | ||
.filter((item) => !!item) | ||
.join(" "), | ||
}, | ||
windowsHide: true, | ||
}) |