zodern:meteor-package-versions

v0.2.1Published 2 years ago

zodern:meteor-package-versions

A simple compiler which allows importing files named .meteor-package-versions to get an object containing the packages used by the app and their versions.

Compatible with Meteor 1.4 and newer.

  1. Add the package with meteor add zodern:meteor-package-versions
  2. Create a file named .meteor-package-versions. The content doesn't matter.
  3. Import the file and use it
1import packages from './.meteor-package-versions';
2
3console.dir(packages);
4/*
5  Outputs:
6  { 'allow-deny': '1.1.0',
7  autopublish: '1.0.7',
8  autoupdate: '1.4.1',
9  'babel-compiler': '7.1.1',
10  'babel-runtime': '1.2.7',
11  base64: '1.0.11',
12  'binary-heap': '1.0.10',
13  blaze: '2.3.3',
14  'blaze-html-templates': '1.1.2',
15  'blaze-tools': '1.0.10',
16  ...
17  }

If the .meteor/versions file does not exist (such as when running meteor test-packages), the exported object will instead look like

1{
2  __errorRetrievingVersions: true
3}