MCPcopy Create free account
hub / github.com/chiihero/Microsoft-Rewards-Script / getProjectRoot

Function getProjectRoot

scripts/utils.js:10–19  ·  view source on GitHub ↗
(currentDir)

Source from the content-addressed store, hash-verified

8}
9
10export function getProjectRoot(currentDir) {
11 let dir = currentDir
12 while (dir !== path.parse(dir).root) {
13 if (fs.existsSync(path.join(dir, 'package.json'))) {
14 return dir
15 }
16 dir = path.dirname(dir)
17 }
18 throw new Error('找不到项目根目录 (未找到 package.json)')
19}
20
21export function log(level, ...args) {
22 console.log(`[${level}]`, ...args)

Callers 2

clearSessions.jsFile · 0.90
browserSession.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected