From bda4753468c44c280ef62714c443961b3ef14ad4 Mon Sep 17 00:00:00 2001 From: Eshaan Gupta <146680427+Eshaan-byte@users.noreply.github.com> Date: Wed, 17 Dec 2025 05:59:41 +1100 Subject: [PATCH] Task/remove deprecated Angular CLI decorator (#6071) * Remove deprecated Angular CLI decorator * Update changelog --- CHANGELOG.md | 1 + Dockerfile | 4 --- decorate-angular-cli.js | 79 ----------------------------------------- 3 files changed, 1 insertion(+), 83 deletions(-) delete mode 100644 decorate-angular-cli.js diff --git a/CHANGELOG.md b/CHANGELOG.md index c0970b888..e5e803c65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Removed the deprecated _Angular CLI_ decorator (`decorate-angular-cli.js`) - Refreshed the cryptocurrencies list ## 2.223.0 - 2025-12-14 diff --git a/Dockerfile b/Dockerfile index 5beaf6e03..e73cd73e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,10 +22,6 @@ COPY ./prisma/schema.prisma prisma/ RUN npm install -# See https://github.com/nrwl/nx/issues/6586 for further details -COPY ./decorate-angular-cli.js decorate-angular-cli.js -RUN node decorate-angular-cli.js - COPY ./apps apps/ COPY ./libs libs/ COPY ./jest.config.ts jest.config.ts diff --git a/decorate-angular-cli.js b/decorate-angular-cli.js deleted file mode 100644 index d188492ea..000000000 --- a/decorate-angular-cli.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * This file decorates the Angular CLI with the Nx CLI to enable features such as computation caching - * and faster execution of tasks. - * - * It does this by: - * - * - Patching the Angular CLI to warn you in case you accidentally use the undecorated ng command. - * - Symlinking the ng to nx command, so all commands run through the Nx CLI - * - Updating the package.json postinstall script to give you control over this script - * - * The Nx CLI decorates the Angular CLI, so the Nx CLI is fully compatible with it. - * Every command you run should work the same when using the Nx CLI, except faster. - * - * Because of symlinking you can still type `ng build/test/lint` in the terminal. The ng command, in this case, - * will point to nx, which will perform optimizations before invoking ng. So the Angular CLI is always invoked. - * The Nx CLI simply does some optimizations before invoking the Angular CLI. - * - * To opt out of this patch: - * - Replace occurrences of nx with ng in your package.json - * - Remove the script from your postinstall script in your package.json - * - Delete and reinstall your node_modules - */ - -const fs = require('fs'); -const os = require('os'); -const cp = require('child_process'); -const isWindows = os.platform() === 'win32'; -let output; -try { - output = require('@nx/workspace').output; -} catch (e) { - console.warn( - 'Angular CLI could not be decorated to enable computation caching. Please ensure @nx/workspace is installed.' - ); - process.exit(0); -} - -/** - * Symlink of ng to nx, so you can keep using `ng build/test/lint` and still - * invoke the Nx CLI and get the benefits of computation caching. - */ -function symlinkNgCLItoNxCLI() { - try { - const ngPath = './node_modules/.bin/ng'; - const nxPath = './node_modules/.bin/nx'; - if (isWindows) { - /** - * This is the most reliable way to create symlink-like behavior on Windows. - * Such that it works in all shells and works with npx. - */ - ['', '.cmd', '.ps1'].forEach((ext) => { - if (fs.existsSync(nxPath + ext)) - fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext)); - }); - } else { - // If unix-based, symlink - cp.execSync(`ln -sf ./nx ${ngPath}`); - } - } catch (e) { - output.error({ - title: - 'Unable to create a symlink from the Angular CLI to the Nx CLI:' + - e.message - }); - throw e; - } -} - -try { - symlinkNgCLItoNxCLI(); - require('@nrwl/cli/lib/decorate-cli').decorateCli(); - output.log({ - title: 'Angular CLI has been decorated to enable computation caching.' - }); -} catch (e) { - output.error({ - title: 'Decoration of the Angular CLI did not complete successfully' - }); -}