Skip to content

webantic/meteor-deps

Repository files navigation

Meteor Deps

A module to store all runtime Meteor dependencies for npm modules to consume

This module is part of a suite:

Setup

  1. Add the injector to your module's exports:
var wrapExports = require('@webantic/meteor-deps').wrapExports

var moduleExports = {
thing1: require('./thing1.js'),
thing2: require('./thing2.js')
}

module.exports = wrapExports(module, moduleExports)
or
import { inject } from '@webantic/meteor-deps'

import thing1 from './thing1.js'
import thing2 from './thing2.js'

export {
thing1,
thing2,
inject
}
  1. Declare your dependencies in your package.json:
{
"name": "my-cool-module",
"version": "1.0.0",
"dependencies": {},
"meteorDependencies": {
  "meteor": ["client", "server"],
  "kadira:flow-router": "client"
}
}

Usage

All the exports of every Meteor dep in your project's npm modules will be available in the meteor-deps module. You can retrieve them with .get():

var getDep = require('@webantic/meteor-deps').get
var Meteor = getDep('Meteor')

// In some cases, you may need to access the value asynchronously, like this:
getDep('Meteor').then(function (Meteor) {
  // ...
})

About

A Meteor dependency injector for Node

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •