This commit is contained in:
15
scripts/run-tsx.cjs
Normal file
15
scripts/run-tsx.cjs
Normal file
@@ -0,0 +1,15 @@
|
||||
const path = require('node:path');
|
||||
|
||||
const {require: tsxRequire} = require('tsx/cjs/api');
|
||||
|
||||
const [, , entry, ...restArgs] = process.argv;
|
||||
|
||||
if (!entry) {
|
||||
console.error('Usage: node scripts/run-tsx.cjs <entry.ts> [...args]');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const resolvedEntry = path.resolve(process.cwd(), entry);
|
||||
process.argv = [process.argv[0], resolvedEntry, ...restArgs];
|
||||
|
||||
tsxRequire(resolvedEntry, path.join(process.cwd(), '__tsx_runner__.cjs'));
|
||||
Reference in New Issue
Block a user