(root: string)
| 37 | |
| 38 | // https://docs.deno.com/runtime/fundamentals/workspaces/ |
| 39 | function hasWorkspaceDenoJSON(root: string): boolean { |
| 40 | for (const name of ['deno.json', 'deno.jsonc']) { |
| 41 | const path = join(root, name) |
| 42 | if (!isFileReadable(path)) { |
| 43 | continue |
| 44 | } |
| 45 | try { |
| 46 | const content = JSON.parse(fs.readFileSync(path, 'utf-8')) || {} |
| 47 | if (content.workspace) return true |
| 48 | } catch { |
| 49 | // deno.jsonc is only detected when it is also valid JSON. Full |
| 50 | // JSONC parsing would require an additional parser. |
| 51 | } |
| 52 | } |
| 53 | return false |
| 54 | } |
| 55 | |
| 56 | function hasRootFile(root: string): boolean { |
| 57 | return ROOT_FILES.some((file) => fs.existsSync(join(root, file))) |
no test coverage detected