UNPKG

@ehduardu/bat-framework

Version:

A simple framework for Google Apps Script

30 lines (29 loc) 1.08 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.install = void 0; const cross_spawn_1 = __importDefault(require("cross-spawn")); function install(root, dependencies, isDev = false) { return new Promise((resolve, reject) => { const command = 'yarnpkg'; const args = dependencies ? ['add', '--exact'] : ['install']; if (isDev) { args.push('--dev'); } if (dependencies) { args.push(...dependencies); } args.push('--cwd', root); const child = (0, cross_spawn_1.default)(command, args, { stdio: 'inherit', env: Object.assign({}, process.env) }); child.on('close', (code) => { if (code !== 0) { reject({ command: `${command} ${args.join(' ')}` }); return; } resolve(); }); }); } exports.install = install;