Hot swap of local Meteor package

102 views Asked by At

I am using local Meteor package for my app (not posted on Atmosphere.js).

When I update this package elsewhere, I proceed with the following:

  1. Update version of the package.
  2. Delete old package from /packages/ directory of the live app.
  3. See my program search for packages 3(?) times and then crash:

    Your app is crashing. Here's the latest log: Errors prevented startup:

    While selecting package versions: error: unknown package in top-level dependencies: vladimir3000:testpack

    Your application has errors. Waiting for file change.

  4. Copy new package with new version.
  5. See my app picking up the changes and going live again:

    vladimir3000:testpack upgraded from 0.0.2 to 0.0.3 =>Meteor server restarted

Is there a way to avoid step 3 and more elegantly instruct meteor to replace one package with another. Meteor update would not work as the package is not on atmosphere.js. Or hot swap is something from SOA world not from blood and fibers of Meteor javascript?

1

There are 1 answers

4
Ivan On

You can simply paste over the files for the package.

When you delete the old package, Meteor sees a file change and rebuilds the app. Since the package no longer exists in the packages directory, Meteor will try to pull it down from Atmosphere since it sees that there is a dependency on vladimir3000:testpack in .meteor/packages.

It will attempt to resolve this dependency a few times, with each build failing because the package you are referencing is unknown.

You can stop meteor and delete and replace the folder. Or you can copy and paste over the folder. The second method is preferable because Meteor will simply rebuild with all of the new files, rather than rebuilding and trying to resolve the dependency using Atmosphere.