How to use the global-npm.commands function in global-npm

To help you get started, we’ve selected a few global-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 kirjavascript / nibblrjr / irc / evaluate / acquire.js View on Github external
npm.load({loglevel: 'silent', lock: false}, (err, success) => {
    if (err) {
        console.error(err);
    }
    else {
        npmInstall = promisify(npm.commands.install);
        npmView = promisify(npm.commands.view);
        // disable an attack vector
        npm.config.set('ignore-scripts', true);
    }
});
github kirjavascript / nibblrjr / irc / evaluate / acquire.js View on Github external
npm.load({loglevel: 'silent', lock: false}, (err, success) => {
    if (err) {
        console.error(err);
    }
    else {
        npmInstall = promisify(npm.commands.install);
        npmView = promisify(npm.commands.view);
        // disable an attack vector
        npm.config.set('ignore-scripts', true);
    }
});
github maxleiko / npmi / npmi.js View on Github external
callback();
                                }
                            }
                        });
                    }
                });
            }
        } else {
            if (forceInstall) {
                // reinstall package module
                if (name.indexOf('/') === -1) {
                    // not a tarball
                    npm.commands.install(installPath, [name+'@'+version], installCallback);
                } else {
                    // do not specify version for tarball
                    npm.commands.install(installPath, [name], installCallback);
                }

            } else {
                // check if package is installed
                checkInstalled(name.indexOf('/') !== -1);
            }
        }
    }
github maxleiko / npmi / npmi.js View on Github external
return function (err, view) {
            if (err) {
                // reset npm.prefix to saved value
                npm.prefix = savedPrefix;
                err.code = VIEW_ERR;
                return callback(err);
            }

            // npm view success
            var latestVersion = Object.keys(view)[0];
            if ((typeof latestVersion !== 'undefined') && (latestVersion === installedVersion)) {
                // reset npm.prefix to saved value
                npm.prefix = savedPrefix;
                return callback();
            } else {
                npm.commands.install(installPath, [name+'@'+latestVersion], installCallback);
            }
        }
    }
github mKeRix / room-assistant / bin / room-assistant-runner.js View on Github external
function installDependencies(toBeInstalled) {
    if (toBeInstalled.length > 0) {
        const npmInstall = util.promisify(npm.commands.install);
        return npmInstall(toBeInstalled);
    }
}
github svrxjs / svrx / packages / svrx-util / lib / npm / index.js View on Github external
const normalizeNpmCommand = (command) => async function callNpm(argsArr, options = {}, root) {
  const args = command === 'install' ? [root, argsArr] : [argsArr];
  await load(options);

  return npCall(npm.commands[command], args);
};
github Shopify / slate-cli / includes / utils.js View on Github external
npm.load({prefix: dir, loglevel: 'silent', progress: false}, function(err) {
      if (err) { throw err; }

      npm.commands.run(script, function(runErr) {
        if (runErr) { throw runErr; }
      });
    });
  }

global-npm

Require global npm as a local node module.

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis