src/npm.js
function install(deps, options, exec) {
	options = options || {};
	const dev = options.dev !== false;
	const run = options.yarn || isUsingYarn() ? runYarn : runNpm;

	// options.versions is a min versions mapping,
	// the list of packages to install will be taken from deps
	let versions = options.versions || {};
	if (_.isPlainObject(deps)) {
		// deps is an object with required versions
		versions = deps;
		deps = Object.keys(deps);
	}

	deps = _.castArray(deps);

	const newDeps = getUnsatisfiedDeps(deps, versions, { dev });
	if (newDeps.length === 0) {
		return;
	}

	log.info(`Installing ${listify(newDeps)}...`);
	const versionedDeps = newDeps.map(dep => getVersionedDep(dep, versions));
	run(versionedDeps, { dev }, exec);
}
function install(deps, options, exec) {
	options = options || {};
	const dev = options.dev !== false;
	const run = options.yarn || isUsingYarn() ? runYarn : runNpm;

	// options.versions is a min versions mapping,
	// the list of packages to install will be taken from deps
	let versions = options.versions || {};
	if (_.isPlainObject(deps)) {
		// deps is an object with required versions
		versions = deps;
		deps = Object.keys(deps);
	}

	deps = _.castArray(deps);

	const newDeps = getUnsatisfiedDeps(deps, versions, { dev });
	if (newDeps.length === 0) {
		return;
	}

	log.info(`Installing ${listify(newDeps)}...`);
	const versionedDeps = newDeps.map(dep => getVersionedDep(dep, versions));
	run(versionedDeps, { dev }, exec);
}
function install ( deps , options , exec ) { options = options || { } ; const dev = options . dev !== false ; const run = options . yarn || isUsingYarn ( ) ? runYarn : runNpm ; // options.versions is a min versions mapping, // the list of packages to install will be taken from deps let versions = options . versions || { } ; if ( _ . isPlainObject ( deps ) ) { // deps is an object with required versions versions = deps ; deps = Object . keys ( deps ) ; } deps = _ . castArray ( deps ) ; const newDeps = getUnsatisfiedDeps ( deps , versions , { dev } ) ; if ( newDeps . length === 0 ) { return ; } log . info ( ` ${ listify ( newDeps ) } ` ) ; const versionedDeps = newDeps . map ( dep => getVersionedDep ( dep , versions ) ) ; run ( versionedDeps , { dev } , exec ) ; }
Install or update given npm packages if needed
Install or update given npm packages if needed