Skip to content

Commit 55549cc

Browse files
authored
build: fix standalone release checks failing due to missing global ReleaseAction instance (#24509)
Fixes the standalone release checks running outside of the `.ng-dev` config load, which comes with the `global.ReleaseAction`. In standalone checks this variable is not defined and therefore currently causes errors like: ``` /.ng-dev/release.ts:14 const actionProto = (global as any).ReleaseAction.prototype; ^ TypeError: Cannot read properties of undefined (reading 'prototype') at Object.<anonymous> ``` We can fallback to the imported `ReleaseAction` constructor object if the global reference is not provided. In such cases the monkey-patching is a noop anyway.
1 parent 3021cf5 commit 55549cc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.ng-dev/release.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
BuiltPackage,
33
ReleaseConfig,
4+
ReleaseAction as _ReleaseAction,
45
FatalReleaseActionError,
56
} from '@angular/dev-infra-private/ng-dev';
67
import {SemVer} from 'semver';
@@ -11,7 +12,7 @@ import {join} from 'path';
1112
// The `ng-dev` release tool exposes the `ReleaseAction` instance through `global`,
1213
// allowing it to be monkey-patched for our release checks. This can be removed
1314
// when the release tool has a public API for release checks.
14-
const actionProto = (global as any).ReleaseAction.prototype;
15+
const actionProto = ((global as any).ReleaseAction ?? _ReleaseAction).prototype;
1516
const _origStageFn = actionProto.stageVersionForBranchAndCreatePullRequest;
1617
const _origVerifyFn = actionProto._verifyPackageVersions;
1718

0 commit comments

Comments
 (0)