npm-publish-safe-latest
"npm publish", but doesn't set the "latest" dist-tag to pre-release versions.
Last updated 4 years ago by scott113341 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install npm-publish-safe-latest 
SYNC missed versions from official npm registry.

npm-publish-safe-latest

npm-version build-status dependencies dev-dependencies

npm publish, but doesn't set the "latest" dist-tag to pre-release versions.

See related npm issue.

Installation: npm install npm-publish-safe-latest --save-dev

Example Usage #1

Here's an example workflow for publishing with npm-publish-safe-latest:

$ git commit -am 'Lots of breaking changes as a v2 major release candidate'
[v2-release-candidate 469d6f9] Lots of breaking changes as a major release candidate
 100 files changed, 10000000 insertions(+), 0 deletions(-)

$ npm version premajor
v2.0.0-0

$ ./node_modules/.bin/npm-publish-safe-latest
Publishing with dist-tag pre-release
+ @scott113341/my-module@v2.0.0-0

$ npm info my-module dist-tags
{ latest: '1.22.4', 'pre-release': '2.0.0-0' }

Notice how our dist-tag was set to pre-release instead of latest? That's good. If we had used npm publish instead:

  • Our latest dist-tag would have been set to v2.0.0-0
  • Anyone running npm install my-module would have gotten our unstable v2.0.0-0 release candidate

Disaster averted!

If you want to specify the dist-tag, you can pass it in as the first argument. For example, let's say we instead of the default pre-release tag, we wanted to tag our v2.0.0-0 as v2-rc:

$ ./node_modules/.bin/npm-publish-safe-latest v2-rc
Publishing with dist-tag v2-rc
+ @scott113341/my-module@v2.0.0-0

$ npm info my-module dist-tags
{ latest: '1.22.4', 'v2-rc': '2.0.0-0' }

Example Usage #2

Let's say you want to get crazy and automatically publish stuff after you version your package. In your package.json:

{
  // ...
  "scripts": {
    "preversion": "npm run test",
    "postversion": "npm-publish-safe-latest && git push --follow-tags",
    "test": "node test/index.js"
  },
  // ...
}

Let's say you run npm version premajor. Here's what'll happen:

  1. Tests run; the entire process is aborted if they fail
  2. The package version gets bumped a major pre-release version (to something like v2.0.0-0)
  3. The package is published. Since it's a pre-release version, the dist-tag is set to pre-release instead of latest
  4. Changes (including tags) are pushed to your git origin

Full Usage

usage: npm-publish-safe-latest [not-latest-tag] [-- options...]

not-latest-tag
  the dist-tag if the version being published is a pre-release version
  default: "pre-release"

options
  arguments that will be forwarded to `npm publish`

Current Tags

  • 1.1.6                                ...           latest (4 years ago)
  • 1.1.1-0                                ...           pre-release (4 years ago)

11 Versions

  • 1.1.6                                ...           4 years ago
  • 1.1.5                                ...           4 years ago
  • 1.1.4                                ...           4 years ago
  • 1.1.3                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.1-0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.1.0-1                                ...           4 years ago
  • 1.1.0-0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 11
This Month 11
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |