[Feature Request] publish using version argument
The issue Right now, as far as I can tell, the version of a package must be set in a config json. Be that deno.json, jsr.json or other. I miss the ability to control the version of my package outside of the package itself, specifically through a GitHub workflow that gets triggered on publishing a new release. This creates the possibility of my release version and package version being out of sync (something that I have already done by mistake).
The solution
I suggest that the publish command has a --version flag that can be optionally used to provide the new version instead of including it in the config file. I primarily want to be able to pass the exact version number, but it might also be useful to pass patch, minor or major to automatically increment the version.
Potential issues
- A --version argument should probably not override an existing version entry in the package config, as I imagine that could create issues or confusion when downloading a specific version of the package where the config file says it's another version.
- Setting a version through an argument could allow publishing the exact same code as a new version, multiple times. Maybe this could be solved through analyzing the contents and recognizing duplicate versions?
Yes this feature makes sense to me. I think we should just hard error if the --version flag is passed, if there is also a version field specified in the config file.
Additionally, we'd still require specifying versions for individual packages when publishing a workspace.
I agree that hard error in the case of --version flag and version field makes the most sense.
Resolved by https://github.com/denoland/deno/pull/26141. Related: #544, #555.
Related bug: https://github.com/denoland/deno/issues/27428
This is implemented as of https://github.com/jsr-io/jsr/pull/868
To use it, remove the version field from the jsr.json/deno.json and then use the --set-version <verison> flag.
Also, I'd recommend checking out https://github.com/dsherret/jsr-publish-on-tag/