1.0.2 • Published 10 years ago

self-ref v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

self-ref

Self referenced in node_modules way for Node.js project. Before using this module, please notice the following:

  • use require('self-ref') outside of your app project, this module should only be used at your test case.

Installation

$ npm install self-ref --save-dev

Usage

First of all, assuming your project looks like the below distrubition:

- app
  - package.json
  - app/lib/server.js
  - app/test/test-server.js
  - node_modules
    - node_modules/express
    - node_modules/self-ref

And update your package.json:

{
  "main": "./lib/lib/server.js"
}

Finally in app/test/test-server.js, to reference the server.js:

const app = require('self-ref');

Why do we create this

Sometimes, in writing test cases, especially http application, we have to copy the server.js like:

const app = require('../../app/lib/server.js');

This might be friable and wrongable, so we, the WeFlex team created this module to make it easy.

License

MIT Licensed

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago