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

[UPDATE TASK] - update task is incompatible with esm.sh scripts #1748

Open
bjesuiter opened this issue Sep 6, 2023 · 0 comments
Open

[UPDATE TASK] - update task is incompatible with esm.sh scripts #1748

bjesuiter opened this issue Sep 6, 2023 · 0 comments

Comments

@bjesuiter
Copy link
Contributor

Description

esm.sh allows managing esm imports in import maps via it's cli

The Command

deno run -A -r https://esm.sh init

sets up the following scripts in deno.json:

  "tasks": {
    "esm:add": "deno run -A https://esm.sh/v129 add",
    "esm:update": "deno run -A https://esm.sh/v129 update",
    "esm:remove": "deno run -A https://esm.sh/v129 remove"
  },

For example: Running deno task esm:add zod , results in a change in import_map.json of:

"imports": {
    "zod": "https://esm.sh/v129/zod@3.22.2",
    "zod/": "https://esm.sh/v129/zod@3.22.2/"
}

The basic problem

Possible Solutions

QuickFix: Publish a manual migration guide for each fresh version

This allows skipping the fresh update command altogether

Preferred solution: Make fresh upgrade script not force-migrate import_map.json

Why should fresh care at all, which import map solution is used?
For new projects, the inlined version can be used, but for existing projects it should simply keep the existing format

Another Solution: Make this import map migration configureable in the update script

CAUTION: This might introduce a lot of complexity, therefore I'd recommend only detecting the used variant (deno.json with imports or external import_map.json) and keep using the existing one.

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