Cross-registry dependencies (with Angular components)

36 views
Skip to first unread message

Nicolas Guillaumin

unread,
May 25, 2016, 6:01:26 PM5/25/16
to jspm
Hi,

I'm using JSPM and I'm trying to use an 3rd party Angular component angular-jqcloud: https://www.npmjs.com/package/angular-jqcloud

I'm getting Angular via the default JSPM package which uses GitHub:

"angular": "github:angular/bower-...@1.5.0"

angular-jqcloud is published on NPM, so I added a dependency as such:

"angular-jqcloud": "npm:angular...@1.0.3"

But "angular-jqcloud" declares a dependency in its package.json:

"angular": "1.x"

...which seem to cause JSPM to try to get Angular from NPM (and failing), rather than resolving it from the Angular that's already coming from the GitHub registry.

What's the proper way to deal with this? Should I override the dependencies in my package.json like so?

"npm:angular...@1.0.3": {
 
"registry": "github",
 
"dependencies": {
   
"angular": "github:angular/bower-...@1.5.0"
  }
}

That seem to work, but now I'm missing the "jqcloud2" dependency that was also listed in "angular-jqcloud2" package.json. Should I repeat it in my override? Does that means I'll have to maintain this override over time and make sure to keep it in sync with what the upstream package defines, like:

"npm:angular...@1.0.3": {
  "registry": "github",
  "dependencies": {
   "angular": "github:angular/bower-...@1.5.0",
    "jqcloud2": "npm:jqcl...@2.0.2"
  }
}

That sounds like a lot of overhead, am I missing something?

Also, I need "jqcloud2" to be loaded first, so I assume I must also declare a "shim", making tje complete config:

"npm:angular...@1.0.3": {
  "registry": "github",
  "dependencies": {
    "angular": "github:angular/bower-...@1.5.0",
    "jqcloud2": "npm:jqcl...@2.0.2"
  },
  "shim": {
    "angular-jqcloud": [
      "jqcloud2"
    ]
  }
}

Am I getting this correctly? That looks like a lot of manual work to repeat for every package, I just want to check I'm not missing anything.

Thanks,

Nico

Guy Bedford

unread,
Jun 10, 2016, 7:03:39 AM6/10/16
to Nicolas Guillaumin, jspm
You're not missing anything, this is exactly the right way to configure jspm. It's hard because we're carving out new packaging conventions here.

If you want to share that override in the jspm registry, feel free to post a PR at https://github.com/jspm/registry.



--
You received this message because you are subscribed to the Google Groups "jspm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jspm-io+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicolas Guillaumin

unread,
Jun 11, 2016, 6:48:23 AM6/11/16
to jspm
Ok fair enough, thanks for your reply!

Nico


On Thursday, May 26, 2016 at 12:01:26 AM UTC+2, Nicolas Guillaumin wrote:
Hi,

I'm using JSPM and I'm trying to use an 3rd party Angular component angular-jqcloud: https://www.npmjs.com/package/angular-jqcloud

I'm getting Angular via the default JSPM package which uses GitHub:

"angular": "github:angular/bower-angular@1.5.0"

angular-jqcloud is published on NPM, so I added a dependency as such:

"angular-jqcloud": "npm:angular...@1.0.3"

But "angular-jqcloud" declares a dependency in its package.json:

"angular": "1.x"

...which seem to cause JSPM to try to get Angular from NPM (and failing), rather than resolving it from the Angular that's already coming from the GitHub registry.

What's the proper way to deal with this? Should I override the dependencies in my package.json like so?

"npm:angular...@1.0.3": {
 
"registry": "github",
 
"dependencies": {

   
"angular": "github:angular/bower-angular@1.5.0"
  }
}

That seem to work, but now I'm missing the "jqcloud2" dependency that was also listed in "angular-jqcloud2" package.json. Should I repeat it in my override? Does that means I'll have to maintain this override over time and make sure to keep it in sync with what the upstream package defines, like:

"npm:angular...@1.0.3": {
  "registry": "github",
  "dependencies": {
   "angular": "github:angular/bower-angular@1.5.0",
    "jqcloud2": "npm:jqcl...@2.0.2"
  }
}

That sounds like a lot of overhead, am I missing something?

Also, I need "jqcloud2" to be loaded first, so I assume I must also declare a "shim", making tje complete config:

"npm:angular...@1.0.3": {
  "registry": "github",
  "dependencies": {
    "angular": "github:angular/bower-angular@1.5.0",
    "jqcloud2": "npm:jqcl...@2.0.2"
  },
  "shim": {
    "angular-jqcloud": [
      "jqcloud2"
    ]
  }
}

Am I getting this correctly? That looks like a lot of manual work to repeat for every package, I just want to check I'm not missing anything.

Thanks,

Nico
Reply all
Reply to author
Forward
0 new messages