bunch of functionlity
This commit is contained in:
9
web/packages/npm-container/index.js
Normal file
9
web/packages/npm-container/index.js
Normal file
@@ -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);
|
||||
};
|
||||
23
web/packages/npm-container/package.js
Normal file
23
web/packages/npm-container/package.js
Normal file
@@ -0,0 +1,23 @@
|
||||
var path = Npm.require('path');
|
||||
var fs = Npm.require('fs');
|
||||
|
||||
Package.describe({
|
||||
summary: 'Contains all your npm dependencies',
|
||||
version: '1.0.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.add_files(['index.js', '../../packages.json'], 'server');
|
||||
});
|
||||
Reference in New Issue
Block a user