examples/cordova1/plugins/branch-cordova-sdk/src/scripts/npm/downloadNpmDependencies.js
function install(context) {
    // set properties
    const q = context.requireCordovaModule("q");
    var async = new q.defer(); // eslint-disable-line
    const installFlagLocation = path.join(
      context.opts.projectRoot,
      "plugins",
      context.opts.plugin.id,
      INSTALLFLAGNAME
    );
    const dependencies = require(path.join(
      context.opts.projectRoot,
      "plugins",
      context.opts.plugin.id,
      "package.json"
    )).dependencies;

    // only run once
    if (getPackageInstalled(installFlagLocation)) return;

    // install node modules
    const modules = getNodeModulesToInstall(dependencies);
    if (modules.length === 0) return async.promise;

    installNodeModules(modules, () => {
      // only run once
      setPackageInstalled(installFlagLocation);
      removeEtcDirectory();
      async.resolve();
    });

    // wait until callbacks from the all the npm install complete
    return async.promise;
  }
function install(context) {
    // set properties
    const q = context.requireCordovaModule("q");
    var async = new q.defer(); // eslint-disable-line
    const installFlagLocation = path.join(
      context.opts.projectRoot,
      "plugins",
      context.opts.plugin.id,
      INSTALLFLAGNAME
    );
    const dependencies = require(path.join(
      context.opts.projectRoot,
      "plugins",
      context.opts.plugin.id,
      "package.json"
    )).dependencies;

    // only run once
    if (getPackageInstalled(installFlagLocation)) return;

    // install node modules
    const modules = getNodeModulesToInstall(dependencies);
    if (modules.length === 0) return async.promise;

    installNodeModules(modules, () => {
      // only run once
      setPackageInstalled(installFlagLocation);
      removeEtcDirectory();
      async.resolve();
    });

    // wait until callbacks from the all the npm install complete
    return async.promise;
  }
function install ( context ) { // set properties const q = context . requireCordovaModule ( "q" ) ; var async = new q . defer ( ) ; // eslint-disable-line const installFlagLocation = path . join ( context . opts . projectRoot , "plugins" , context . opts . plugin . id , INSTALLFLAGNAME ) ; const dependencies = require ( path . join ( context . opts . projectRoot , "plugins" , context . opts . plugin . id , "package.json" ) ) . dependencies ; // only run once if ( getPackageInstalled ( installFlagLocation ) ) return ; // install node modules const modules = getNodeModulesToInstall ( dependencies ) ; if ( modules . length === 0 ) return async . promise ; installNodeModules ( modules , ( ) => { // only run once setPackageInstalled ( installFlagLocation ) ; removeEtcDirectory ( ) ; async . resolve ( ) ; } ) ; // wait until callbacks from the all the npm install complete return async . promise ; }
install the node dependencies for Branch SDK
install the node dependencies for Branch SDK