diff --git a/.circleci/dynamic_config.yml b/.circleci/dynamic_config.yml
index 0ecc28f51b54..5ea0540093ad 100644
--- a/.circleci/dynamic_config.yml
+++ b/.circleci/dynamic_config.yml
@@ -11,7 +11,7 @@ version: 2.1
orbs:
browser-tools: circleci/browser-tools@1.1.3
- devinfra: angular/dev-infra@1.0.7
+ devinfra: angular/dev-infra@1.0.8
parameters:
snapshot_changed:
@@ -385,6 +385,9 @@ jobs:
workflows:
version: 2
default_workflow:
+ when:
+ not:
+ equal: [scheduled_pipeline, << pipeline.trigger_source >>]
jobs:
# Linux jobs
- setup
@@ -485,3 +488,21 @@ workflows:
<<: *only_pull_requests
requires:
- build
+
+ daily_run_workflow:
+ when:
+ and:
+ - equal: [scheduled_pipeline, << pipeline.trigger_source >>]
+ - equal: ['14.2.x nightly run', << pipeline.schedule.name >>]
+ jobs:
+ - setup
+ - build:
+ requires:
+ - setup
+ - e2e-tests:
+ name: e2e-cli-nightly
+ requires:
+ - build
+ - test-browsers:
+ requires:
+ - build
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ac496a1bbd9d..fb5950fcca23 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,81 @@
+
+
+# 14.2.11 (2023-03-16)
+
+### @angular-devkit/build-angular
+
+| Commit | Type | Description |
+| --------------------------------------------------------------------------------------------------- | ---- | ------------------------------------- |
+| [ddd33bf38](https://github.com/angular/angular-cli/commit/ddd33bf38d7d76e816ebc0459559917da514477d) | fix | update webpack dependency to `5.76.1` |
+
+## Special Thanks
+
+Alan Agius and Joey Perrott
+
+
+
+
+
+# 14.2.10 (2022-11-17)
+
+### @angular/cli
+
+| Commit | Type | Description |
+| --------------------------------------------------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------- |
+| [9ce386caf](https://github.com/angular/angular-cli/commit/9ce386caf6037f21f422a785fec977634406d208) | fix | exclude `@angular/localize@<10.0.0` from ng add pa… ([#24152](https://github.com/angular/angular-cli/pull/24152)) |
+| [6446091a3](https://github.com/angular/angular-cli/commit/6446091a310f327ceeb68ae85f3673f6e3e83286) | fix | exclude `@angular/material@7.x` from ng add package discovery |
+| [7541e04f3](https://github.com/angular/angular-cli/commit/7541e04f36ff32118e93588be38dcbb5cc2c92a9) | fix | respect registry in RC when running update through yarn |
+
+### @angular-devkit/build-angular
+
+| Commit | Type | Description |
+| --------------------------------------------------------------------------------------------------- | ---- | -------------------------------- |
+| [21cea0b42](https://github.com/angular/angular-cli/commit/21cea0b42f08bf56990bdade82e2daa7c33011ed) | fix | update `loader-utils` to `3.2.1` |
+
+## Special Thanks
+
+Alan Agius and Charles Lyding
+
+
+
+
+
+# 14.2.9 (2022-11-09)
+
+### @angular-devkit/architect
+
+| Commit | Type | Description |
+| --------------------------------------------------------------------------------------------------- | ---- | --------------------------------------------------- |
+| [e3e787767](https://github.com/angular/angular-cli/commit/e3e78776782da9d933f7b0e4c6bf391a62585bee) | fix | default to failure if no builder result is provided |
+
+### @angular-devkit/build-angular
+
+| Commit | Type | Description |
+| --------------------------------------------------------------------------------------------------- | ---- | --------------------------------------------------- |
+| [12b2dc5a2](https://github.com/angular/angular-cli/commit/12b2dc5a2374f992df151af32cc80e2c2d7c4dee) | fix | isolate zone.js usage when rendering server bundles |
+
+## Special Thanks
+
+Alan Agius and Charles Lyding
+
+
+
+
+
+# 14.2.8 (2022-11-02)
+
+### @schematics/angular
+
+| Commit | Type | Description |
+| --------------------------------------------------------------------------------------------------- | ---- | ----------------------------------------------------- |
+| [4b0ee8ad1](https://github.com/angular/angular-cli/commit/4b0ee8ad15efcb513ab5d9e38bf9b1e08857e798) | fix | guard schematics should include all guards (CanMatch) |
+
+## Special Thanks
+
+Andrew Scott
+
+
+
# 14.2.7 (2022-10-26)
diff --git a/package.json b/package.json
index a63c86859f5f..a0bad3b2e992 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@angular/devkit-repo",
- "version": "14.2.7",
+ "version": "14.2.11",
"private": true,
"description": "Software Development Kit for Angular",
"bin": {
@@ -170,7 +170,7 @@
"less-loader": "11.0.0",
"license-checker": "^25.0.0",
"license-webpack-plugin": "4.0.2",
- "loader-utils": "3.2.0",
+ "loader-utils": "3.2.1",
"magic-string": "0.26.2",
"mini-css-extract-plugin": "2.6.1",
"minimatch": "5.1.0",
@@ -218,7 +218,7 @@
"typescript": "4.8.1-rc",
"verdaccio": "5.14.0",
"verdaccio-auth-memory": "^10.0.0",
- "webpack": "5.74.0",
+ "webpack": "5.76.1",
"webpack-dev-middleware": "5.3.3",
"webpack-dev-server": "4.11.0",
"webpack-merge": "5.8.0",
diff --git a/packages/angular/cli/src/commands/add/cli.ts b/packages/angular/cli/src/commands/add/cli.ts
index d65cd78e4278..55768138e4f2 100644
--- a/packages/angular/cli/src/commands/add/cli.ts
+++ b/packages/angular/cli/src/commands/add/cli.ts
@@ -10,7 +10,7 @@ import { analytics, tags } from '@angular-devkit/core';
import { NodePackageDoesNotSupportSchematics } from '@angular-devkit/schematics/tools';
import npa from 'npm-package-arg';
import { dirname, join } from 'path';
-import { compare, intersects, prerelease, satisfies, valid } from 'semver';
+import { Range, compare, intersects, prerelease, satisfies, valid } from 'semver';
import { Argv } from 'yargs';
import { PackageManager } from '../../../lib/config/workspace-schema';
import { isPackageNameSafeForAnalytics } from '../../analytics/analytics';
@@ -47,9 +47,11 @@ interface AddCommandArgs extends SchematicsCommandArgs {
* when attempting to find a compatible version for a package.
* The key is a package name and the value is a SemVer range of versions to exclude.
*/
-const packageVersionExclusions: Record = {
- // @angular/localize@9.x versions do not have peer dependencies setup
- '@angular/localize': '9.x',
+const packageVersionExclusions: Record = {
+ // @angular/localize@9.x and earlier versions as well as @angular/localize@10.0 prereleases do not have peer dependencies setup.
+ '@angular/localize': '<10.0.0',
+ // @angular/material@7.x versions have unbounded peer dependency ranges (>=7.0.0).
+ '@angular/material': '7.x',
};
export class AddCommandModule
@@ -187,7 +189,10 @@ export class AddCommandModule
return false;
}
// Excluded package versions should not be considered
- if (versionExclusions && satisfies(value.version, versionExclusions)) {
+ if (
+ versionExclusions &&
+ satisfies(value.version, versionExclusions, { includePrerelease: true })
+ ) {
return false;
}
diff --git a/packages/angular/cli/src/utilities/package-metadata.ts b/packages/angular/cli/src/utilities/package-metadata.ts
index e7a448aa8d61..faded207495f 100644
--- a/packages/angular/cli/src/utilities/package-metadata.ts
+++ b/packages/angular/cli/src/utilities/package-metadata.ts
@@ -139,6 +139,18 @@ function readOptions(
continue;
}
+ if (
+ normalizedName === 'registry' &&
+ rcOptions['registry'] &&
+ value === 'https://registry.yarnpkg.com' &&
+ process.env['npm_config_user_agent']?.includes('yarn')
+ ) {
+ // When running `ng update` using yarn (`yarn ng update`), yarn will set the `npm_config_registry` env variable to `https://registry.yarnpkg.com`
+ // even when an RC file is present with a different repository.
+ // This causes the registry specified in the RC to always be overridden with the below logic.
+ continue;
+ }
+
normalizedName = normalizedName.replace(/(?!^)_/g, '-'); // don't replace _ at the start of the key.s
envVariablesOptions[normalizedName] = value;
}
diff --git a/packages/angular_devkit/architect/src/create-builder.ts b/packages/angular_devkit/architect/src/create-builder.ts
index 6aa83bd36cab..8bc03daf1921 100644
--- a/packages/angular_devkit/architect/src/create-builder.ts
+++ b/packages/angular_devkit/architect/src/create-builder.ts
@@ -8,7 +8,7 @@
import { analytics, experimental, json, logging } from '@angular-devkit/core';
import { Observable, Subscription, from, isObservable, of, throwError } from 'rxjs';
-import { mergeMap, tap } from 'rxjs/operators';
+import { defaultIfEmpty, mergeMap, tap } from 'rxjs/operators';
import {
BuilderContext,
BuilderHandlerFn,
@@ -219,6 +219,7 @@ export function createBuilder {
progress({ state: BuilderProgressState.Running, current: total }, context);
progress({ state: BuilderProgressState.Stopped }, context);
diff --git a/packages/angular_devkit/build_angular/BUILD.bazel b/packages/angular_devkit/build_angular/BUILD.bazel
index 4e3af36fcb55..4e412fd0251c 100644
--- a/packages/angular_devkit/build_angular/BUILD.bazel
+++ b/packages/angular_devkit/build_angular/BUILD.bazel
@@ -106,6 +106,7 @@ ts_library(
"@npm//@angular/compiler-cli",
"@npm//@angular/core",
"@npm//@angular/localize",
+ "@npm//@angular/platform-server",
"@npm//@angular/service-worker",
"@npm//@babel/core",
"@npm//@babel/generator",
diff --git a/packages/angular_devkit/build_angular/package.json b/packages/angular_devkit/build_angular/package.json
index dd78c668e02a..8faa3369da54 100644
--- a/packages/angular_devkit/build_angular/package.json
+++ b/packages/angular_devkit/build_angular/package.json
@@ -38,7 +38,7 @@
"less": "4.1.3",
"less-loader": "11.0.0",
"license-webpack-plugin": "4.0.2",
- "loader-utils": "3.2.0",
+ "loader-utils": "3.2.1",
"mini-css-extract-plugin": "2.6.1",
"minimatch": "5.1.0",
"open": "8.4.0",
@@ -63,7 +63,7 @@
"text-table": "0.2.0",
"tree-kill": "1.2.2",
"tslib": "2.4.0",
- "webpack": "5.74.0",
+ "webpack": "5.76.1",
"webpack-dev-middleware": "5.3.3",
"webpack-dev-server": "4.11.0",
"webpack-merge": "5.8.0",
diff --git a/packages/angular_devkit/build_angular/src/builders/app-shell/index.ts b/packages/angular_devkit/build_angular/src/builders/app-shell/index.ts
index 37b1c7cb29e5..208c3d5c611d 100644
--- a/packages/angular_devkit/build_angular/src/builders/app-shell/index.ts
+++ b/packages/angular_devkit/build_angular/src/builders/app-shell/index.ts
@@ -15,6 +15,7 @@ import {
import { JsonObject } from '@angular-devkit/core';
import * as fs from 'fs';
import * as path from 'path';
+import Piscina from 'piscina';
import { normalizeOptimization } from '../../utils';
import { assertIsError } from '../../utils/error';
import { InlineCriticalCssProcessor } from '../../utils/index-file/inline-critical-css';
@@ -42,10 +43,9 @@ async function _renderUniversal(
browserBuilderName,
);
- // Initialize zone.js
+ // Locate zone.js to load in the render worker
const root = context.workspaceRoot;
const zonePackage = require.resolve('zone.js', { paths: [root] });
- await import(zonePackage);
const projectName = context.target && context.target.project;
if (!projectName) {
@@ -63,65 +63,63 @@ async function _renderUniversal(
})
: undefined;
- for (const { path: outputPath, baseHref } of browserResult.outputs) {
- const localeDirectory = path.relative(browserResult.baseOutputPath, outputPath);
- const browserIndexOutputPath = path.join(outputPath, 'index.html');
- const indexHtml = await fs.promises.readFile(browserIndexOutputPath, 'utf8');
- const serverBundlePath = await _getServerModuleBundlePath(
- options,
- context,
- serverResult,
- localeDirectory,
- );
-
- const { AppServerModule, renderModule } = await import(serverBundlePath);
-
- const renderModuleFn: ((module: unknown, options: {}) => Promise) | undefined =
- renderModule;
-
- if (!(renderModuleFn && AppServerModule)) {
- throw new Error(
- `renderModule method and/or AppServerModule were not exported from: ${serverBundlePath}.`,
+ const renderWorker = new Piscina({
+ filename: require.resolve('./render-worker'),
+ maxThreads: 1,
+ workerData: { zonePackage },
+ });
+
+ try {
+ for (const { path: outputPath, baseHref } of browserResult.outputs) {
+ const localeDirectory = path.relative(browserResult.baseOutputPath, outputPath);
+ const browserIndexOutputPath = path.join(outputPath, 'index.html');
+ const indexHtml = await fs.promises.readFile(browserIndexOutputPath, 'utf8');
+ const serverBundlePath = await _getServerModuleBundlePath(
+ options,
+ context,
+ serverResult,
+ localeDirectory,
);
- }
- // Load platform server module renderer
- const renderOpts = {
- document: indexHtml,
- url: options.route,
- };
-
- let html = await renderModuleFn(AppServerModule, renderOpts);
- // Overwrite the client index file.
- const outputIndexPath = options.outputIndexPath
- ? path.join(root, options.outputIndexPath)
- : browserIndexOutputPath;
-
- if (inlineCriticalCssProcessor) {
- const { content, warnings, errors } = await inlineCriticalCssProcessor.process(html, {
- outputPath,
+ let html: string = await renderWorker.run({
+ serverBundlePath,
+ document: indexHtml,
+ url: options.route,
});
- html = content;
- if (warnings.length || errors.length) {
- spinner.stop();
- warnings.forEach((m) => context.logger.warn(m));
- errors.forEach((m) => context.logger.error(m));
- spinner.start();
+ // Overwrite the client index file.
+ const outputIndexPath = options.outputIndexPath
+ ? path.join(root, options.outputIndexPath)
+ : browserIndexOutputPath;
+
+ if (inlineCriticalCssProcessor) {
+ const { content, warnings, errors } = await inlineCriticalCssProcessor.process(html, {
+ outputPath,
+ });
+ html = content;
+
+ if (warnings.length || errors.length) {
+ spinner.stop();
+ warnings.forEach((m) => context.logger.warn(m));
+ errors.forEach((m) => context.logger.error(m));
+ spinner.start();
+ }
}
- }
- await fs.promises.writeFile(outputIndexPath, html);
+ await fs.promises.writeFile(outputIndexPath, html);
- if (browserOptions.serviceWorker) {
- await augmentAppWithServiceWorker(
- projectRoot,
- root,
- outputPath,
- baseHref ?? '/',
- browserOptions.ngswConfigPath,
- );
+ if (browserOptions.serviceWorker) {
+ await augmentAppWithServiceWorker(
+ projectRoot,
+ root,
+ outputPath,
+ baseHref ?? '/',
+ browserOptions.ngswConfigPath,
+ );
+ }
}
+ } finally {
+ await renderWorker.destroy();
}
return browserResult;
diff --git a/packages/angular_devkit/build_angular/src/builders/app-shell/render-worker.ts b/packages/angular_devkit/build_angular/src/builders/app-shell/render-worker.ts
new file mode 100644
index 000000000000..e68fa92874ea
--- /dev/null
+++ b/packages/angular_devkit/build_angular/src/builders/app-shell/render-worker.ts
@@ -0,0 +1,81 @@
+/**
+ * @license
+ * Copyright Google LLC All Rights Reserved.
+ *
+ * Use of this source code is governed by an MIT-style license that can be
+ * found in the LICENSE file at https://angular.io/license
+ */
+
+import type { Type } from '@angular/core';
+import type * as platformServer from '@angular/platform-server';
+import assert from 'assert';
+import { workerData } from 'worker_threads';
+
+/**
+ * The fully resolved path to the zone.js package that will be loaded during worker initialization.
+ * This is passed as workerData when setting up the worker via the `piscina` package.
+ */
+const { zonePackage } = workerData as {
+ zonePackage: string;
+};
+
+/**
+ * A request to render a Server bundle generate by the universal server builder.
+ */
+interface RenderRequest {
+ /**
+ * The path to the server bundle that should be loaded and rendered.
+ */
+ serverBundlePath: string;
+ /**
+ * The existing HTML document as a string that will be augmented with the rendered application.
+ */
+ document: string;
+ /**
+ * An optional URL path that represents the Angular route that should be rendered.
+ */
+ url: string | undefined;
+}
+
+/**
+ * Renders an application based on a provided server bundle path, initial document, and optional URL route.
+ * @param param0 A request to render a server bundle.
+ * @returns A promise that resolves to the render HTML document for the application.
+ */
+async function render({ serverBundlePath, document, url }: RenderRequest): Promise {
+ const { AppServerModule, renderModule } = (await import(serverBundlePath)) as {
+ renderModule: typeof platformServer.renderModule | undefined;
+ AppServerModule: Type | undefined;
+ };
+
+ assert(renderModule, `renderModule was not exported from: ${serverBundlePath}.`);
+ assert(AppServerModule, `AppServerModule was not exported from: ${serverBundlePath}.`);
+
+ // Render platform server module
+ const html = await renderModule(AppServerModule, {
+ document,
+ url,
+ });
+
+ return html;
+}
+
+/**
+ * Initializes the worker when it is first created by loading the Zone.js package
+ * into the worker instance.
+ *
+ * @returns A promise resolving to the render function of the worker.
+ */
+async function initialize() {
+ // Setup Zone.js
+ await import(zonePackage);
+
+ // Return the render function for use
+ return render;
+}
+
+/**
+ * The default export will be the promise returned by the initialize function.
+ * This is awaited by piscina prior to using the Worker.
+ */
+export default initialize();
diff --git a/packages/angular_devkit/build_webpack/package.json b/packages/angular_devkit/build_webpack/package.json
index cf5d07bee2dd..3e7ae03cbc49 100644
--- a/packages/angular_devkit/build_webpack/package.json
+++ b/packages/angular_devkit/build_webpack/package.json
@@ -13,7 +13,7 @@
"devDependencies": {
"@angular-devkit/core": "0.0.0-PLACEHOLDER",
"node-fetch": "2.6.7",
- "webpack": "5.74.0"
+ "webpack": "5.76.1"
},
"peerDependencies": {
"webpack": "^5.30.0",
diff --git a/packages/ngtools/webpack/package.json b/packages/ngtools/webpack/package.json
index cca17e02995a..d6e21e5be3ad 100644
--- a/packages/ngtools/webpack/package.json
+++ b/packages/ngtools/webpack/package.json
@@ -31,6 +31,6 @@
"@angular/compiler": "14.1.2",
"@angular/compiler-cli": "14.1.2",
"typescript": "4.8.1-rc",
- "webpack": "5.74.0"
+ "webpack": "5.76.1"
}
}
diff --git a/packages/schematics/angular/guard/files/__name@dasherize__.guard.ts.template b/packages/schematics/angular/guard/files/__name@dasherize__.guard.ts.template
index 3dc36a017893..8d83bc7498b4 100644
--- a/packages/schematics/angular/guard/files/__name@dasherize__.guard.ts.template
+++ b/packages/schematics/angular/guard/files/__name@dasherize__.guard.ts.template
@@ -23,7 +23,11 @@ export class <%= classify(name) %>Guard implements <%= implementations %> {
nextState?: RouterStateSnapshot): Observable | Promise | boolean | UrlTree {
return true;
}
- <% } %><% if (implements.includes('CanLoad')) { %>canLoad(
+ <% } %><% if (implements.includes('CanMatch')) { %>canMatch(
+ route: Route,
+ segments: UrlSegment[]): Observable | Promise | boolean | UrlTree {
+ return true;
+ }<% } %><% if (implements.includes('CanLoad')) { %>canLoad(
route: Route,
segments: UrlSegment[]): Observable | Promise | boolean | UrlTree {
return true;
diff --git a/packages/schematics/angular/guard/index.ts b/packages/schematics/angular/guard/index.ts
index f8a35b9947bf..efb377216684 100644
--- a/packages/schematics/angular/guard/index.ts
+++ b/packages/schematics/angular/guard/index.ts
@@ -21,7 +21,10 @@ export default function (options: GuardOptions): Rule {
const commonRouterNameImports = ['ActivatedRouteSnapshot', 'RouterStateSnapshot'];
const routerNamedImports: string[] = [...options.implements, 'UrlTree'];
- if (options.implements.includes(GuardInterface.CanLoad)) {
+ if (
+ options.implements.includes(GuardInterface.CanLoad) ||
+ options.implements.includes(GuardInterface.CanMatch)
+ ) {
routerNamedImports.push('Route', 'UrlSegment');
if (options.implements.length > 1) {
diff --git a/packages/schematics/angular/guard/index_spec.ts b/packages/schematics/angular/guard/index_spec.ts
index eba8e654982b..45326eba1862 100644
--- a/packages/schematics/angular/guard/index_spec.ts
+++ b/packages/schematics/angular/guard/index_spec.ts
@@ -126,6 +126,16 @@ describe('Guard Schematic', () => {
expect(fileString).toContain(expectedImports);
});
+ it('should add correct imports based on CanMatch implementation', async () => {
+ const implementationOptions = ['CanMatch'];
+ const options = { ...defaultOptions, implements: implementationOptions };
+ const tree = await schematicRunner.runSchematicAsync('guard', options, appTree).toPromise();
+ const fileString = tree.readContent('/projects/bar/src/app/foo.guard.ts');
+ const expectedImports = `import { CanMatch, Route, UrlSegment, UrlTree } from '@angular/router';`;
+
+ expect(fileString).toContain(expectedImports);
+ });
+
it('should add correct imports based on CanActivate implementation', async () => {
const implementationOptions = ['CanActivate'];
const options = { ...defaultOptions, implements: implementationOptions };
diff --git a/packages/schematics/angular/guard/schema.json b/packages/schematics/angular/guard/schema.json
index f66bdc9428cc..fda5ea7a43a2 100644
--- a/packages/schematics/angular/guard/schema.json
+++ b/packages/schematics/angular/guard/schema.json
@@ -48,7 +48,7 @@
"uniqueItems": true,
"minItems": 1,
"items": {
- "enum": ["CanActivate", "CanActivateChild", "CanDeactivate", "CanLoad"],
+ "enum": ["CanActivate", "CanActivateChild", "CanDeactivate", "CanLoad", "CanMatch"],
"type": "string"
},
"default": ["CanActivate"],
diff --git a/tests/legacy-cli/e2e/tests/commands/add/version-specifier.ts b/tests/legacy-cli/e2e/tests/commands/add/version-specifier.ts
index 426f8d5b61e5..5b598ccc9cfb 100644
--- a/tests/legacy-cli/e2e/tests/commands/add/version-specifier.ts
+++ b/tests/legacy-cli/e2e/tests/commands/add/version-specifier.ts
@@ -25,11 +25,6 @@ export default async function () {
throw new Error('Installation was not skipped');
}
- const output2 = await ng('add', '@angular/localize@latest', '--skip-confirmation');
- if (output2.stdout.includes('Skipping installation: Package already installed')) {
- throw new Error('Installation should not have been skipped');
- }
-
// v12.2.0 has a package.json engine field that supports Node.js v16+
const output3 = await ng('add', '@angular/localize@12.2.0', '--skip-confirmation');
if (output3.stdout.includes('Skipping installation: Package already installed')) {
diff --git a/tests/legacy-cli/e2e/tests/misc/npm-7.ts b/tests/legacy-cli/e2e/tests/misc/npm-7.ts
index 31cf1a3ad668..3417766b329b 100644
--- a/tests/legacy-cli/e2e/tests/misc/npm-7.ts
+++ b/tests/legacy-cli/e2e/tests/misc/npm-7.ts
@@ -45,8 +45,8 @@ export default async function () {
}
try {
- // Install version >=7.5.6
- await npm('install', '--global', 'npm@>=7.5.6');
+ // Install version ^7.5.6
+ await npm('install', '--global', 'npm@^7.5.6');
// Ensure `ng update` does not show npm warning
const { stderr: stderrUpdate1 } = await ng('update', ...extraArgs);
diff --git a/tests/legacy-cli/e2e/tests/update/update-secure-registry.ts b/tests/legacy-cli/e2e/tests/update/update-secure-registry.ts
index 18ab56859984..9d0d89d531c5 100644
--- a/tests/legacy-cli/e2e/tests/update/update-secure-registry.ts
+++ b/tests/legacy-cli/e2e/tests/update/update-secure-registry.ts
@@ -1,7 +1,8 @@
-import { ng } from '../../utils/process';
+import { exec, ng } from '../../utils/process';
import { createNpmConfigForAuthentication } from '../../utils/registry';
import { expectToFail } from '../../utils/utils';
import { isPrereleaseCli } from '../../utils/project';
+import { getActivePackageManager } from '../../utils/packages';
export default async function () {
// The environment variable has priority over the .npmrc
@@ -32,4 +33,15 @@ export default async function () {
await createNpmConfigForAuthentication(true, true);
await expectToFail(() => ng('update', ...extraArgs));
+
+ if (getActivePackageManager() === 'yarn') {
+ // When running `ng update` using yarn (`yarn ng update`), yarn will set the `npm_config_registry` env variable to `https://registry.yarnpkg.com`
+ // Validate the the registry in the RC is used.
+ await createNpmConfigForAuthentication(true, true);
+
+ const error = await expectToFail(() => exec('yarn', 'ng', 'update', ...extraArgs));
+ if (!/not allowed to access package/.test(error.message)) {
+ throw new Error('Error did not match not allowed to access package.');
+ }
+ }
}
diff --git a/yarn.lock b/yarn.lock
index 5570f36cabd7..122ef4f4af5b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7317,6 +7317,11 @@ loader-utils@3.2.0:
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-3.2.0.tgz#bcecc51a7898bee7473d4bc6b845b23af8304d4f"
integrity sha512-HVl9ZqccQihZ7JM85dco1MvO9G+ONvxoGa9rkhzFsneGLKSUg1gJf9bWzhRhcvm2qChhWpebQhP44qxjKIUCaQ==
+loader-utils@3.2.1:
+ version "3.2.1"
+ resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-3.2.1.tgz#4fb104b599daafd82ef3e1a41fb9265f87e1f576"
+ integrity sha512-ZvFw1KWS3GVyYBYb7qkmRM/WwL2TQQBxgCK62rlvm4WpVQ23Nb4tYjApUlfjrEGvOs7KHEsmyUn75OHZrJMWPw==
+
loader-utils@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.2.tgz#d6e3b4fb81870721ae4e0868ab11dd638368c129"
@@ -11415,6 +11420,36 @@ webpack@5.74.0:
watchpack "^2.4.0"
webpack-sources "^3.2.3"
+webpack@5.76.1:
+ version "5.76.1"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.76.1.tgz#7773de017e988bccb0f13c7d75ec245f377d295c"
+ integrity sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==
+ dependencies:
+ "@types/eslint-scope" "^3.7.3"
+ "@types/estree" "^0.0.51"
+ "@webassemblyjs/ast" "1.11.1"
+ "@webassemblyjs/wasm-edit" "1.11.1"
+ "@webassemblyjs/wasm-parser" "1.11.1"
+ acorn "^8.7.1"
+ acorn-import-assertions "^1.7.6"
+ browserslist "^4.14.5"
+ chrome-trace-event "^1.0.2"
+ enhanced-resolve "^5.10.0"
+ es-module-lexer "^0.9.0"
+ eslint-scope "5.1.1"
+ events "^3.2.0"
+ glob-to-regexp "^0.4.1"
+ graceful-fs "^4.2.9"
+ json-parse-even-better-errors "^2.3.1"
+ loader-runner "^4.2.0"
+ mime-types "^2.1.27"
+ neo-async "^2.6.2"
+ schema-utils "^3.1.0"
+ tapable "^2.1.1"
+ terser-webpack-plugin "^5.1.3"
+ watchpack "^2.4.0"
+ webpack-sources "^3.2.3"
+
websocket-driver@>=0.5.1, websocket-driver@^0.7.4:
version "0.7.4"
resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.4.tgz#89ad5295bbf64b480abcba31e4953aca706f5760"