lib/packExternalModules.js
function addModulesToPackageJson(externalModules, packageJson, pathToPackageRoot) {
  _.forEach(externalModules, externalModule => {
    const splitModule = _.split(externalModule, '@');
    // If we have a scoped module we have to re-add the @
    if (_.startsWith(externalModule, '@')) {
      splitModule.splice(0, 1);
      splitModule[0] = '@' + splitModule[0];
    }
    let moduleVersion = _.join(_.tail(splitModule), '@');
    // We have to rebase file references to the target package.json
    moduleVersion = rebaseFileReferences(pathToPackageRoot, moduleVersion);
    packageJson.dependencies = packageJson.dependencies || {};
    packageJson.dependencies[_.first(splitModule)] = moduleVersion;
  });
}
function addModulesToPackageJson(externalModules, packageJson, pathToPackageRoot) {
  _.forEach(externalModules, externalModule => {
    const splitModule = _.split(externalModule, '@');
    // If we have a scoped module we have to re-add the @
    if (_.startsWith(externalModule, '@')) {
      splitModule.splice(0, 1);
      splitModule[0] = '@' + splitModule[0];
    }
    let moduleVersion = _.join(_.tail(splitModule), '@');
    // We have to rebase file references to the target package.json
    moduleVersion = rebaseFileReferences(pathToPackageRoot, moduleVersion);
    packageJson.dependencies = packageJson.dependencies || {};
    packageJson.dependencies[_.first(splitModule)] = moduleVersion;
  });
}
function addModulesToPackageJson ( externalModules , packageJson , pathToPackageRoot ) { _ . forEach ( externalModules , externalModule => { const splitModule = _ . split ( externalModule , '@' ) ; // If we have a scoped module we have to re-add the @ if ( _ . startsWith ( externalModule , '@' ) ) { splitModule . splice ( 0 , 1 ) ; splitModule [ 0 ] = '@' + splitModule [ 0 ] ; } let moduleVersion = _ . join ( _ . tail ( splitModule ) , '@' ) ; // We have to rebase file references to the target package.json moduleVersion = rebaseFileReferences ( pathToPackageRoot , moduleVersion ) ; packageJson . dependencies = packageJson . dependencies || { } ; packageJson . dependencies [ _ . first ( splitModule ) ] = moduleVersion ; } ) ; }
Add the given modules to a package json's dependencies.
Add the given modules to a package json s dependencies .