Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oresoftware/residence
Allows you find an NPM root of a project given current working directory
https://github.com/oresoftware/residence
nodejs npm project root suman sumanjs
Last synced: 15 days ago
JSON representation
Allows you find an NPM root of a project given current working directory
- Host: GitHub
- URL: https://github.com/oresoftware/residence
- Owner: ORESoftware
- License: mit
- Created: 2016-03-01T22:16:34.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-09-14T06:01:40.000Z (over 5 years ago)
- Last Synced: 2024-12-11T20:44:06.281Z (17 days ago)
- Topics: nodejs, npm, project, root, suman, sumanjs
- Language: JavaScript
- Homepage:
- Size: 23.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
[![Version](https://img.shields.io/npm/v/residence.svg?colorB=green)](https://www.npmjs.com/package/residence)
# Residence
Allows you find a root of a project given current working directory (```process.cwd()```)
### Examples
> Looking for the NPM project root, by looking for package.json
```js
import * as residence from 'residence';
const rootPath = residence.findProjectRoot(process.cwd());
// root is either null or a project root path, found by looking for the first package.json file
```> Looking for a project root, by looking for another file
```js
import * as residence from 'residence';
const rootPath = residence.findRootDir(process.cwd(), '.nlu.json');
// walks up the fs towards '/' and returns the path when it finds the first .nlu.json file
// returns null otherwise.
```