Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: New version tokens for TOML, JSON, and YAML plugins #711

Open
tom-fletcher opened this issue Feb 5, 2025 · 2 comments
Open

Feature: New version tokens for TOML, JSON, and YAML plugins #711

tom-fletcher opened this issue Feb 5, 2025 · 2 comments

Comments

@tom-fletcher
Copy link

Issue

Follow on from #710.

This relates only to TOML, JSON, and YAML plugins.

Some tools have non-standard versioning. For example, the backend-convex package releases daily builds tagged in the format:

precompiled-2025-02-04-7d6e1db

This can be resolved using the resolve.version-pattern:

[resolve]
git-url = "https://github.com/get-convex/convex-backend"
version-pattern = "^precompiled-(?<major>\\d{4})-(?<minor>\\d{2})-(?<patch>\\d{2})-(?<pre>[a-f0-9]+)$"

Which then allows the user to pin the version in their .prototools file as if it were semver:

convex-backend = "2025.02.04-7d6e1db"

Note that calver isn't used here, due to the limitations discussed in #710 i.e. if pre starts with a number then calver can't validate the version

All of this works fine, until the download-url is composed. This must be in the format:

https://github.com/get-convex/convex-backend/releases/download/precompiled-2025-02-04-7d6e1db/{download_file}"

However, proto doesn't currently provide granularity in the tokens to format this. The closest we can currently get is using {version}, which only allows us to create an invalid link as follows:

https://github.com/get-convex/convex-backend/releases/download/precompiled-2025.02.04-7d6e1db/{download_file}

Solution

Adding additional version tokens allows the download-link to be composed more granularly. With {versionMinor} and {versionPatch}, this could be composed as follows:

[install]
download-url = "https://github.com/get-convex/convex-backend/releases/download/precompiled-{versionMajor}-{versionMinor}-{versionPatch}-{versionPrerelease}/{download_file}"

The {versionMajorMinor} and {versionYearMonth} tokens can also be deprecated at this stage, as if the user needs these, they can build these manually i.e. {versionMajor}.{versionMonth}.

Pull requests

This requires changes (in the following order) to the moonrepo/plugins, moonrepo/proto, and moonrepo/moon repositories to update the schema_tool, version of schema_tool used by proto, and the website.

PRs are incoming, and will be linked to this issue shortly for tracking. 😄

@tom-fletcher
Copy link
Author

tom-fletcher commented Feb 5, 2025

Pull requests for this change have been submitted. If released, this would need to be in the following order:

@milesj
Copy link
Contributor

milesj commented Feb 5, 2025

@tom-fletcher Awesome stuff. Left 1 comment on the schema PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants