https://github.com/teppeis/guess-npm-dist-tag
Automatically determine the dist-tag from the current latest and the new version number when `npm publish`.
https://github.com/teppeis/guess-npm-dist-tag
npm
Last synced: about 2 months ago
JSON representation
Automatically determine the dist-tag from the current latest and the new version number when `npm publish`.
- Host: GitHub
- URL: https://github.com/teppeis/guess-npm-dist-tag
- Owner: teppeis
- Created: 2023-10-09T13:08:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-11T14:27:45.000Z (over 1 year ago)
- Last Synced: 2025-03-23T23:36:20.973Z (about 2 months ago)
- Topics: npm
- Language: JavaScript
- Homepage: https://npm.im/package/guess-npm-dist-tag
- Size: 242 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# guess-npm-dist-tag
Automatically determine the dist-tag from the current latest and the new version number when `npm publish`.
[![npm version][npm-image]][npm-url]
![supported Node.js version][node-version]
[![ci status][ci-image]][ci-url]
![license][license]## Usage: CLI
```console
$ npx guess-npm-dist-tag
latest
```Compare the version number of the local `package.json` in CWD with the latest version retrieved from the npm registry and output the most appropriate dist-tag like `latest`, `latest-3`or`next`.
You can use this with `npm publish --tag` in GitHub Actions.
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm publish --tag $(npx guess-npm-dist-tag)
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
```See [setup-node](https://github.com/actions/setup-node) and ["Publishing Node.js packages"](https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages) in GitHub Docs.
## License
MIT License: Teppei Sato <[email protected]>
[npm-image]: https://img.shields.io/npm/v/guess-npm-dist-tag?style=flat-square&logo=npm
[npm-url]: https://npmjs.org/package/guess-npm-dist-tag
[node-version]: https://img.shields.io/node/v/guess-npm-dist-tag?style=flat-square&logo=node.js
[license]: https://img.shields.io/npm/l/guess-npm-dist-tag?style=flat-square
[ci-image]: https://img.shields.io/github/actions/workflow/status/teppeis/guess-npm-dist-tag/test.yml?style=flat-square&logo=github
[ci-url]: https://github.com/teppeis/guess-npm-dist-tag/actions?query=workflow%3Aci