Expose the "version" field of package.json files at runtime.

This commit is contained in:
Ben Newman
2016-01-18 19:26:54 -05:00
parent c631d3ac35
commit 0907f52f53
3 changed files with 7 additions and 1 deletions

View File

@@ -449,6 +449,7 @@ export default class ImportScanner {
// Output a JS module that exports just the "name" and "main"
// properties defined in the package.json file.
"exports.name = " + JSON.stringify(pkg.name) + ";\n" +
"exports.version = " + JSON.stringify(pkg.version) + ";\n" +
"exports.main = " + JSON.stringify(pkg.main) + ";\n"
);

View File

@@ -4,7 +4,7 @@
"description": "Test app exercising many aspects of the Meteor module system.",
"private": true,
"dependencies": {
"moment": "^2.11.1",
"moment": "2.11.1",
"regenerator": "^0.8.42"
},
"scripts": {

View File

@@ -121,6 +121,11 @@ describe("local node_modules", () => {
// Defined in packages/modules-test-package/common.js.
assert.strictEqual(typeof regeneratorRuntime, "object");
});
it('should expose "version" field of package.json', () => {
const pkg = require("moment/package.json");
assert.strictEqual(pkg.version, "2.11.1");
});
});
describe("Meteor packages", () => {