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

Support for version ranges #173

Closed
dkniffin opened this issue Feb 9, 2023 · 4 comments
Closed

Support for version ranges #173

dkniffin opened this issue Feb 9, 2023 · 4 comments

Comments

@dkniffin
Copy link
Contributor

dkniffin commented Feb 9, 2023

Is it possible to specify a minor version of a pinned package?

For example, I'm using slim-select in my project. It seems I need to add the following to my config file:

pin "slim-select", to: "https://ga.jspm.io/npm:[email protected]/dist/slimselect.min.mjs"

But what happens if they release a 1.27.2? Or 1.28.0? Or 2.0?

importmap outdated seems to partially solve this. It would show me if there's a new version. But then I would need to determine on my own if I can upgrade to that version or not. For a patch version, I probably can. Maybe for a minor version. But a major version would require some more effort on my part, presumably.

The main question I guess is: how do I track which versions I can upgrade to and which ones I can't? Is that outside the scope of importmap-rails?

@jcoyne
Copy link

jcoyne commented Mar 9, 2023

Agreed. It would be great to have the equivalent of yarn upgrade but I'd first need a way to provide a version specification.

@dhh
Copy link
Member

dhh commented Apr 23, 2023

I can appreciate wanting that, but turning importmap rails into a full package manager is out of scope. You can use outdated, and you'll have to manage the versions yourself.

@dhh dhh closed this as completed Apr 23, 2023
@dkniffin dkniffin changed the title Support for semver versioning Support for version ranges May 9, 2023
@dkniffin
Copy link
Contributor Author

dkniffin commented May 9, 2023

I changed the title of this issue, because semver doesn't currently support any kind of version range syntax, nor do they plan to and that's really what's needed here. iow, semver defines what 1.0.2 means, but as far as I can tell, it has no definition for things like 1.0.x/1.x.0, or ~>2.0, or ^2.0.8, or >= 3.0 or any of that kind of stuff.

@dkniffin
Copy link
Contributor Author

Looping back here to mention that I created a gem to add this functionality: https://github.com/quimbee/importmap-package-manager It lets you separate your library imports into a separate config/importmap_packages.yml (which has allows defining version specs), then run rake importmap_package_manager:update to generate/update a config/importmap-packages-lock.rb file (which includes the sub-dependencies), which gets included in the importmap.

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

No branches or pull requests

3 participants