$ npm install find-project-root

Finds the project root by custom markers
As a binary
$ npm install find-project-root -g
$ pwd
/Users/kirstein/workspace/github/kirstein/find-project-root/test
$ find-project-root
/Users/kirstein/workspace/github/kirstein/find-project-root
As a node module
$ npm install find-project-root
var findProjectRoot = require('find-project-root');
// magic
Traverses top-down of the project tree starting from a specific path and searches for known markers that indicate project starting point.
Markers:
findProjectRoot(path, {options});
options:
var findProjectRoot = require('find-project-root');
var root = findProjectRoot(process.cwd(), {
maxDepth: 12
});
© 2010 - cnpmjs.org x YWFE | Home | YWFE