@larsthorup/local
Simplify requiring local modules
Last updated 5 months ago by larsthorup .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @larsthorup/local 
SYNC missed versions from official npm registry.

node-local-require

npm version Build Status

Simplify requiring local modules

The purpose of this module is to make it easy to keep self-contained Node modules in the same repo as the rest of your app during initial development, in such a way that you can easily convert the module to be a real external module eventually.

Usage

npm install @larsthorup/local --save

var local = require('@larsthorup/local');
var config = local('config');

Verification

You can optionally declare local modules in dependency order in package.json. If so, local() will verify requests against the declaration, unless NODE_ENV is production:

{ 
  "config": {
    "@larsthorup/local": {
      "modules": [
        "core",
        "lib"
      ]
    }
  }
}

var util = local('util'); // Note: will throw an error

var core = local('core'); // Note: will succeed if in some source file in lib

var lib = local('lib'); // Note: will throw an error if in some source file in core 

Current Tags

  • 0.6.2                                ...           latest (5 months ago)

9 Versions

  • 0.6.2                                ...           5 months ago
  • 0.6.1                                ...           4 years ago
  • 0.6.0                                ...           4 years ago
  • 0.5.0                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.3.1                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 10
This Month 13
Last Day 0
Last Week 1
Last Month 3
Dependencies (3)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |