mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
21 lines
705 B
JavaScript
21 lines
705 B
JavaScript
import { pathJoin, getDevBundle } from '../fs/files';
|
|
import { installNpmModule, moduleDoesResolve } from '../isobuild/meteor-npm.js';
|
|
|
|
export function ensureDependencies(deps) {
|
|
// Check if each of the requested dependencies resolves, if not
|
|
// mark them for installation.
|
|
const needToInstall = Object.create(null);
|
|
Object.keys(deps).forEach(dep => {
|
|
if (!moduleDoesResolve(dep)) {
|
|
const versionToInstall = deps[dep];
|
|
needToInstall[dep] = versionToInstall;
|
|
}
|
|
});
|
|
|
|
const devBundleLib = pathJoin(getDevBundle(), 'lib');
|
|
|
|
// Install each of the requested modules.
|
|
Object.keys(needToInstall)
|
|
.forEach(dep => installNpmModule(dep, needToInstall[dep], devBundleLib));
|
|
}
|