Closed jfmengels closed 4 years ago
I think this should be feasible to implement in elm-json!
When using the the install
command, what essentially happens is that we take the current constraints, and add an extra constraint for the package-to-be-added. If no version is specified, this is an open constraint ("anything goes!"). If a version is specified, this becomes a very narrow constraint ("this exact version, please"). At least on the technical level, something like @2
being added as 2.0.0 <= v < 3.0.0
should be doable.
Thanks for the suggestion, I'm going to try and put some work into this tomorrow!
Thanks a lot for working on this @zwilias!
I understand that it was released in elm-json
v0.2.4, but it is not working for me, even by trying the example given in the docs
> elm-json install elm/http@2
error: Invalid value for '<PACKAGE>...': Invalid version: 2
Could it be that the CLI args parser still doesn't allow package "names" like elm/http@2
?
Oh lord, I messed up the deploy to github by messing with tags, trying to get the RPI build working š¤¦āā
I'll tag a v0.2.5
, and release that once all the builds are finished!
There we go š
Works great, thanks a lot! :tada:
Hi!
I'd like to request the ability to install the latest version of a major release of a dependency. In other words, I'd like to be able to do
elm-json install author/name@2
, or the equivalent ofnpm install something@^2
innpm
.Request context
I am the author
elm-review
, which is a library and CLI, and the CLI useselm-json
under the hood (thanks a lot for this tool, by the way :heart:).elm-review
works using a configuration written in Elm, where it defines the review rules to enable. Some of which are defined in local files, and the rest are found in Elm packages, such as this one.To avoid polluting the project's
elm.json
(and potentially blocking the install of their dependencies), the configuration is in thereview/
directory of their project, which has aConfig.elm
file and anelm.json
file.When running the actual review, it in essence copies the
review/
folder somewhere inelm-stuff
and compiles a new application by merging the user configuration and Elm code contained and specific to the CLI, using thesource-directories
and the dependencies found inreview/elm.json
.To help onboard the user, the CLI provides an
init
command, where it will create thereview/
directory with an empty configuration file and anelm.json
, and will install thejfmengels/elm-review
package usingelm-json install jfmengels/elm-review
.That last section is where my problem resides. The code contained CLI application works for/with a specific version of this package (
1.0.0 <= v < 2.0.0
), but when runninginit
, it will install the latest released version, potentially 2.0.0 or later. In effect, the day I release v2.0.0, all the existinginit
with the CLI that supports only v1.x.x will stop working correctly.Proposed solution
The solutions I could think of with are:
Specifying in the CLI the exact version of
jfmengels/elm-review
that will work (ex:1.3.4
), but that makes it necessary to release a new version of the CLI every time I release the package, which is not great.Have
elm-json
support a syntax likeelm-json install author/name@1
Have the CLI fetch the contents of the package registry, find out the latest version of the package of the major release I wish to support, and install that one (basically reimplement
elm-json solve
I think?)I think I will go with solution 3, but maybe solution 2 is an easy and welcome (to you) addition to
elm-json
.I don't know the exact reason for
elm install
not supporting this option in the first place. I am guessing it is because this is quite a rare edge-case.Let met know what you think :)