JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 57
  • Score
    100M100P100Q60390F
  • License MIT

Find project root given current working directory

Package Exports

  • residence

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (residence) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme


Version

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

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

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.