MCPcopy Create free account
hub / github.com/angular/dev-infra / verifyNgDevToolIsUpToDate

Function verifyNgDevToolIsUpToDate

ng-dev/utils/version-check.ts:46–68  ·  view source on GitHub ↗
(workspacePath: string)

Source from the content-addressed store, hash-verified

44 */
45export 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 }

Callers 2

ngDevVersionMiddlewareFunction · 0.85
runMethod · 0.85

Tested by

no test coverage detected