UNPKG

@tywalk/pcf-helper

Version:

Command line helper for building and publishing PCF controls to Dataverse.

32 lines (31 loc) 1.58 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.runBuild = runBuild; const child_process_1 = require("child_process"); const performanceUtil_1 = require("../util/performanceUtil"); const commandUtil_1 = require("../util/commandUtil"); const color_logger_1 = __importDefault(require("@tywalk/color-logger")); /** * Builds the Power Apps component framework project. * * @param {string} path The path to the project folder containing the pcfproj.json file. * @param {boolean} verbose - If true, additional debug information is logged. * @param {number} [timeout] - Optional timeout in milliseconds for the build process. * * @returns {number} The exit code of the spawned process. */ function runBuild(path, verbose, timeout) { color_logger_1.default.log('[PCF Helper] ' + (0, performanceUtil_1.formatTime)(new Date()) + ' Starting build...\n'); const tick = performance.now(); const buildCommand = (0, commandUtil_1.resolveSpawnCommand)('dotnet', ['build', '--restore', '-c', 'Release', path]); const task = (0, child_process_1.spawnSync)(buildCommand.command, buildCommand.args, { cwd: process.cwd(), stdio: 'inherit', killSignal: 'SIGKILL', timeout: timeout !== null && timeout !== void 0 ? timeout : 1000 * 60 * 5 // 5 minutes }); return (0, performanceUtil_1.handleTaskCompletion)(task, 'build', performance.now() - tick, verbose); }