1 | # safe-publish-latest <sup>[![Version Badge][2]][1]</sup>
|
2 |
|
3 | [![Build Status][3]][4]
|
4 | [![dependency status][5]][6]
|
5 | [![dev dependency status][7]][8]
|
6 | [![License][license-image]][license-url]
|
7 | [![Downloads][downloads-image]][downloads-url]
|
8 |
|
9 | [![npm badge][9]][1]
|
10 |
|
11 | Ensure that when you `npm publish`, the "latest" tag is only set for the truly latest version.
|
12 |
|
13 | ## Usage
|
14 |
|
15 | Add "safe-publish-latest" to your `package.json`'s "prepublish" script.
|
16 |
|
17 | It will only activate during an actual `npm publish` - it will silently do nothing during installs, and will error when run directly.
|
18 |
|
19 | Example `package.json` excerpt with no other prepublish commands:
|
20 | ```json
|
21 | {
|
22 | "scripts": {
|
23 | "prepublish": "safe-publish-latest"
|
24 | }
|
25 | }
|
26 | ```
|
27 |
|
28 | Example `package.json` excerpt with another prepublish command:
|
29 | ```json
|
30 | {
|
31 | "scripts": {
|
32 | "prepublish": "safe-publish-latest && npm run build"
|
33 | }
|
34 | }
|
35 | ```
|
36 |
|
37 |
|
38 | ## Tests
|
39 | Simply clone the repo, `npm install`, and run `npm test`
|
40 |
|
41 | [1]: https://npmjs.org/package/safe-publish-latest
|
42 | [2]: http://versionbadg.es/ljharb/safe-publish-latest.svg
|
43 | [3]: https://travis-ci.org/ljharb/safe-publish-latest.svg
|
44 | [4]: https://travis-ci.org/ljharb/safe-publish-latest
|
45 | [5]: https://david-dm.org/ljharb/safe-publish-latest.svg
|
46 | [6]: https://david-dm.org/ljharb/safe-publish-latest
|
47 | [7]: https://david-dm.org/ljharb/safe-publish-latest/dev-status.svg
|
48 | [8]: https://david-dm.org/ljharb/safe-publish-latest#info=devDependencies
|
49 | [9]: https://nodei.co/npm/safe-publish-latest.png?downloads=true&stars=true
|
50 | [license-image]: http://img.shields.io/npm/l/safe-publish-latest.svg
|
51 | [license-url]: LICENSE
|
52 | [downloads-image]: http://img.shields.io/npm/dm/safe-publish-latest.svg
|
53 | [downloads-url]: http://npm-stat.com/charts.html?package=safe-publish-latest
|