https://github.com/scbd/rootquire
Load node project modules relatively to project root
https://github.com/scbd/rootquire
Last synced: 3 months ago
JSON representation
Load node project modules relatively to project root
- Host: GitHub
- URL: https://github.com/scbd/rootquire
- Owner: scbd
- License: mit
- Created: 2018-05-03T17:03:57.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-10T16:46:03.000Z (about 8 years ago)
- Last Synced: 2025-01-18T20:40:34.942Z (over 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 1
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rootquire
Allows users to avoid relative path dots hell.
Detect project root by looking for first existing `node_modules` folder from list in `require.main.paths`
# Install
```
npm install --save scbd/rootquire#version
```
# Usage
## With Rootquire
```js
var User = require('rootquire')('models/user');
```
## Without Rootquire
```js
var User = require('../../../../../models/user');
```
## Print root path
```js
require('rootquire').debug();
```
Similar to **Undot**. Undot is relative to start main module
https://github.com/gsanches/undot