npm-publish-release

1.3.10 • Public • Published

npm-publish-release

Easy interface for automatically bumping and publishing a release to npm and/or github.

npm package node version dependency status contributions welcome

A little package that stresses simplicity. Publishes a release to git or npm by:

  1. Bumping the MAJOR / MINOR / PATCH version appropriately in package.json.
  2. (optionally) Creating a new commit for the version bump and pushing it to origin.
  3. (optionally) Publishing a git tag with the format vX.X.X, i.e. v2.4.8 to a github repository.
  4. (optionally) Publishing to npm by using npm publish.

Installation

npm-publish-release uses vinyl-fs for modifying package.json by streaming; specifically gulp-bump. Therefore gulp must be installed globally:

$ npm install --global gulp

npm-publish-release can be installed locally or globally, and includes both a node module interface and a command-line interface (CLI).

Install globally

$ npm install --global npm-publish-release   # avalable everywhere  

Install locally

$ npm install --save npm-publish-release
 
# optionally link the script to node_modules/npm-publish-release 
# (does NOT install the module globally) 
cd node_modules/npm-publish-release && npm link

Usage

As mentioned earlier, the key is simplicity. With no additional options, npm-publish-release will do all of the following:

  1. Bump the PATCH version in package.json.
  2. Create a new commit with the text "Bumping to version X.X.X", and push it to master
  3. Publish a tag to github.
  4. Publish a release to npm.

CLI

Assuming your code is all committed and your working copy clean, run:

$ npr # alias for npm-publish-release 

npm-publish-release output

Done.

Using it programmatically

The node module follows the same format as the CLI, and uses Bluebird promises:

const publish = require('npm-publish-release');
 
let child = publish()
    .then(function() {
      console.log('success!');
    })
    .catch(function(err) {
      console.error('Something went wrong:', err);
    })
    .done();
    
require('node-clean-exit')([child]); // node-exit-clean is a separate project

Options

The options are the same for both the CLI (kebab-case) and the module interface (camelCase):

  • version {string} - Can be major, minor, patch, or a specific version number in the format X.X.X. If omitted, patch is assumed.

  • no-commit {boolean} - By default, a new commit is created and pushed to origin/master after the version bump and before the publish, to keep npm & github release versions in-sync. This option disables that behavior. May be useful if there is no associated git repository.

  • dest {string} - Either npm or github; omit for both.

  • quiet {boolean} - Output nothing (suppress STDOUT and STDERR).

  • verbose {boolean} - Display full stack traces for errors. Takes precedence over --quiet.

    Be careful here; any prompt for credentials will not be shown.


Note: If you are looking for something more robust, perhaps try one of these (although I have not tried them myself):

Contributing

contributions welcome

Other libraries

Other libraries that work well when used in conjunction with npm-publish-release:

License

The MIT License (MIT)

Copyright (c) 2016 Justin Helmer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i npm-publish-release

Weekly Downloads

1

Version

1.3.10

License

MIT

Last publish

Collaborators

  • justinhelmer