Skip to content
Ensure that when you `npm publish`, the "latest" tag is only set for the truly latest version.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` Jan 21, 2019
test [Fix] ensure scoped packages work on first publish Apr 20, 2017
.travis.yml [Tests] up to `node` `v12.8`, `v11.15`, `v10.16`, `v6.17` Aug 11, 2019 v1.1.3 Aug 13, 2019

safe-publish-latest Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

Ensure that when you npm publish, the "latest" tag is only set for the truly latest version.


Add "safe-publish-latest" to your package.json's "prepublish" script.

It will only activate during an actual npm publish - it will silently do nothing during installs, and will error when run directly.

Example package.json excerpt with no other prepublish commands:

	"scripts": {
		"prepublish": "safe-publish-latest"

Example package.json excerpt with another prepublish command:

	"scripts": {
		"prepublish": "safe-publish-latest && npm run build"


Simply clone the repo, npm install, and run npm test

You can’t perform that action at this time.