1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const cross_spawn_1 = require("cross-spawn");
|
4 | const lodash_1 = require("lodash");
|
5 | const ext_1 = require("../const/ext");
|
6 | const getBin_1 = require("./getBin");
|
7 | function execLocal(path, args = [], opts) {
|
8 | args = [path].concat(args);
|
9 | if (ext_1.ext === 'ts') {
|
10 | args = [getBin_1.getBin('ts-node', 'ts-node')].concat(args);
|
11 | }
|
12 | const defaultOpts = {
|
13 | encoding: 'utf8',
|
14 | env: Object.assign({}, process.env, {
|
15 | TS_NODE_TRANSPILE_ONLY: '1'
|
16 | })
|
17 | };
|
18 | const options = lodash_1.merge(defaultOpts, opts || {});
|
19 | return cross_spawn_1.sync(process.execPath, args, options);
|
20 | }
|
21 | exports.execLocal = execLocal;
|