Faster Executor for TypeScript using @swc/core
npm:
npm i -D rscutepnpm:
pnpm add -D rscuteWhen using pnpm, use pnpm exec instead of npx for running commands.
Run your TypeScript files directly from the command line.
Run a single file:
npx rscute script.tsRun multiple files (sequential by default):
npx rscute script-a.ts script-b.tsRun multiple files in parallel(-p or --parallel):
npx rscute script-a.ts script-b.ts -pEnable on-the-fly TypeScript compilation for require().
From the command line:
node -r rscute script.tsFrom within your code:
const { register } = require('rscute/register');
register();
require('./filename.ts');Use rscute's APIs for advanced control within your own scripts.
execute(absolutePath)
The core API to execute a single file. Requires an absolute path for robust execution.
import { execute } from 'rscute/execute';
import path from 'path';
const absolutePath = path.resolve(__dirname, './script.ts');
execute(absolutePath);run(files, options)
The API for the CLI. Handles relative paths, multiple files, and execution modes.
import { run } from 'rscute/cli';
// Run two files in parallel(default: sequential)
await run(['./script-a.ts', './script-b.ts'], { mode: 'parallel' });rscute executes the code that did the path resolution in the Function constructor, which is done in memory. Supported extensions are .js, .ts, .mjs, .mts, .cjs, .cts, .jsx, and .tsx.
rscute is MIT licensed.