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

Outdated package detection does not work when pinning specific files #293

Open
tagliala opened this issue Mar 16, 2025 · 0 comments
Open

Comments

@tagliala
Copy link

tagliala commented Mar 16, 2025

Hello,

I'm not sure this is an issue, but I'm extracting this unexpected behavior from a comment I wrote in a different issue

I got bitten again by flowbite, which requires its .turbo. variant to work with Turbo

pin "flowbite/dist/flowbite.turbo.min.js", to: "flowbite--dist--flowbite.turbo.min.js.js" # @3.1.1
$ bin/importmap outdated
No outdated packages found

At the moment I'm writing, there is a 3.1.2 version: https://www.npmjs.com/package/flowbite/v/3.1.2

The original issue:

As an update, a drawback with this approach is that outdated packages are not being detected

Example:

$ bin/importmap pin @highlightjs/[email protected]/es/core.min.js --from=jsdelivr
Pinning "@highlightjs/cdn-assets/es/core.min.js" to vendor/javascript/@highlightjs/cdn-assets/es/core.min.js.js via download from https://cdn.jsdelivr.net/npm/@highlightjs/[email protected]/es/core.min.js

$ bin/importmap outdated
No outdated packages found

$ bin/importmap pin [email protected] --from=jsdelivr
Pinning "highlight.js" to vendor/javascript/highlight.js.js via download from https://cdn.jsdelivr.net/npm/[email protected]/es/index.js

$ bin/importmap outdated
| Package      | Current | Latest  |
|--------------|---------|---------|
| highlight.js | 11.10.0 | 11.11.1 |
  1 outdated package found

The "problem" is here:

importmap.scan(/^pin .*(?<=npm:|npm\/|skypack\.dev\/|unpkg\.com\/)(.*)(?=@\d+\.\d+\.\d+)@(\d+\.\d+\.\d+(?:[^\/\s["']]*)).*$/) |
importmap.scan(/^pin ["']([^["']]*)["'].* #.*@(\d+\.\d+\.\d+(?:[^\s]*)).*$/)

Originally posted by @tagliala in #270

In an experimental project I'm working on, I'm using this workaround to only compare the package name:

https://github.com/tagliala/iconmap-rails/blame/0532ec7f9d6e3f381cdb26eca5416c7a08133890/lib/iconmap/npm.rb#L62-L67

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

1 participant