MCPcopy
hub / github.com/witheve/Eve / findRoot

Function findRoot

bin/eve.js:16–26  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

14
15// Since our current development pattern uses npm as its package repository, we treat the nearest ancestor directory with a package.json (inclusive) as the directory's "root".
16function findRoot(root) {
17 var pkg;
18 root = root.split(path.sep);
19 while(!pkg && root.length > 1) {
20 var cur = root.join(path.sep);
21 if(fs.existsSync(path.join(cur, "package.json"))) {
22 return cur;
23 }
24 root.pop();
25 }
26}
27
28
29var port = argv["port"] || process.env.PORT || 8080;

Callers 1

eve.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected