jspm / registry

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

Added support for npm:bootstrap@3.3.7 #975

Open peebeebee opened 7 years ago

peebeebee commented 7 years ago

Now npm:bootstrap includes the dist folder, not the source files

peebeebee commented 7 years ago

jspm install npm:bootstrap now only contains the source font-files and javascript. No css/less, because the root does not contain a 'css'-folder.

So I see 2 choices:

  1. add the less files (so most source-files are in the package)
  2. pass the dist folder (like jspm install bootstrap does)

What would be the preference? Also: I don't really understand how the packaging from npm vs github is so different. Does JSPM handle those differently?

guybedford commented 7 years ago

On jspm install npm:bootstrap I see the following files:

fonts/        js/           package.json  
dist/         grunt/        less

So don't we just need to be setting the main here then?

peebeebee commented 7 years ago

That's weird, my output is different. (see below) Nevermind the global installed package, and all that stuff. :)

➜  test jspm install npm:bootstrap

warn Running jspm globally, it is advisable to locally install jspm via npm install jspm --save-dev.

Package.json file does not exist, create it? [yes]:
Would you like jspm to prefix the jspm package.json properties under jspm? [yes]:
Enter server baseURL (public folder path) [./]:
Enter jspm packages folder [./jspm_packages]:
Enter config file path [./config.js]:
Configuration file config.js doesn't exist, create it? [yes]:
Enter client baseURL (public folder URL) [/]:
Do you wish to use a transpiler? [yes]:
Which ES6 transpiler would you like to use, Babel, TypeScript or Traceur? [babel]:
     Looking up npm:bootstrap
     Updating registry cache...
     Looking up github:jspm/nodelibs-fs
     Looking up github:jspm/nodelibs-process
     Looking up github:jspm/nodelibs-path
     Looking up npm:path-browserify
     Looking up npm:process
ok   Installed github:jspm/nodelibs-path@^0.1.0 (0.1.0)
ok   Installed github:jspm/nodelibs-process@^0.1.0 (0.1.2)
ok   Installed github:jspm/nodelibs-fs@^0.1.0 (0.1.2)
ok   Installed npm:path-browserify@0.0.0 (0.0.0)
ok   Installed npm:process@^0.11.0 (0.11.9)
     Looking up github:jspm/nodelibs-assert
     Looking up github:jspm/nodelibs-vm
     Looking up npm:vm-browserify
ok   Installed github:jspm/nodelibs-vm@^0.1.0 (0.1.0)
     Looking up npm:indexof
ok   Installed npm:vm-browserify@0.0.4 (0.0.4)
     Looking up npm:assert
ok   Installed github:jspm/nodelibs-assert@^0.1.0 (0.1.0)
ok   Installed npm:indexof@0.0.1 (0.0.1)
     Looking up npm:util
ok   Installed npm:assert@^1.3.0 (1.4.1)
     Looking up npm:inherits
ok   Installed npm:util@0.10.3 (0.10.3)
ok   Installed npm:inherits@2.0.1 (2.0.1)
     Looking up github:jspm/nodelibs-buffer
     Looking up github:jspm/nodelibs-util
     Looking up npm:buffer
ok   Installed github:jspm/nodelibs-buffer@^0.1.0 (0.1.0)
ok   Installed github:jspm/nodelibs-util@^0.1.0 (0.1.0)
     Looking up npm:base64-js
     Looking up npm:ieee754
     Looking up npm:isarray
ok   Installed npm:buffer@^3.0.1 (3.6.0)
ok   Installed npm:isarray@^1.0.0 (1.0.0)
ok   Installed npm:ieee754@^1.1.4 (1.1.6)
ok   Installed npm:base64-js@0.0.8 (0.0.8)
     Looking up github:jspm/nodelibs-child_process
ok   Installed github:jspm/nodelibs-child_process@^0.1.0 (0.1.0)
ok   Installed bootstrap as npm:bootstrap@^3.3.7 (3.3.7)
ok   Install tree has no forks.
     Looking up loader files...
       system.js
       system.src.js
       system.js.map
       system-polyfills.js
       system-csp-production.src.js
       system-polyfills.js.map
       system-csp-production.js
       system-polyfills.src.js
       system-csp-production.js.map

     Using loader versions:
       systemjs@0.19.37
     Looking up npm:babel-core
     Looking up npm:babel-runtime
     Looking up npm:core-js
ok   Installed babel as npm:babel-core@^5.8.24 (5.8.38)
ok   Installed babel-runtime as npm:babel-runtime@^5.8.24 (5.8.38)
     Looking up github:systemjs/plugin-json
ok   Installed github:systemjs/plugin-json@^0.1.0 (0.1.2)
ok   Installed core-js as npm:core-js@^1.1.4 (1.2.7)
ok   Loader files downloaded successfully

ok   Install complete.
➜  test ls -al jspm_packages/npm/bootstrap@3.3.7
total 16
drwxr-xr-x   6 peterbriers  staff   204 Sep 19 19:18 .
drwxr-xr-x  30 peterbriers  staff  1020 Sep 19 19:18 ..
-rw-r--r--   1 peterbriers  staff    91 Sep 19 19:18 .jspm-hash
drwxr-xr-x   7 peterbriers  staff   238 Sep 19 19:18 fonts
drwxr-xr-x  14 peterbriers  staff   476 Sep 19 19:18 js
-rw-r--r--   1 peterbriers  staff  2200 Sep 19 19:18 package.json
guybedford commented 7 years ago

Try removing any local overrides first?

guybedford commented 7 years ago

(from the package.json)

guybedford commented 7 years ago

And that's exactly why I'd discourage files and directories.lib.

peebeebee commented 7 years ago

There are no local overrides. Totally fresh installs, npm & jspm.

guybedford commented 7 years ago

Actually that is exactly right. The published package configuration for Bootstrap contains the following:

  "jspm": {
    "main": "js/bootstrap",
    "shim": {
      "js/bootstrap": {
        "deps": "jquery",
        "exports": "$"
      }
    },
    "files": [
      "css",
      "fonts",
      "js"
    ]
  },

The files filter here is thus what is restricting things.

I would suggest trying jspm install npm:boostrap -o "{files:null}" which should remove the restrictive files filter.

If that works out, and seems the right fix, then we can add the override and also get the change into bootstrap itself.

peebeebee commented 7 years ago

jspm install npm:bootstrap -o "{files:null}" gives me the correct files indeed. I can add this overwrite to the registry. But beware, these will be breaking changes for people already using jspm install npm:bootstrap. Is this wanted?

Furthermore, jspm install github:twbs/bootstrap also seems to be wrong. This only gives back the dist folder, while both bower install bootstrap and npm install bootstrap gives back the full source (+ dist). So I think this should be the default behaviour. SO should we also overwrite twbs/bootstrap (it is already overwritten in the JSPM registry)

guybedford commented 7 years ago

@peebeebee adding extra files is not a breaking change, only removing them is, so I'd be happy to add this into the registry here. I'm open to a similar PR for jspm install github:twbs/bootstrap as well, although it is probably best to stick with one as the main source for bootstrap, and let the other lie.