examples/cordova1/plugins/branch-cordova-sdk/src/scripts/npm/downloadNpmDependencies.js
function installNodeModules(modules, callback) {
    // base case
    if (modules.length <= 0) {
      return callback();
    }

    // install one at a time
    const module = modules.pop();
    console.log(`BRANCH SDK: Installing node dependency ${module}`);

    const install = `npm install --prefix ./plugins/${SDK} -D ${module}`;
    exec(install, (err, stdout, stderr) => {
      // handle error
      if (err) {
        throw new Error(
          `BRANCH SDK: Failed to install Branch node dependency ${module}. Docs https://goo.gl/GijGKP`
        );
      } else {
        // next module
        installNodeModules(modules, callback);
      }
    });
  }
function installNodeModules(modules, callback) {
    // base case
    if (modules.length <= 0) {
      return callback();
    }

    // install one at a time
    const module = modules.pop();
    console.log(`BRANCH SDK: Installing node dependency ${module}`);

    const install = `npm install --prefix ./plugins/${SDK} -D ${module}`;
    exec(install, (err, stdout, stderr) => {
      // handle error
      if (err) {
        throw new Error(
          `BRANCH SDK: Failed to install Branch node dependency ${module}. Docs https://goo.gl/GijGKP`
        );
      } else {
        // next module
        installNodeModules(modules, callback);
      }
    });
  }
function installNodeModules ( modules , callback ) { // base case if ( modules . length <= 0 ) { return callback ( ) ; } // install one at a time const module = modules . pop ( ) ; console . log ( ` ${ module } ` ) ; const install = ` ${ SDK } ${ module } ` ; exec ( install , ( err , stdout , stderr ) => { // handle error if ( err ) { throw new Error ( ` ${ module } ` ) ; } else { // next module installNodeModules ( modules , callback ) ; } } ) ; }
installs the node modules via npm install one at a time
installs the node modules via npm install one at a time