Would be awesome to be able to use ts-node as a shebang script:
#!/usr/bin/env ts-node
console.log('ohai from TypeScript');
@nevir Works for me, what's your issue?
Closing as it appears to work.
This doesn't seem to work when the file is without an extension for whatever reason. Thoughts?
It works but you will need the .ts extension. See https://github.com/TypeStrong/ts-node/issues/116.
Also if you don't want to install ts-node globally:
#!/usr/bin/env -S node -r "ts-node/register"
without the ts extension, I assume you could do something like
#!/bin/bash
ts-node whatever
A bit more complete version of @ORESoftware's example above:
#!/usr/bin/env bash
/usr/bin/env ts-node whatever.ts "$@"
What's the best way to add the project flag to the shebang?
Pretty sure it's in the readme. I'm on mobile at the moment.
On Sun, Jun 28, 2020, 5:10 PM Troy notifications@github.com wrote:
What's the best way to add the project flag to the shebang?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/TypeStrong/ts-node/issues/73#issuecomment-650822208,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAC35OHP7F47FC3T37FSA3LRY6WWFANCNFSM4B5ZUA3A
.
Ahh. I see. I need to use ts-node-script. So in an Nx project, if I'm making a publishable lib, it creates 2-3 tsconfig files. Obviously, when it is published node would run the CLI, but for testing purposes, I was thinking it would be nice to run it with ts-node from inside the same mono-repo... It might not pick up the tsconfig.lib.json, but it should pick up the tsconfig.json and if that isn't good enough, I can probably just build it before using it in mono-repo.
Yeah, we also let you override some "compilerOptions" within a tsconfig's
"ts-node": {} object. So you can tell the compiler to behave differently
in ts-node if needed. I think this is in the readme too, but if you find
the readme is insufficient, feel free to file a ticket so we can improve it.
On Sun, Jun 28, 2020, 5:33 PM Troy notifications@github.com wrote:
Ahh. I see. I need to use ts-node-script. So in an Nx project, if I'm
making a publishable lib, it creates 2-3 tsconfig files. Obviously, when it
is published node would run the CLI, but for testing purposes, I was
thinking it would be nice to run it with ts-node from inside the same
mono-repo... It might not pick up the tsconfig.lib.json, but it sounds pick
up the tsconfig.json and if that isn't good enough, I can probably just
build it before using it in mono-repo.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/TypeStrong/ts-node/issues/73#issuecomment-650824751,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAC35OHUSAKJ3HZMESZLU63RY6ZJZANCNFSM4B5ZUA3A
.
Most helpful comment
Also if you don't want to install ts-node globally: