UNPKG

zcatalyst-cli

Version:

Command Line Tool for CATALYST

36 lines (35 loc) 1.84 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 }); const index_js_1 = __importDefault(require("../../error/index.js")); const prompt_1 = __importDefault(require("../../prompt")); const env_js_1 = require("../../util_modules/env.js"); const shell_1 = require("../../util_modules/shell"); exports.default = (pth, skipPrompt = false) => __awaiter(void 0, void 0, void 0, function* () { const ans = yield prompt_1.default.ask(prompt_1.default.question('NPMinstall', 'Do you wish to install all dependencies now ? ', { type: 'confirm', defaultAns: true, when: () => !skipPrompt })); if (ans.NPMinstall === undefined || ans.NPMinstall) { return (0, shell_1.spawn)('npm', ['install'], { cwd: pth, detached: env_js_1.isVsCode }) .ASYNC() .catch((err) => { throw index_js_1.default.getErrorInstance(err, { message: 'Failure when executing npm install.' }); }); } return; });