tsrun/ts/index.ts

20 lines
449 B
TypeScript
Raw Normal View History

2018-06-04 21:25:19 +00:00
import * as tsNode from 'ts-node';
import * as path from 'path';
tsNode.register({
compilerOptions: {
2018-06-05 21:40:59 +00:00
lib: [ 'es2016', 'es2017' ]
},
2018-06-30 17:20:36 +00:00
ignore: ['^(.(.*\.d\.ts))*$']
2018-06-04 21:25:19 +00:00
});
if (process.env.CLI_CALL_TSRUN) {
2018-06-25 08:23:15 +00:00
// 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);
2018-06-05 21:40:59 +00:00
import(pathToLoad);
}