jspm / registry

The jspm registry and package.json override service
https://jspm.io
229 stars 256 forks source link

debug@2.6.0 override not working #1024

Closed perrin4869 closed 7 years ago

perrin4869 commented 7 years ago

I did:

rm ~/.jspm
jspm uninstall debug
jspm install debug

Inside a jspm project, however, the following is obtained:

$ cat jspm_packages/npm/debug@2.6.0.json                                                                                                                                 
{
  "main": "browser.js",
  "format": "cjs",
  "map": {
    "./browser.js": {
      "node": "./node.js"
    },
    "fs": "@node/fs",
    "net": "@node/net",
    "tty": "@node/tty",
    "util": "@node/util"
  }
}

which is not the override defined in this repository here

What could be the problem? Thanks!

aluanhaddad commented 7 years ago

Do you have an existing override? Try jspm install npm:debug --force

guybedford commented 7 years ago

jspm install npm:debug -fo can also be used here to force update the override from the original override as well.

perrin4869 commented 7 years ago

I see! Yeah the problem was the override inside the package.json... maybe it'd be a good idea to make -fo a default?

guybedford commented 7 years ago

The -o option is basically just to reset to an empty override. By default the existing override is maintained to ensure that once you install with an override it doesn't change. That is necessary to keep installs consistent.

perrin4869 commented 7 years ago

hm... why add the segment to package.json when doing jspm install npm:debug then?

guybedford commented 7 years ago

That is exactly the override - the override used at install time is stored as a constant of the build so that subsequent installs are complete replications.

perrin4869 commented 7 years ago

hm... what about the cases where it's not constant? It seems to me like the override section in package.json should be reserved for manual overrides only, while overrides that come from the registry should remain in jspm.config.js only, since they may change during upgrade

guybedford commented 7 years ago

This is what we did in jspm 0.16, but changed this in 0.17 because otherwise registry overrides can never be changed without breaking someone's build (which happened a few times before).

perrin4869 commented 7 years ago

hm... I fail to see how that would break someone's build. If they are relying on the registry's overrides, and the registry override is updated correctly, how could the build break?

guybedford commented 7 years ago

Most override changes are backwards-incompatible.

perrin4869 commented 7 years ago

hm... I think I need an example to figure this one out. Anyways, this issue is solved now, thanks!