openupm / openupm-cli

The OpenUPM-CLI is a command-line interface for maintaining UPM registries.
https://openupm.com
BSD 3-Clause "New" or "Revised" License
241 stars 13 forks source link

Preview version will be installed #395

Closed nowsprinting closed 1 week ago

nowsprinting commented 3 weeks ago

The preview version will be installed when I don't specify a package version. I want an option to exclude preview and experimental versions.

$ openupm --version
4.1.2

$ openupm add -f com.unity.test-framework
notice manifest modified com.unity.test-framework 1.1.14 => 2.0.1-pre.18
notice please open Unity project to apply changes

Stable com.unity.test-framework version is 1.4.5. v2 is deprecated.

favoyang commented 3 weeks ago

This is likely because Unity didn't use the npm dist-tag correctly. Typically, they should publish version 1.x with the "latest" tag and use the "next" tag for 2.0.1-pre. However, to be fair, openupm didn't follow this convention either. Our pipeline simply compares the version with the current latest version, and if the version is newer, it marks it with the "latest" tag or the "patch" tag.

In practice, the CLI could do more by introducing a virtual dist-tag "stable", so running openupm add com.unity.test-framework@stable would ignore all preview packages and select the latest stable version for you.

ComradeVanti commented 3 weeks ago

Is this a duplicate of #64?

favoyang commented 3 weeks ago

Yes. Though I propose different solutions, use '--stable' parameter or a special '@stable' tag.

nowsprinting commented 3 weeks ago

Thank you for your reply. I'd be happy if the virtual dist-tag "stable" were introduced!

ComradeVanti commented 1 week ago

Just implemented the @stable tag and tested it with the provided example by @nowsprinting. Seems to work but I'll leave it open a bit for feedback.

ComradeVanti commented 1 week ago

A pull request for this feature is now open at #404. @nowsprinting if you have the time you could take a look to see if it also works for you. Thanks :)

nowsprinting commented 1 week ago

@ComradeVanti san, Thanks!!! I built the code in the PR, and it works as expected!

$ openupm add com.unity.test-framework@stable
notice modified com.unity.test-framework 1.4.4 => 1.4.5
ComradeVanti commented 1 week ago

@nowsprinting great to know. The PR is now merged 🚀

nowsprinting commented 1 week ago

Thanks!!!