UNPKG

@ma3-pro-plugins/ma3-ts-plugin-builder

Version:
48 lines 2.25 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.runTstlWatch = exports.runTstl = void 0; const logger_1 = __importDefault(require("../utils/logger")); const node_child_process_1 = require("node:child_process"); function runTstl(tsconfig) { logger_1.default.info(`Running TSTL`); (0, node_child_process_1.execSync)(`tstl -p ${tsconfig}`, { stdio: "inherit" }); } exports.runTstl = runTstl; function runTstlWatch(tsconfig) { return __awaiter(this, void 0, void 0, function* () { logger_1.default.info(`Running TSTL Watch mode`); return new Promise((resolve) => { const props = ["-p", tsconfig, "--watch"]; const proc = (0, node_child_process_1.spawn)("tstl", props); proc.stdout.on("data", (data) => { logger_1.default.info(data.toString()); }); proc.on("error", (err) => { logger_1.default.error(`error: ${err}`); }); proc.stderr.on("data", (data) => { logger_1.default.error(`stderr: ${data}`); }); proc.on("close", (code) => { if (code !== 0) { logger_1.default.info(`tstl child process exited with code ${code}`); } resolve(); }); }); }); } exports.runTstlWatch = runTstlWatch; //# sourceMappingURL=tstlRunner.js.map