https://github.com/ganeshkbhat/get-root
Get root folders of git, svn, mercurial, ftp, nodejs node_modules, nodejs package.json
https://github.com/ganeshkbhat/get-root
Last synced: about 20 hours ago
JSON representation
Get root folders of git, svn, mercurial, ftp, nodejs node_modules, nodejs package.json
- Host: GitHub
- URL: https://github.com/ganeshkbhat/get-root
- Owner: ganeshkbhat
- License: mit
- Created: 2022-10-29T15:27:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-24T10:07:57.000Z (about 2 years ago)
- Last Synced: 2025-03-27T13:39:27.412Z (18 days ago)
- Language: JavaScript
- Size: 294 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - ganeshkbhat/get-root - Get root folders of git, svn, mercurial, ftp, nodejs node_modules, nodejs package.json (JavaScript)
README
# get-root
Get root folders of git, svn, mercurial, nodejs node_modules / package.json / package-lock.json, and nodejs .jscache folderFind the demos in the [demos folder](./demos)
### 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](https://github.com/ganeshkbhat/get-root/issues)
# License
[MIT License](./LICENSE)