UNPKG

nativescript

Version:

Command-line interface for building NativeScript projects

84 lines 3.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.originalProcessOn = void 0; require("./bootstrap"); const shelljs = require("shelljs"); shelljs.config.silent = true; shelljs.config.fatal = true; if (process.platform === "win32") { // Later versions of shelljs do not process globs with \ path delimiters correctly, for windows change to / const realcp = shelljs.cp; shelljs.cp = (...args) => { if (args.length === 3) { args[1] = replaceDashes(args[1]); } else { args[0] = replaceDashes(args[0]); } if (args.length == 2) { realcp(args[0], args[1]); } else { realcp(args[0], args[1], args[2]); } }; function replaceDashes(values) { if (Array.isArray(values)) { for (let i = 0; i < values.length; ++i) { values[i] = replaceDashes(values[i]); } return values; } else { return values.replace(/\\/g, "/"); } } } const errors_1 = require("./common/errors"); const helpers_1 = require("./common/helpers"); const yok_1 = require("./common/yok"); const color_1 = require("./color"); (0, errors_1.installUncaughtExceptionListener)(process.exit.bind(process, 120 /* ErrorCodes.UNCAUGHT */)); const logger = yok_1.injector.resolve("logger"); exports.originalProcessOn = process.on.bind(process); process.on = (event, listener) => { if (event === "SIGINT") { logger.trace(`Trying to handle SIGINT event. CLI overrides this behavior and does not allow handling SIGINT as this causes issues with Ctrl + C in terminal.`); const msg = "The stackTrace of the location trying to handle SIGINT is"; const stackTrace = new Error(msg).stack || ""; logger.trace(stackTrace.replace(`Error: ${msg}`, `${msg} (${color_1.color.yellow("note:")} this is not an error, just a stack-trace for debugging purposes):`)); } else { return (0, exports.originalProcessOn)(event, listener); } }; /* tslint:disable:no-floating-promises */ (async () => { if (process.argv.includes("--get-yargs-completions")) { // This is a special case when we want to get the yargs completions as fast as possible... yok_1.injector.resolve("$options"); return; } const config = yok_1.injector.resolve("$config"); const err = yok_1.injector.resolve("$errors"); err.printCallStack = config.DEBUG; const $initializeService = yok_1.injector.resolve("initializeService"); await $initializeService.initialize(); const extensibilityService = yok_1.injector.resolve("extensibilityService"); try { await (0, helpers_1.settlePromises)(extensibilityService.loadExtensions()); } catch (err) { logger.trace("Unable to load extensions. Error is: ", err); } const commandDispatcher = yok_1.injector.resolve("commandDispatcher"); // unused... // const messages: IMessagesService = injector.resolve("$messagesService"); // messages.pathsToMessageJsonFiles = [ // /* Place client-specific json message file paths here */ // ]; await commandDispatcher.dispatchCommand(); yok_1.injector.dispose(); })(); /* tslint:enable:no-floating-promises */ //# sourceMappingURL=nativescript-cli.js.map