๐Ÿ“ฆ ljharb / safe-publish-latest

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

โ˜… 20 stars โ‘‚ 4 forks ๐Ÿ‘ 20 watching โš–๏ธ MIT License
๐Ÿ“ฅ Clone https://github.com/ljharb/safe-publish-latest.git
HTTPS git clone https://github.com/ljharb/safe-publish-latest.git
SSH git clone git@github.com:ljharb/safe-publish-latest.git
CLI gh repo clone ljharb/safe-publish-latest
Jordan Harband Jordan Harband [meta] editorconfig: ignore more stuff in coverage 72dfebb 4 years ago ๐Ÿ“ History
๐Ÿ“‚ 72dfebb780db60747cca3435987a58d9708851bf View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ bin
๐Ÿ“ test
๐Ÿ“„ .editorconfig
๐Ÿ“„ .eslintignore
๐Ÿ“„ .eslintrc
๐Ÿ“„ .gitignore
๐Ÿ“„ .npmignore
๐Ÿ“„ .npmrc
๐Ÿ“„ .nycrc
๐Ÿ“„ CHANGELOG.md
๐Ÿ“„ getLatestError.js
๐Ÿ“„ getTag.js
๐Ÿ“„ LICENSE
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ 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