openupm/openupm-cli

Packages added with the OpenUPM CLI always install the latest version, even if it is a preview

SimonDarksideJ opened this issue · 2 comments

Bug report

Bug category

  • Registry: issues related to the registry server.

Steps to reproduce

  • Create a new Unity solution
  • Add a package using the CLI, e.g. openupm add com.realitycollective.service-framework

What is expected?

The latest RELEASE version should be installed.

What is actually happening?

The latest release, which is a preview is installed

Other relevant information

When you publish a package, the latest tag is automatically set to the published version, unless you use the --tag option. For example, you can use npm publish --tag=beta to set a specific tag.

By default, if you use npm install (without adding @ or @), it installs the latest tag.

When you handle the publishing process manually, you can choose whether to mark a pre-release as the latest "dist-tag" or assign a particular tag. OpenUPM automates the process, so it designates the new release as the latest.

One solution could be adding the --stable flag to the openupm-cli install command, which would disregard pre-release versions.

Another option is to link the Git tag to the npm dist-tag. For instance, mapping 1.0.3-pre.2 to the pre dist-tag. This way, the "stable" version is installed by default, unless you specify --tag pre. However, this approach requires testing to determine how Unity handles different dist-tags or whether it simply ignores them. Keep in mind that our decisions usually aim to find a balance that aligns with Unity's behavior.