| 186 | export const workspaceRoot = _computeWorkspaceRoot(process.cwd()); |
| 187 | |
| 188 | function _computeWorkspaceRoot(cwd: string) { |
| 189 | if (dirname(cwd) === cwd) { |
| 190 | return process.cwd(); |
| 191 | } |
| 192 | |
| 193 | const packageJsonAtCwd = join(cwd, 'package.json'); |
| 194 | if (existsSync(packageJsonAtCwd)) { |
| 195 | const content = JSON.parse(readFileSync(packageJsonAtCwd, 'utf-8')); |
| 196 | if (content.name === 'qwik-monorepo') { |
| 197 | return cwd; |
| 198 | } |
| 199 | } |
| 200 | return _computeWorkspaceRoot(dirname(cwd)); |
| 201 | } |
| 202 | |
| 203 | export function log(text: string) { |
| 204 | // eslint-disable-next-line no-console |