How to use the npm.commands function in npm

To help you get started, we’ve selected a few npm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jedi4ever / bashpack / lib / bashpack / build.js View on Github external
npm.load(npmConfig, function(err) {
    if(err) {
      process.chdir(originCwd);
      return callback(new Error('Npm config failed' +  err));
    }

    npm.commands.install([ ], function(err, data) {
      logger.debug(data);
      if (err) {
        process.chdir(originCwd);
        return callback(new Error('Npm install failed' +  err));
      } else {
        process.chdir(originCwd);
        return callback(null);
      }
    });

    // Doesn't seem to ouput something
    /*
    npm.logger.on('log', function(message) {
      logger.info('mermem');
      logger.info(message);
    });
github bigcompany / resources / npm / index.js View on Github external
_npm.load({ exit: false }, function (err) {
    // TODO: how to add flags such as --force ?
    _npm.commands.publish([path], function (err, result) {
      callback(err, result);
    });
  });
}
github observing / square / lib / canihaz.js View on Github external
npm.load(conf, function loadnpm(err) {
    if (err) return fn(err);

    // make sure the packages are installed in the square node_modules folder
    // instead of the current directory where the square command is executed
    npm.commands.install(directory, [packages + '@' + version], function install(err) {
      if (err) return fn(err);

      fn(null, require(location));
    });
  });
};
github FineUploader / fine-uploader / lib / grunt / tasks / release.js View on Github external
npm.registry.adduser(process.env.NPM_USERNAME, process.env.NPM_PASSWORD, process.env.NPM_EMAIL, function(err) {
                if (err) {
                    console.log(err);
                    return done(err);
                }

                npm.config.set("email", process.env.NPM_EMAIL, "user");
                npm.commands.publish([paths.dist], function(err) {
                    if (err) {
                        console.log(err);
                        return done(err);
                    }
                    console.log(paths.dist + " v" + pkg.verison + " Published to registry");
                    return done();

                });

            });
github aisouard / node-webrtc / scripts / fetch.js View on Github external
}, function (err) {
    if (err) {
      throw err;
    }

    npm.commands.run(['configure', 'build'], err => {
      if (err) {
        throw err;
      }
    });

    npm.on("log", function (message) {
      console.log(message);
    });
  });
}
github flatiron / blacksmith / pages / articles / getting-started / npm / what-is-npm / app.js View on Github external
npm.load({"-s":"true", "s": "true", "-silent":"true", "silient":"true"}, function (er) {
  if (er) return handlError(er)
  npm.commands.install(["vows", "eyes"], function (er, data) {
    if (er) return console.log("There was an error:", er);
    console.log("Just installed the programs");
  })
})
github apache / cordova-lib / src / registry / registry.js View on Github external
.then(function() {
            return Q.ninvoke(npm.commands, 'config', args);
        });
    },
github alonbardavid / visor / Gruntfile.js View on Github external
npm.load(function () {
            npm.commands.publish(['.'], function (e) {
                if (e) {
                    grunt.log.errorln(e);
                    done(false);
                } else {
                    grunt.log.writeln('Publish success');
                    done();
                }
            })
        })
github kgroat / create-electron-react-app / src / installDependencies.ts View on Github external
function installAllDeps () {
  const install = Bluebird.promisify(npm.commands.install)
  return install([])
}