website/docs/recipes/npx-and-yarn-dlx.md
Using npx or yarn dlx is a great ways to publish reusable TypeScript tools to GitHub without precompiling or packaging.
Check out our working example: TypeStrong/ts-node-npx-example
npx typestrong/ts-node-npx-example --help
npx typestrong/ts-node-npx-example --first Arthur --last Dent
TODO publish demo and link to it TODO test demo:
This boilerplate is a good starting point:
{
"bin": "./cli.ts",
"dependencies": {
"ts-node": "latest",
"@swc/core": "latest",
"@swc/helpers": "latest",
"@tsconfig/node16": "latest"
}
}
{
"extends": "@tsconfig/node16/tsconfig.json",
"ts-node": {
"swc": true
}
}
#!/usr/bin/env ts-node
console.log("Hello world!")
If you require native ESM support, use ts-node-esm in your shebang and follow the configuration instructions for ESM: Native ECMAScript modules
#!/usr/bin/env ts-node-esm