nativescript
Version:
Command-line interface for building NativeScript projects
55 lines • 2.52 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.originalProcessOn = void 0;
require("./bootstrap");
const shelljs = require("shelljs");
shelljs.config.silent = true;
shelljs.config.fatal = true;
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
;