I've been experimenting with meteor.js recently, and it's great! The depth and breadth of the experience behind it really shows through in all the details, even at this fairly early stage. There isn't a lot of documentation out there yet, so I thought I'd record my notes here, in case they're helpful to those that follow. Corrections very welcome. Meteor is still changing rapidly, so I'll try to record exactly which version I was using and when.
How to Update Meteor
(Updated 5 Nov 2013 for Meteor 0.6.6.1)
Once you've installed meteor the first time, it looks like you can just run
meteor update
in your project to get it running the latest version.
Private Meteor Packages to Wrap npm Packages
(Updated 5 Nov 2013 for Meteor 0.6.6.3)
Meteor has its own "smart package" system that's mostly separate from Node's npm. The main difference seems to be that the smart package has to tell meteor which packaged files belong on the client, and which packaged files belong on the server. Meteor wrappers for many npm packages are available on the atmosphere repository, but they're not always up to date, and you may want to customise.
Fortunately, you can add private wrapper packages to your project. A good example is this XML2JS package. The steps were as follows. Create a subdirectory under packages
, which looks like:
my-project
packages
my-package
my-package.js
package.js
where, in the most basic case, my-package.js
just requires the underlying npm package:
myPackage = Npm.require('my-package');
and package.js defines the meteor package:
Package.describe({
summary: 'a description of your package'
});
Npm.depends({myPackage: 'x.y.z'});
Package.on_use(function(api) {
api.export('myPackage'); // required as of Meteor 0.6.5!
api.add_files('my-package.js', 'server');
});
Then manually add my-package
on a line in your .project/packages
file.
Then run meteorite with
mrt
to build the private package and install dependencies. This also adds a .gitignore files to your package directory, so you can then git add the packages directory, and it all seems to work.