UNPKG

tyr-cli

Version:

A command line interface for hammer-io.

26 lines (12 loc) 3.17 kB
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports. npmInstall = npmInstall;var _shelljs = require('shelljs');var _shelljs2 = _interopRequireDefault(_shelljs);var _winston = require('../utils/winston');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}const log = (0, _winston.getActiveLogger)(); /** * Uses the shell to create call npm install to install the dependencies of the project. * This method creates a sub-process and can cause concurrency issues. After the npm install * is executed, the working directory returns to it's original state so as to not confuse * other parts of the program. * * @param path - String of the path to the new project directory where we need to call npm install */ // eslint-disable-next-line function npmInstall(path) {log.verbose('Node Service - npmInstall()');log.warn('Please wait while we install your NPM packages...');const originalPath = process.cwd();_shelljs2.default.cd(path);_shelljs2.default.exec('npm install');_shelljs2.default.cd(originalPath); log.info('Successfully installed your NPM packages'); }