Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: broken shebang parameters of cli-ts-node-commonjs and cli-ts-node-esm on some linux distros #8821

Merged
merged 2 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cli-ts-node-commonjs.ts
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"
22 changes: 20 additions & 2 deletions src/cli-ts-node-esm.ts
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,
})