21 lines
503 B
TypeScript
21 lines
503 B
TypeScript
import * as tsNode from 'ts-node';
|
|
import * as path from 'path';
|
|
|
|
tsNode.register({
|
|
compilerOptions: {
|
|
lib: [ 'es2016', 'es2017' ]
|
|
},
|
|
ignore: ['^(.(.*\.d\.ts))*$'],
|
|
cacheDirectory: path.join(__dirname, '../tscache')
|
|
});
|
|
|
|
if (process.env.CLI_CALL_TSRUN) {
|
|
// contents of argv array
|
|
// process.argv[0] -> node Executable
|
|
// process.argv[1] -> tsrun executable
|
|
const pathToTsFile = process.argv[2]
|
|
|
|
const pathToLoad = path.join(process.cwd(), pathToTsFile);
|
|
import(pathToLoad);
|
|
}
|