npm-publish-release
v1.3.10
Published
Simple interface for publishing a release to npm and/or github
Downloads
20
Maintainers
Readme
npm-publish-release
Easy interface for automatically bumping and publishing a release to npm
and/or github
.
A little package that stresses simplicity. Publishes a release to git
or npm
by:
- Bumping the
MAJOR
/MINOR
/PATCH
version appropriately inpackage.json
. - (optionally) Creating a new commit for the version bump and pushing it to origin.
- (optionally) Publishing a git tag with the format
vX.X.X
, i.e.v2.4.8
to agithub
repository. - (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:
- Bump the
PATCH
version inpackage.json
. - Create a new commit with the text
"Bumping to version X.X.X"
, and push it to master - Publish a
tag
togithub
. - Publish a release to
npm
.
CLI
Assuming your code is all committed and your working copy clean, run:
$ npr # alias for npm-publish-release
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 formatX.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 associatedgit
repository.dest {string} - Either
npm
orgithub
; omit for both.quiet {boolean} - Output nothing (suppress
STDOUT
andSTDERR
).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
Other libraries
Other libraries that work well when used in conjunction with npm-publish-release
:
- node-clean-exit - A small module for exiting a node process cleanly.
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.