Skip to content

Commit 238700d

Browse files
bluwymelanieseltzer
andcommitted
Document accidental new package publish
fix #756 Co-authored-by: Melanie Seltzer <[email protected]>
1 parent 8f84326 commit 238700d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎site/guide/cli.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ $ changeset version --snapshot 'pr#123'
7878

7979
- **Related:** [Versioning and Publishing](./versioning-and-publishing.md#publishing), [`pack` command](#pack)
8080

81-
This command publishes changes to npm and creates git tags. It works by going into each package, checking if the version it has in its `package.json` is published on npm, and if it's not, run `npm publish` (or `pnpm publish` etc if detected to be using a different package manager).
81+
This command publishes changes to npm and creates git tags. It works by going into each package, checking if the version it has in its `package.json` is published on npm, and if it's not, run `npm publish` (or with the detected package-manager-specific publish command).
8282

8383
Because this command assumes that the last commit is the version commit, you should not commit any changes between calling `version` and `publish`. These commands are separate to enable you to check if the release changes are accurate.
8484

@@ -90,6 +90,12 @@ Make sure to push the tags to your git remote after creating them:
9090
$ git push --follow-tags
9191
```
9292

93+
::: warning Accidental publishes
94+
As the `publish` command automatically publishes versions that are not yet published, it's possible to accidentally publish a new package that has not been versioned before.
95+
96+
For example, when [Automating Changesets](./automating.md) (where it calls `publish` if there are no changesets to create a version PR) or automated [Snapshot Releases](./snapshot-releases.md), it may unintentionally publish the new package. To prevent this, make sure to set `"private": true` in the `package.json` of packages that should not be published.
97+
:::
98+
9399
### OTP
94100

95101
When publishing locally, you may be prompted for a one-time password (OTP) if your have two-factor authentication enabled on npm. You can provide this OTP directly with the `--otp <code>` flag to avoid the prompt.

0 commit comments

Comments
 (0)