@webhare/tsrun
v0.509.0
Published
Run TypeScript code from the command line (esbuild wrapper)
Downloads
447
Keywords
Readme
tsrun
This is the WebHare wrapper around esbuild which maintains a cache of compiled files.
Setup
To get started:
npm install @webhare/tsrun@latest
echo 'console.log(42 as number);' > test.ts
./node_modules/.bin/tsrun test.tsNote that tsrun doesn't do any TypeScript validation. For that you will still need to set up the TypeScript compiler and you will need a tsconfig.json in its root, eg:
{
"extends": "@tsconfig/recommended",
"compilerOptions": {
"baseUrl": ".",
"noEmit": true,
"target": "es2022",
"isolatedModules": true
}
}The option "isolatedModules": true improves compatibility with esbuild
Compiled TS files are cached in $HOME/.tsrun-cache.
To debug tsrun set the environment variable ESBUILDRUNNER to debug.
WebHare integration
WebHare does not directly use or supply tsrun but builds a slightly different version of this plugin with the following changes:
- tsrun is integratedd into
wh run - You need to set
WEBHARE_DEBUG=runnerinstead ofESBUILDRUNNER=debugto debug - Compiled TS files are cached inside the whdata folder in ephemeral/compilecache/typescript (use
wh dirsand look forWEBHARE_TSBUILDCACHEto get the exact folder)
Publication source
The source code for @webhare/tsrun is part of the WebHare Platform
