bleed-believer cli
A ts-node replacement with path alias resolution and SWC under the hood.
Basic usage
-
Install the package:
npm i --save-dev @bleed-believer/cli
-
Next, launch your application (having a tsconfig.json is optional):
#
npx bleed start ./src/index.ts
#
npx @bleed-believer/cli start ./src/index.ts
If you don't have a tsconfig.json file in cwd, the @bleed-believer/cli will run your application using this default configuration:
{
"exclude": [ "node_modules" ],
"compilerOptions": {
"target": "esnext",
"module": "nodenext",
"moduleResolution": "nodenext"
}
}
CLI Commands
-
npx bleed start [target]
Run a TypeScript file using the custom ESM loader.
[target]: The file do you want to execute.
--watch (optional): Execute as watch mode.
-- (optional): Pass arguments to the typescript file.
-
npx bleed build
Transpile all files to JavaScript (like tsc, but faster).
--watch (optional): Execute as watch mode.
--config (optional): Sets a custom tsconfig JSON file.
Using custom loader
If you want to execute your file with node and @bleed-believer/cli as loader:
node --import @bleed-believer/cli ./src/index.ts
Using with AVA
Create the file ava.config.mjs in the root folder, with this content:
export default {
files: [
'./src/**/*.test.ts',
'./src/**/*.test.mts',
],
extensions: {
ts: 'module',
mts: 'module',
},
nodeArguments: [
'--import=@bleed-believer/cli'
]
}