Meteor 0.6.0: brand new distribution system, app packages, NPM integration

April 04, 2013 By Matt DeBergalis
Vote on Hacker News

We're delighted to announce Meteor 0.6.0, featuring a completely new system for distributing Meteor releases and updating applications. Meteor 0.6.0 also adds application-specific packages and direct support for NPM modules.

Beginning in 0.6.0, Meteor applications are pinned to a specific Meteor release, and you can run different Meteor releases on the same computer. Meteor uses a control file in your application directory to mark which version of the Meteor distribution the application requires. So for each separate application, you decide which specific version of Meteor it should use, control when to update to a new version, and synchronize that update with the rest of your development team and your production deployment.

With the new distribution system, it is easier to manage the update cycle for applications, and to test your applications against new Meteor releases before committing to an update. We're now able to ship release candidates in advance of a general release, and create custom releases that let you try a proposed bug fix or feature still in development.

Meteor 0.6.0 also includes NPM integration. This addition, requested by many developers in the community, allows Meteor packages to directly depend on NPM modules. When you add an NPM module to a package, Meteor locks down the specific versions of each of its subdependencies so that each copy of your app runs against exactly the same code.

Finally, applications can now include private Meteor packages in their packages directory, which can themselves specify NPM dependencies. Private packages are now the recommended way to include NPM modules in an app.

Run $ meteor update to switch to the new distribution system. If you're new to Meteor, you can get started on OS X or Linux by running

$ curl https://install.meteor.com | /bin/sh

in your terminal window.

Read on for more details on the changes. Full release notes are available in GitHub.

New distribution system

You can now have multiple Meteor releases installed simultaneously. Each Meteor core package is now separately versioned. A Meteor release (such as 0.6.0) is just a distribution of particular versions of each core package. The meteor command line tool now manages a cache of core packages on your computer. When a new Meteor release is available, it will download the updated versions of packages in the background and add them to the cache. One benefit to this approach is that once installed, you can use all the available releases even while offline, switching back and forth between them.

Meteor applications are tied to a particular release. To update an application to a new release, run meteor update inside its directory. You can take the latest stable release by default, or specify a particular release name with the --release option. You can also use the --releaseoption to run your application against a different distribution version without updating the control file, so it's easy to test new distributions, or switch back and forth between alternatives.

To include a private application package, add it to your app's packages directory. The format is the same as a core package: a directory containing a package.js file.

NPM integration

Meteor packages, including private application packages, can use the new Npm.dependsdirective in their package.js file to depend on NPM modules. There's no need to manually download or install NPM modules. When you add a new NPM dependency in package.js or update a version specifier while developing a package, Meteor will automatically calculate subdependencies, fetch any necessary updates from NPM for you, and restart your server with the new code.

Once included, package code can use Npm.require to pull in the module.

If the NPM module has architecture-specific binary components, bundles built with meteor bundle or meteor deploy will contain the components as built for the developer's platform and may not run on other platforms.

Other changes

Thanks to the new 0.6.0 distribution system, Meteor now supports any x86 (32- or 64-bit) Linux system, not just those which use Debian or RedHat package management.

We've added file-level JavaScript variable scoping. Variables declared with var at the outermost level of a JavaScript source file are now private to that file. Remove the var to share a value between files. If you're using CoffeeScript, see the CoffeeScript package documentation for how to share a value between files.

Meteor's internal package tests (as well as tests you add to your app's packages with the unsupported Tinytest framework) are now run with the new command meteor test-packages.

The Meteor blog

Successful Partners, Successful Platform.
Announcing early access to Meteor Galaxy
An early look at SQL in Meteor
2015 Student Summer Meteor Hackathon: Recap
A Javascript State of the Union
Building maintainable step-by-step tutorials with Git
How much does ECMAScript 2015 cost?