Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jameslnewell/publish-if-not-published
Publish a package if the current version isn't already published.
https://github.com/jameslnewell/publish-if-not-published
attempt npm publish try yarn
Last synced: 11 days ago
JSON representation
Publish a package if the current version isn't already published.
- Host: GitHub
- URL: https://github.com/jameslnewell/publish-if-not-published
- Owner: jameslnewell
- Created: 2018-08-13T23:59:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T04:14:51.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T03:18:31.620Z (28 days ago)
- Topics: attempt, npm, publish, try, yarn
- Language: TypeScript
- Size: 1.07 MB
- Stars: 4
- Watchers: 3
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# publish-if-not-published
[![Main Actions Status](https://github.com/jameslnewell/publish-if-not-published/workflows/main/badge.svg)](https://github.com/jameslnewell/publish-if-not-published/actions)
Publish a package if the current version isn't already published.
![A list of packages published with publish-if-not-published](https://raw.githubusercontent.com/jameslnewell/publish-if-not-published/master/screenshot.jpg)
## Installation
```bash
yarn add --dev publish-if-not-published
```## Usage
Run `publish-if-not-published` and pass any additional arguments that you would have passed to `npm publish`.
```bash
"$(yarn bin)/publish-if-not-published" -- --otp 123456 --dry-run
```### Tags
When specifing a non-latest tag to be published, a suffix should also be appended to the version so as not to use up a semver version on a prerelease.
```json
{
"name": "package",
"version": "2.0.0-next.0"
}
``````bash
"$(yarn bin)/publish-if-not-published" -- --tag next
````publish-if-not-published` checks whether it has been called with a non-latest tag, and the version of the package to prevent:
1. Accidentally publishing a tagged release with a non-suffixed version, or
1. Accidentally publishing a latest release with a suffixed version.These checks can be turned off with the `--no-tag-check` flag:
```bash
"$(yarn bin)/publish-if-not-published" --no-tag-check -- --tag rc
```