Skip to content

Commit

Permalink
Improve publishing process
Browse files Browse the repository at this point in the history
I recently added a few npm scripts to help making the release process go
smoother. Unfortunately, they caused a little bit of confusion because
some folks were still trying to use the built-in `npm version` command
instead of the new `npm run version:foo` scripts.

I poked around npm documentation a bit and discovered that we can set
things up so that `npm version` does what we want. The magic is done by
moving the command flag to avoid the automatic creation of the git tag
out of the script and into a .npmrc file.

The result of this is now `npm version major|minor|patch` will manage
the full release process for you.
  • Loading branch information
lencioni committed Nov 17, 2016
1 parent 5676c98 commit feb362f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
git-tag-version=false
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Expand Up @@ -12,14 +12,14 @@ We love pull requests. Here's a quick guide:
## Publishing a new version

1. Add list of changes to CHANGELOG.md. Do not commit them yet.
2. Run `npm run version:major`, `npm run version:minor`, or `npm run
version:patch`.
2. Run `npm version major`, `npm version minor`, or `npm
version patch`.

This script will handle the rest of the process for you, including running
tests, cleaning out the previous build, building the package, bumping the
version, committing the changes you've made to CHANGELOG.md, tagging the
version, pushing the changes to GitHub, pushing the tags to GitHub, and
publishing the new version on npm.
This will handle the rest of the process for you, including running tests,
cleaning out the previous build, building the package, bumping the version,
committing the changes you've made to CHANGELOG.md, tagging the version, pushing
the changes to GitHub, pushing the tags to GitHub, and publishing the new
version on npm.

## Code of conduct

Expand Down
5 changes: 1 addition & 4 deletions package.json
Expand Up @@ -22,10 +22,7 @@
"tag": "git tag v$npm_package_version",
"test": "npm run testonly",
"testonly": "karma start --single-run",
"testonly:watch": "karma start --no-single-run",
"version:major": "npm --no-git-tag-version version major",
"version:minor": "npm --no-git-tag-version version minor",
"version:patch": "npm --no-git-tag-version version patch"
"testonly:watch": "karma start --no-single-run"
},
"author": "Brigade Engineering",
"license": "MIT",
Expand Down

0 comments on commit feb362f

Please sign in to comment.