NPM dependencies for Meteor 1.3 packages

Continuing the discussion from Meteor 1.3 early beta now available:

This seems like a tricky situation. Maybe Meteor packages can have a way to define themselves as NPM modules, and therefore they will not use api.exportFiles, but instead will have an entry point and export whatever they need to export from that entry point. They could also have a package.json to specify NPM dependencies, although they don’t actually ship with those dependencies installed.

Then, maybe in the app’s top-level package.json, a dev can put in there something like

{
  "dependencies": {
    "@meteor/username_package-name": '^X.X.X'
  }
}

where MDG would add those special Atmosphere packages to NPM under the @meteor scope (which is currently taken, unfortunately, and possibly not claimable). Alternatively, the scope could be @atmosphere (which isn’t taken, hurry, act fast! EDIT: I registered it, just in case. PM me for the password and then you can change it).

{
  "dependencies": {
    "@atmosphere/username_package-name": '^X.X.X'
  }
}

The simple rule here is that if there is package foo:bar on Atmosphere, then it in the app package.json we replace the : with _, and prepend @atmosphere/, so @atmosphere/foo_bar. meteor publish might take the extra step of publishing such NPM Meteor packages to the @atmosphere scope on NPM as well as to Atmosphere.

This would mean that npm install in the top-level of an app will handle dependencies the way we are used to NPM handling them (including dependency forks), which I think is better than Meteor packages blindly importing/requiring things and devs having to manually specify all Meteor package dependencies.

1 Like