root-dirs

0.0.3 • Public • Published

get-root

Get root folders of git, svn, mercurial, nodejs node_modules / package.json / package-lock.json, and nodejs .jscache folder

Find the demos in the demos folder

Demo usage:


var getroot = require("get-root");
let result = getroot.getRoot("./", { baseType: "git" });

.getRoot

Usage: getRoot(startdirectory, options = { baseType: "git", getRootCallback: callbackFunction })

Get the root folder of specified options.

/**
 *
 * @param {*} startdirectory
 * @param {string} [options={ baseType: "git", getRootCallback: callbackFunction }]
 * @return {*} 
 */

.getNodeModulesRoot

Usage: getNodeModulesRoot(startdirectory, options)

Get the root folder of node in the project.

/**
 *
 * @param {*} startdirectory
 * @param {*} options
 * @return {*} 
 */

.getGitRoot

Usage: getGitRoot(startdirectory, options)

Get the root folder of git in the project.

/**
 *
 * @param {*} startdirectory
 * @param {*} options
 * @return {*} 
 */

.getSvnRoot

Usage: getSvnRoot(startdirectory, options)

Get the root folder of svn in the project.

/**
 *
 * @param {*} startdirectory
 * @param {*} options
 * @return {*} 
 */

.getMercurialRoot

Usage: getMercurialRoot(startdirectory, options)

Get the root folder of mercurial in the project.

/**
 *
 * @param {*} startdirectory
 * @param {*} options
 * @return {*} 
 * 
 */

.getPackageJsonRoot

Usage: getPackageJsonRoot(startdirectory, options)

Get the root folder of package.json in the project.

/**
 *
 * @param {*} startdirectory
 * @param {*} options
 * @return {*} 
 */

.getPackageLockJsonRoot

Usage: getPackageLockJsonRoot(startdirectory, options)

Get the root folder of package.json in the project.

/**
 *
 * @param {*} startdirectory
 * @param {*} options
 * @return {*} 
 */

.getJscachePath

Usage: getJscachePath(startdirectory, options)

Get the root folder of jscache in the project.

/**
 *
 *
 * @param {*} startdirectory
 * @param {*} options
 * @return {*} 
 */

Contributions

Contributions, Feature Improvements, Bugs, and Issues are invited. raising an issue

License

MIT License

Package Sidebar

Install

npm i root-dirs

Weekly Downloads

5

Version

0.0.3

License

MIT

Unpacked Size

54.1 kB

Total Files

30

Last publish

Collaborators

  • ganeshkbhat