How to use the npm.registry 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 godaddy / carpenterd / lib / constructor / npm / npm.js View on Github external
npm.load(this.config, function npmConfigLoaded(error) {
    if (error) return void callback(error);

    //
    // Temporary hack to add custom headers to the npm-registry-client.
    // TODO: remove this hack once headers can be specified through load/config.
    //
    const _authify = npm.registry.authify;
    npm.registry.authify = function authify(authed, parsed, headers, credentials) {

      //
      // Setup header for install in provided environment.
      //
      headers['registry-environment'] = self.env;
      return _authify.call(npm.registry, authed, parsed, headers, credentials);
    };

    return void npm[cmd](self.base, self.base, callback);
  });
};
github godaddy / carpenterd / lib / constructor / npm / npm.js View on Github external
npm.registry.authify = function authify(authed, parsed, headers, credentials) {

      //
      // Setup header for install in provided environment.
      //
      headers['registry-environment'] = self.env;
      return _authify.call(npm.registry, authed, parsed, headers, credentials);
    };
github godaddy / carpenterd / lib / constructor / npm / npm.js View on Github external
npm.load(this.config, function npmConfigLoaded(error) {
    if (error) return void callback(error);

    //
    // Temporary hack to add custom headers to the npm-registry-client.
    // TODO: remove this hack once headers can be specified through load/config.
    //
    const _authify = npm.registry.authify;
    npm.registry.authify = function authify(authed, parsed, headers, credentials) {

      //
      // Setup header for install in provided environment.
      //
      headers['registry-environment'] = self.env;
      return _authify.call(npm.registry, authed, parsed, headers, credentials);
    };

    return void npm[cmd](self.base, self.base, callback);
  });
};
github jaystack / jaydata / gulpfile.js View on Github external
npm.commands.pack(['./dist'], function (packError) {
                if (packError) {
                    return callback(packError);
                }
                var fileName = metadata.name + '-' + metadata.version + '.tgz';
                var bodyPath = require.resolve('./' + fileName);
                var body = fs.createReadStream(bodyPath);
                var publishParams = {
                    metadata: metadata,
                    access: 'public',
                    tag: 'next',
                    body: body,
                    auth: auth
                };
                npm.registry.publish(uri, publishParams, function (publishError, resp) {
                    if (publishError) {
                        return callback(publishError);
                    }
                    console.log("Publish succesfull: " + JSON.stringify(resp));
                    return callback();
                });
            })
        });
github jDataView / jBinary / grunt / npm_publish.js View on Github external
npm.load({}, function(err) {
			npm.registry.adduser(options.username, options.password, options.email, function (err) {
				if (err) {
					console.log(err);
					done(false);
				} else {
					npm.config.set('email', options.email);

					npm.commands.publish([], function (err) {
						console.log(err || 'Published to npm.');
						done(!err);
					});
				}
			});
		});
	});
github jDataView / jDataView / grunt / npm_publish.js View on Github external
npm.load({}, function() {
			npm.registry.adduser(
				options.username,
				options.password,
				options.email,
				function(err) {
					if (err) {
						console.log(err);
						done(false);
					} else {
						npm.config.set('email', options.email);

						npm.commands.publish([], function(err) {
							console.log(err || 'Published to npm.');
							done(!err);
						});
					}
				}
github FineUploader / fine-uploader / lib / grunt / tasks / release.js View on Github external
npm.load({}, function(err) {
            if (err) {
                console.log(err);
                return done(err);
            }
            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 jaystack / jaydata / gulpfile.js View on Github external
npm.load(null, function (loadError) {
        if (loadError) {
            return callback(loadError);
        }
        var auth = {
            username: username,
            password: password,
            email: email,
            alwaysAuth: true
        };
        var addUserParams = {
            auth: auth
        };
        npm.registry.adduser(uri, addUserParams, function (addUserError, data, raw, res) {
            if (addUserError) {
                return callback(addUserError);
            }

            var metadata = require('./dist/package.json');
            metadata = JSON.parse(JSON.stringify(metadata));
            npm.commands.pack(['./dist'], function (packError) {
                if (packError) {
                    return callback(packError);
                }
                var fileName = metadata.name + '-' + metadata.version + '.tgz';
                var bodyPath = require.resolve('./' + fileName);
                var body = fs.createReadStream(bodyPath);
                var publishParams = {
                    metadata: metadata,
                    access: 'public',
github alibaba / anyproxy / bin.js View on Github external
}, function (er) {
        npm.commands.install(program.args || [], function (er, data) {
            if(er)throw er;
        });
        npm.registry.log.on("log", function (message) {});
    });
}else{
github dthree / vantage / lib / vantage.js View on Github external
npm.load(config, function(){
      npm.registry.log.level = config.loglevel;
      npm.commands.install(temp.dir, [options.module], function(err, data){
        if (err) {
          cbk(err, data);
        } else {
          var dir = temp.dir + "/node_modules/" + options.module;
          var mod = require(dir);
          cbk(void 0, mod);
        }
      });
    });
  }