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

Unable to unpin #229

Open
jcoyne opened this issue Jan 5, 2024 · 1 comment
Open

Unable to unpin #229

jcoyne opened this issue Jan 5, 2024 · 1 comment

Comments

@jcoyne
Copy link

jcoyne commented Jan 5, 2024

On 2.0.1

I first list the packages I've pinned:

bin/importmap packages
video.js 8.6.1
@babel/runtime 7.23.5
@videojs/vhs-utils 4.1.0
@videojs/vhs-utils 3.0.5
@videojs/xhr 2.6.0
@xmldom/xmldom 0.8.10
dom-walk 0.1.2
global 4.4.0
is-function 1.0.2
keycode 2.2.0
m3u8-parser 6.2.0
min-document 2.19.0
mpd-parser 1.2.2
mux.js 7.0.2
safe-json-parse 4.0.0
url-toolkit 2.2.5
videojs-vtt.js 0.15.5
openseadragon 4.1.0
fscreen 1.2.0
@google/model-viewer 3.3.0
@lit/reactive-element 1.6.3
lit 2.8.0
lit-element 3.3.3
lit-html 2.8.0
three 0.160.0

Then I try to unpin video.js:

bin/importmap unpin video.js 8.6.1
Couldn't find any packages in ["video.js", "8.6.1"] on jspm

If I try it without the version I see:

bin/importmap unpin video.js 
Couldn't find any packages in ["video.js"] on jspm

However I was able to unpin other packages:

bin/importmap unpin lit
Unpinning and removing "lit"
Unpinning and removing "@lit/reactive-element"
Unpinning and removing "lit-element/lit-element.js"
Unpinning and removing "lit-html"
Unpinning and removing "lit-html/is-server.js"
@pasl
Copy link

pasl commented Feb 9, 2024

I also had trouble understanding how Importmap works since version 2.

What I've found is that you have to specify the specific version with the '@' sign like this:

bin/importmap pin [email protected]

This will result in the following in importmap.rb:

pin "jsprintmanager" # @5.0.2

The version number will be appended in a comment.

It will also download the file to vendor/javascript, which is something we previously needed to explicitly add the --download option for when pinning. Now, it always downloads the file, I believe.

You can see that the parameter to: 'https://....' is no longer used in the importmap.rb file. The 'old' syntax is actually confusing because the version specified in the URL will not match the actual downloaded version.

For unpinning, there's no need to specify the version:

bin/importmap unpin [email protected]
bin/importmap unpin [email protected]
bin/importmap unpin jsprintmanager

All of these commands will unpin the library even if the version mismatch. The only requirement is that the version actually exists on JSPM is you chose to specify a version.

Also, be careful because bin/importmap update will update all libraries to the latest version. If you need to keep an old version of a specific library, I think you can use:

importmap outdated

and then pin each library that needs to be updated one by one.

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

2 participants