diff --git a/.meteor/packages b/.meteor/packages index c6bf86a8..bdd32907 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -19,3 +19,5 @@ ejson spacebars check ecmascript +meteorhacks:npm +npm-container diff --git a/.meteor/versions b/.meteor/versions index 5216b316..9e7e4b1a 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -33,12 +33,15 @@ livedata@1.0.15 logging@1.0.8 meteor@1.1.7 meteor-base@1.0.1 +meteorhacks:async@1.0.0 +meteorhacks:npm@1.5.0 minifiers@1.1.7 minimongo@1.0.9 mobile-experience@1.0.1 mobile-status-bar@1.0.6 mongo@1.1.1 mongo-id@1.0.1 +npm-container@1.2.0 npm-mongo@1.4.39_1 observe-sequence@1.0.7 ordered-dict@1.0.4 diff --git a/lib/util.js b/lib/util.js index 162001ed..07a0ddcb 100644 --- a/lib/util.js +++ b/lib/util.js @@ -8,3 +8,7 @@ this.assert = (condition, message) => { } this.maybeRequire = (module) => Meteor.isServer ? Npm.require(module) : null; + +if (Meteor.isServer) { + Meteor.npmRequire('es6-shim'); +} diff --git a/packages.json b/packages.json new file mode 100644 index 00000000..8bd8a9c9 --- /dev/null +++ b/packages.json @@ -0,0 +1,3 @@ +{ + "es6-shim": "0.33.3" +} diff --git a/packages/npm-container/.npm/package/.gitignore b/packages/npm-container/.npm/package/.gitignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/packages/npm-container/.npm/package/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/packages/npm-container/.npm/package/README b/packages/npm-container/.npm/package/README new file mode 100644 index 00000000..3d492553 --- /dev/null +++ b/packages/npm-container/.npm/package/README @@ -0,0 +1,7 @@ +This directory and the files immediately inside it are automatically generated +when you change this package's NPM dependencies. Commit the files in this +directory (npm-shrinkwrap.json, .gitignore, and this README) to source control +so that others run the same versions of sub-dependencies. + +You should NOT check in the node_modules directory that Meteor automatically +creates; if you are using git, the .gitignore file tells git to ignore it. diff --git a/packages/npm-container/.npm/package/npm-shrinkwrap.json b/packages/npm-container/.npm/package/npm-shrinkwrap.json new file mode 100644 index 00000000..13d1c1e7 --- /dev/null +++ b/packages/npm-container/.npm/package/npm-shrinkwrap.json @@ -0,0 +1,7 @@ +{ + "dependencies": { + "es6-shim": { + "version": "0.33.3" + } + } +} diff --git a/packages/npm-container/index.js b/packages/npm-container/index.js new file mode 100644 index 00000000..c3fc8620 --- /dev/null +++ b/packages/npm-container/index.js @@ -0,0 +1,9 @@ +Meteor.npmRequire = function(moduleName) { + var module = Npm.require(moduleName); + return module; +}; + +Meteor.require = function(moduleName) { + console.warn('Meteor.require is deprecated. Please use Meteor.npmRequire instead!'); + return Meteor.npmRequire(moduleName); +}; \ No newline at end of file diff --git a/packages/npm-container/package.js b/packages/npm-container/package.js new file mode 100644 index 00000000..9fab3ce4 --- /dev/null +++ b/packages/npm-container/package.js @@ -0,0 +1,30 @@ +var path = Npm.require('path'); +var fs = Npm.require('fs'); + +Package.describe({ + summary: 'Contains all your npm dependencies', + version: '1.2.0', + name: 'npm-container' +}); + +var packagesJsonFile = path.resolve('./packages.json'); +try { + var fileContent = fs.readFileSync(packagesJsonFile); + var packages = JSON.parse(fileContent.toString()); + Npm.depends(packages); +} catch (ex) { + console.error('ERROR: packages.json parsing error [ ' + ex.message + ' ]'); +} + +// Adding the app's packages.json as a used file for this package will get +// Meteor to watch it and reload this package when it changes +Package.onUse(function(api) { + api.addFiles('index.js', 'server'); + if (api.addAssets) { + api.addAssets('../../packages.json', 'server'); + } else { + api.addFiles('../../packages.json', 'server', { + isAsset: true + }); + } +}); \ No newline at end of file