jspm / registry

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

cometd/cometd #672

Open jakefreeberg opened 8 years ago

jakefreeberg commented 8 years ago

I'm struggling with https://github.com/cometd/cometd

I need to package about 5 files from it. There's some AMD set up on those files, but no minified/dist files or package management support in the repo.

I think I start like this: "overrides": { "github:cometd/cometd@3.0.7": { "directories": { "lib": "cometd-javascript" }, "main": "jquery/src/main/webapp/jquery/jquery.cometd", }}

and setting the jQuery dependency is simple but getting the "common" library loaded as a dependency has me beat at this point...

I read this, but it doesn't get me where I need to go: https://gitter.im/jspm/jspm/archives/2015/10/05

jakefreeberg commented 8 years ago

So I guess this epic shim will work:

"github:cometd/cometd@3.0.7": {
        "directories": {
          "lib": "cometd-javascript"
        },
        "main": "jquery/src/main/webapp/jquery/jquery.cometd",
        "shim": {
          "jquery/src/main/webapp/jquery/jquery.cometd": {
            "deps": [
              "jquery",
              "../../../../../common/src/main/js/org/cometd/cometd-header.js",
              "../../../../../common/src/main/js/org/cometd/cometd-namespace.js",
              "../../../../../common/src/main/js/org/cometd/cometd-json.js",
              "../../../../../common/src/main/js/org/cometd/Utils.js",
              "../../../../../common/src/main/js/org/cometd/TransportRegistry.js",
              "../../../../../common/src/main/js/org/cometd/Transport.js",
              "../../../../../common/src/main/js/org/cometd/RequestTransport.js",
              "../../../../../common/src/main/js/org/cometd/LongPollingTransport.js",
              "../../../../../common/src/main/js/org/cometd/CallbackPollingTransport.js",
              "../../../../../common/src/main/js/org/cometd/WebSocketTransport.js",
              "../../../../../common/src/main/js/org/cometd/CometD.js",
              "../../../../../common/src/main/js/org/cometd/cometd-amd.js"
            ]
          }
        },
        "dependencies": {
          "jquery": "github:components/jquery"
        }
      }

Is there a better way?

guybedford commented 8 years ago

Ha, well as long as it works! Is is really assumed you'd include all of the above in separate script tags though? As of right now there isn't an alternative, but in jspm 0.17 there will be more control including the ability to avoid the backtracking.