Resolve platform root directory (the monorepo root) by searching upward for a package.json with workspaces.
ANGULAR_MODERNIZER_PLATFORM_ROOT takes precedence when set; without a match the fallback path relative to currentDir is used.
ANGULAR_MODERNIZER_PLATFORM_ROOT
currentDir
Starting directory for upward search (typically __dirname)
__dirname
Fallback relative path if monorepo root not found (e.g., '../../../..')
'../../../..'
Absolute path to platform root directory
import { fileURLToPath } from 'node:url';import * as path from 'node:path';const __filename = fileURLToPath(import.meta.url);const __dirname = path.dirname(__filename);const platformRoot = resolvePlatformRoot(__dirname, '../../../..'); Copy
import { fileURLToPath } from 'node:url';import * as path from 'node:path';const __filename = fileURLToPath(import.meta.url);const __dirname = path.dirname(__filename);const platformRoot = resolvePlatformRoot(__dirname, '../../../..');
Resolve platform root directory (the monorepo root) by searching upward for a package.json with workspaces.
ANGULAR_MODERNIZER_PLATFORM_ROOTtakes precedence when set; without a match the fallback path relative tocurrentDiris used.