Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Added support for npm:[email protected] #975

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

peebeebee
Copy link

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

Copy link
Member

@guybedford guybedford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this. Does jspm install npm:bootstrap not work at all otherwise? What errors are you getting? Is there an issue anywhere for this at all?

{
"main": "js/bootstrap",
"directories": {
"lib": "dist"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change, do we really need this. It can be better to use dist/js/bootstrap etc in the other configurations.

"shim": {
"js/bootstrap": {
"deps": [
"jquery",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid trailing comma.

"exports": "$"
}
},
"files": [ "dist" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best to leave this out as well, no reason to filter out the other files if users may find them useful.

"lib": "dist"
},
"shim": {
"js/bootstrap": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

js/bootstrap -> dist/js/bootstrap.

@peebeebee
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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:[email protected] (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:[email protected] (0.0.4)
     Looking up npm:assert
ok   Installed github:jspm/nodelibs-assert@^0.1.0 (0.1.0)
ok   Installed npm:[email protected] (0.0.1)
     Looking up npm:util
ok   Installed npm:assert@^1.3.0 (1.4.1)
     Looking up npm:inherits
ok   Installed npm:[email protected] (0.10.3)
ok   Installed npm:[email protected] (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:[email protected] (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:
       [email protected]
     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/[email protected]
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
Copy link
Member

Try removing any local overrides first?

@guybedford
Copy link
Member

(from the package.json)

@guybedford
Copy link
Member

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

@peebeebee
Copy link
Author

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

@guybedford
Copy link
Member

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
Copy link
Author

peebeebee commented Sep 23, 2016

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
Copy link
Member

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants