(workspacePath: string)
| 44 | */ |
| 45 | export async function verifyNgDevToolIsUpToDate(workspacePath: string): Promise<boolean> { |
| 46 | const packageJsonPath = path.join(workspacePath, workspaceRelativePackageJsonPath); |
| 47 | const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); |
| 48 | // If we are operating in the actual dev-infra repo, always return `true`. |
| 49 | if (packageJson.name === '@angular/build-tooling') { |
| 50 | Log.debug('Skipping ng-dev version check as this is a locally generated version.'); |
| 51 | return true; |
| 52 | } |
| 53 | const expectedVersion = await getExpectedVersionFromPnpm(workspacePath); |
| 54 | |
| 55 | Log.debug('Checking ng-dev version in lockfile and in the running script:'); |
| 56 | Log.debug(` Local: ${localVersion}`); |
| 57 | Log.debug(` Expected: ${expectedVersion ?? 'unknown'}`); |
| 58 | |
| 59 | if (expectedVersion === null) { |
| 60 | Log.warn(' ⚠ Could not extract the expected `ng-dev` version from `pnpm-lock.yaml`.'); |
| 61 | if (!process.stdin.isTTY) { |
| 62 | return false; |
| 63 | } |
| 64 | try { |
| 65 | return await Prompt.confirm({ |
| 66 | message: 'Do you want to continue anyway?', |
| 67 | default: false, |
| 68 | }); |
| 69 | } catch { |
| 70 | return false; |
| 71 | } |
no test coverage detected