Transcript
  • Meteor
  • Tutorial

Updating Meteor and Package Versions

Meteor just released version 0.8.0, which is really exciting. It has all the new Blaze work. You may have been following along in the Shark branch of Meteor and the Dev branch of Iron Router. In this episode, I thought we would review how to update our Meteor release and to update packages like Iron Router.

I'm in our sample To Dos application. The first thing I want to do is to find out what version of Meteor this application is using. To do that, I can type meteor--version. And you can see that currently, we're on the release candidate 1. So the first thing I'd like to do is to update this project to use the latest release. I can take Meteor Update.

When that process completes, if I look at Meteor Version again, I should now be on the latest release. And this means that I'll be using all the latest packages of Meteor that are pinned to the 0.80 release.

Now let's look at our smart packages from Atmosphere. This part can be a little tricky, and sometimes, things can go wrong. So I'd like to show you around a little bit and make sure that we understand what all the different parts of Atmosphere Packages are.

So if I look in the Root directory here, there's three things to look at. We have a Smart.json file, a Smart.loc file, and then a Packages folder. If we look at the Smart.json file, this is what governs which packages we're going to be using from Atmosphere. So when you type MRT Add Iron Router, you'll see a new entry created in the Packages area here.

So the first thing I'd like to do in this file is to change Iron Router from using this Get Branch checkout to using an actual version. So I'm just going to say 0.7.0 is the release for Iron Router. And that will pin this package to this particular version when we update.

Next, let's take a look at Smart.lock. So this is what our project is currently pinned to. If you look at the Iron Router package, you can see that it's getting it from Get. We're on the Dev branch. And this is the specific commit that we're locked to in this project. So this is what we want to update.

Now, if I look in the Packages folder, you can see that there's two files in there-- Iron Router and Blaze Layout. And both are Sim links to a Meteorite directory that has the specific version of the package that we've specified in our smart JSON file.

And finally, the way that Meteor itself becomes aware of our local packages is there's a package file inside of the Meteor directory. So if I go into Meteor and just take a look at it, you can see this Packages file in there. So if I cat packages, you can see a list of them there. And you'll see Iron Router is the second package in the list. An easier way to do this is I can just type Meteor List and then the Using flag, and then you can see that same list there.

So to update Iron Router to the latest version, what I'll do is an MRT update. And you'll see that Meteorite grabbed Version 0.7.0 of Iron Router and its dependency, which is a Blaze layout, which is what lets Iron Router work with the new Blaze rendering engine. Now what we want to do is a little checklist to make sure that the right files were updated and that we have the Iron Router package actually installed.

So let's look in our Packages directory again. And you should see the Iron Router and Blaze Layout packages in there. If I use the -a flag, we can take a look at the actual sim links. And you should see that Iron Router is on the latest commit, which it looks like it is. And if I type Meteor List Using, you want to make sure that Iron Router has actually been added to that list. And if it hasn't what you can do is type Meteor Add Iron Router. And as long as the Iron Router or any other packages exist in your Packages folder, Meteor will use that one.

So when I hit Enter, it'll tell me that I'm already using it. But I've noticed that sometimes the package doesn't get added properly. So if that happens, just type Meteor Add and then the package name, and you should be good to go.

Finally, if I take a look at the smart.loc file, it should be updated now to reflect the latest version of the package since we typed MRT Update. So the tag, you can see, is the correct tag. And if we were to go into the repository and check the latest commit or the commit that's associated with the tag, we'd see that it looks like this.

Then you should be able to fire up your application like normal. And if I go over into the browser, it looks like the application is working properly, and there's no errors in the JavaScript console. So we're good to go with the latest version of Meteor and Iron Router.