packageRootDir

Type:Function
Status:beta
Since:1.0.0
Platform:node
@blackbyte.sugar.node.path

Return the path to either the first finded package root going up the folders, or the highest package root finded

Params

  1. from”process.cwd()“String

    Specify from where the research has to be done

  2. settings{}Boolean

    Some settings to configure the research

Return

  1. -String

    The finded package path or false if not finded

Example

import { packageRootDir } from '@blackbyte/sugar/path';
const root = packageRootDir();

Settings

  1. highestfalseBoolean

    Specify if you want the highest package possible

  2. upCount*-Number

    Specify a number of packages to go up. Cannot be used alongside the highest setting

  3. requiredProperties[‘name’,‘version’]String[]

    Specify some required properties that MUST be present in the package.json to be considered as a valid package