NPM.publish()

Publish a package to the public NPM registry.

Usage

Hover over inputs/exits for more info.

var NPM = require('machinepack-npm');


// Publish a package to the public NPM registry.

NPM.publish({

dir: '/Users/mikermcneil/dogfood-promo-site',

restrictAccess: true,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Cannot overwrite- that package has already been published at the version in the package.json file.

alreadyExists: function () {

 

},

// No directory exists at the provided path.

noSuchDir: function () {

 

},

// The provided path does not point to a directory (i.e. it might be a file or shortcut)

notADir: function () {

 

},

// The package does not contain a package.json file, or it cannot be parsed.

invalidPackage: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

dir required

The path to the directory where the package is located on disk.

'/Users/mikermcneil/dogfood-promo-site'
restrictAccess

Whether or not this package should be marked as private.

true

Exits

error

An unexpected error occurred.

alreadyExists

Cannot overwrite- that package has already been published at the version in the package.json file.

noSuchDir

No directory exists at the provided path.

notADir

The provided path does not point to a directory (i.e. it might be a file or shortcut)

invalidPackage

The package does not contain a package.json file, or it cannot be parsed.

success

OK.

{ name: '@mattmueller/cheerio', version: '2.0.0' }