Retrieves the pnpm lock file from upstream on the primary branch and extracts the version.
()
| 69 | } catch { |
| 70 | return false; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | if (localVersion !== expectedVersion) { |
| 75 | Log.warn(' ⚠ Your locally installed version of the `ng-dev` tool is outdated and not'); |
| 76 | Log.warn(' matching with the version in the `pnpm-lock.yaml` file.'); |
| 77 | Log.warn(' Re-install the dependencies to ensure you are using the correct version.'); |
| 78 | return false; |
| 79 | } |
| 80 | |
| 81 | return true; |
| 82 | } |
| 83 | |
| 84 | /** Retrieves the expected ng-dev version from the pnpm lockfile using `pnpm list`. */ |
| 85 | async function getExpectedVersionFromPnpm(workspacePath: string): Promise<string | null> { |
| 86 | try { |
| 87 | const {stdout} = await ChildProcess.spawn( |
| 88 | 'pnpm', |
| 89 | ['list', '@angular/ng-dev', '--json', '--lockfile-only'], |
| 90 | { |
| 91 | cwd: workspacePath, |
| 92 | mode: 'silent', |
| 93 | suppressErrorOnFailingExitCode: true, |
| 94 | }, |
| 95 | ); |
| 96 | return extractNgDevVersionFromPnpmList(stdout); |
| 97 | } catch (e) { |
| 98 | Log.debug('Could not find expected ng-dev version from `pnpm list`:', e); |
| 99 | return null; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | interface PnpmListProject { |
| 104 | dependencies?: Record<string, {version: string}>; |
| 105 | devDependencies?: Record<string, {version: string}>; |
no test coverage detected