Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

publish

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

publish - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

39

index.js

@@ -54,4 +54,22 @@ var npm = require('npm'),

remoteVersion(pkg, function(err, remoteVersion) {
if (shouldPublish(options, localVersion, remoteVersion)) {
npmPublish(callback);
if (err) {
callback(err);
} else if (shouldPublish(options, localVersion, remoteVersion)) {
if (isTravis()) {
log.info('running in travis');
var npmUserCredentials = npmUserCredentials();
if (npmUserCredentials) {
npmAddUser(npmUserCredentials, function(err) {
if (err) {
callback('error while trying to add npm user in travis: ' + err);
} else {
npmPublish(callback);
}
});
} else {
callback('npm user credentials not found, make sure NPM_USERNAME, NPM_PASSWORD and NPM_EMAIL environment variables are set');
}
} else {
npmPublish(callback);
}
}

@@ -72,5 +90,22 @@ });

});
}
function npmUserCredentials() {
if (process.env.NPM_USERNAME && process.env.NPM_PASSWORD && process.env.NPM_EMAIL) {
return {'username':process.env.NPM_USERNAME, 'password':process.env.NPM_PASSWORD, 'email':process.env.NPM_EMAIL}
} else {
return null;
}
}
function isTravis() {
return process.env.TRAVIS;
}
function npmAddUser(username, password, email, callback) {
npm.registry.adduser(username, password, email, function(err) {
callback(err);
});
}
function shouldPublish(options, localVersion, remoteVersion) {

@@ -77,0 +112,0 @@ options = options || {};

2

package.json
{
"name": "publish",
"version": "0.3.0",
"version": "0.3.1",
"description": "npm auto publishing of your modules",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc