diff options
| author | 2023-11-03 21:25:40 +0800 | |
|---|---|---|
| committer | 2023-11-03 21:25:40 +0800 | |
| commit | 9029588590bea8b10451575c5142dcde77ecd1b5 (patch) | |
| tree | 04cf8aee56c23fd225ff19d340f7cee621d874ef /packages/turbo-utils/src/searchUp.ts | |
| parent | 94071d7ce16c56641d67d488e2bac6be84ffe731 (diff) | |
| download | HydroRoll-9029588590bea8b10451575c5142dcde77ecd1b5.tar.gz HydroRoll-9029588590bea8b10451575c5142dcde77ecd1b5.zip | |
chore: delete useless files
Diffstat (limited to 'packages/turbo-utils/src/searchUp.ts')
| -rw-r--r-- | packages/turbo-utils/src/searchUp.ts | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/packages/turbo-utils/src/searchUp.ts b/packages/turbo-utils/src/searchUp.ts deleted file mode 100644 index 57f92e4..0000000 --- a/packages/turbo-utils/src/searchUp.ts +++ /dev/null @@ -1,44 +0,0 @@ -import fs from "fs"; -import path from "path"; - -function searchUp({ - target, - cwd, - contentCheck, -}: { - target: string; - cwd: string; - contentCheck?: (content: string) => boolean; -}): string | null { - const root = path.parse(cwd).root; - - let found = false; - while (!found && cwd !== root) { - if (contentCheck) { - try { - const content = fs.readFileSync(path.join(cwd, target)).toString(); - if (contentCheck(content)) { - found = true; - break; - } - } catch { - // keep looking - } - } else { - if (fs.existsSync(path.join(cwd, target))) { - found = true; - break; - } - } - - cwd = path.dirname(cwd); - } - - if (found) { - return cwd; - } - - return null; -} - -export default searchUp; |
