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

README.md

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.

Usage

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"
	}
}

Tests

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

You can’t perform that action at this time.