hayd / deno-udd

Update Deno Dependencies - update dependency urls to their latest published versions
MIT License
329 stars 18 forks source link

support import_maps.json #64

Open beckend opened 2 years ago

beckend commented 2 years ago

https://deno.land/manual/linking_to_external_code/import_maps

hayd commented 2 years ago

duplicate of #7 .

I will try and look at this later in the week. I am actually a little surprised it doesn't "just work"!

hayd commented 2 years ago

I just tested this (from the example):

$ udd import_map.json
import_map.json
[1/1] Update successful: https://deno.land/std@0.124.0/fmt/ -> 0.125.0
Successfully updated:
https://deno.land/std@0.124.0/fmt/ 0.124.0 -> 0.125.0

What further is needed?

(This behavior ought to be tested in CI... and documented in the README.)

boredland commented 2 years ago

I just tried this and for me it seems to just look up the first dependency. Can you confirm that it works with multiple? I've got some clearly outdated ones in my import map:

{
  "imports": {
    "$fresh/": "https://deno.land/x/fresh@1.0.0/",
    "preact": "https://esm.sh/preact@10.8.1",
    "preact/": "https://esm.sh/preact@10.8.1/",
    "preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.0?deps=preact@10.8.1",
    "@twind": "./utils/twind.ts",
    "twind": "https://esm.sh/twind@0.16.17",
    "twind/": "https://esm.sh/twind@0.16.17/",
    "@trpc/server": "https://esm.sh/v82/@trpc/server@10.0.0-alpha.22",
    "@trpc/server/": "https://esm.sh/v82/@trpc/server@10.0.0-alpha.22/",
    "@trpc/client": "https://esm.sh/v82/@trpc/client@10.0.0-alpha.22?deps=@trpc/server@10.0.0-alpha.22",
    "trpc-swr": "https://esm.sh/v82/trpc-swr@0.1.0?alias=swr:https%3A%2F%2Fesm.sh%2Fswr%401.3.0%3Fdeps%3Dreact%4018,@trpc/server:https%3A%2F%2Fesm.sh%2F%40trpc%2Fserver%4010.0.0-alpha.22,@trpc/client:https%3A%2F%2Fesm.sh%2F%40trpc%2Fclient%4010.0.0-alpha.22"
  }
}
Warning deno task is unstable and may drastically change in the future
Task udd deno run -A --unstable https://deno.land/x/udd@0.5.0/main.ts import_map.json
import_map.json
[1/1] Using latest: https://deno.land/x/fresh@1.0.0/
Already latest version:
https://deno.land/x/fresh@1.0.0/ == 1.0.0

--> it may just be an issue around updating alpha releases tho.

hayd commented 2 years ago

@boredland I think the actual error there is that esm.sh urls are not being read correctly/at all !