UNPKG

731 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const cross_spawn_1 = require("cross-spawn");
4const lodash_1 = require("lodash");
5const ext_1 = require("../const/ext");
6const getBin_1 = require("./getBin");
7function 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}
21exports.execLocal = execLocal;