# rootpath

> Little helper to make node.js require relative to your project root

Latest version **0.1.2** (published 2014-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install rootpath
pnpm add rootpath
yarn add rootpath
bun add rootpath
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2014-04-29 |
| First published | 2013-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 45 |
| Author | Fabrizio Moscon |
| Maintainers | fabmos, sandfox |
| Keywords | require, require path, require absolute path |

## Links

- npm: https://www.npmjs.com/package/rootpath
- Repository: https://github.com/fabriziomoscon/rootpath
- Issues: https://github.com/fabriziomoscon/rootpath/issues
- npm.io page: https://npm.io/package/rootpath

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.2 (latest) — 2014-04-29
- 0.1.1 — 2013-06-23
- 0.1.0 — 2013-06-23

## README

rootpath
========

Little helper to make node.js `require` relative to your project root

When working on a node.js project with subfolders you might find it difficult to remember the correct relative path to include a common module or library which is not published on npm. 
Using this module you just need to remember your own project directory structure and make all `require` absolute to the project root directory

[![Build Status](https://travis-ci.org/fabriziomoscon/rootpath.png)](https://travis-ci.org/fabriziomoscon/rootpath)

install
-------

`npm install rootpath`


BEFORE
```JavaScript
// from $HOME_PROJECT/lib/math/
var myLib = require('../myLibrary');
var myUtils = require('../../utils/myUtils');
var myTest = require('../../test/myTest');
``` 

AFTER
```JavaScript
// from $HOME_PROJECT/lib/math/

require('rootpath')();

var myLib = require('lib/myLibrary');
var myUtils = require('utils/myUtils');
var myTest = require('test/myTest');
```

improvements
------------

Forks and pull requests are welcome. There is always a better way of achieving a goal. This project will benefit from the contribution of the community.

test
----

```bash
npm test
```
license
-------

MIT

---
_Source: https://npm.io/package/rootpath · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
