gleam-lang / gleam

⭐️ A friendly language for building type-safe, scalable systems!
https://gleam.run
Apache License 2.0
16.51k stars 691 forks source link

Allow `gleam add` to take a version specifier #3262

Open mscharley opened 3 weeks ago

mscharley commented 3 weeks ago

It would be really helpful if gleam add could take a version specifier along with a package name and use that to limit what it installs.

My initial syntax proposal would be gleam add gleam_json@1.0.1. This would be a non-breaking change since you could just not specify a version and things would work as before - it is a purely additive change.

What I propose this should do is replace the version that gleam determines. eg, the current latest version of gleam_json is 2.0.0. Instead of selecting the latest version, gleam would instead select the version specified. The initial version written into manifest.toml would be the version specified, and the version guard written into gleam.toml would be the same derived version used currently, but based on the specified version instead of the latest version, eg. >= 1.0.1 and < 2.0.0.

lpil commented 3 weeks ago

Sounds good! It would be nice to be able to specify just a major or major and minor version too.

gleam add gleam_json@1
gleam add gleam_json@1.2
rdghosal commented 2 weeks ago

I can give this one a go!