<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hamza EL GHAZOUANI on Medium]]></title>
        <description><![CDATA[Stories by Hamza EL GHAZOUANI on Medium]]></description>
        <link>https://medium.com/@elghazouani.hamza1?source=rss-5e064d2a60ca------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-y6uscbxX3D_1boRYfoMdA.jpeg</url>
            <title>Stories by Hamza EL GHAZOUANI on Medium</title>
            <link>https://medium.com/@elghazouani.hamza1?source=rss-5e064d2a60ca------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 12:12:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@elghazouani.hamza1/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Deprecation to Domination: How I Migrated 42k Lines of Angular Without Losing My Mind]]></title>
            <link>https://medium.com/@elghazouani.hamza1/deprecation-to-domination-how-i-migrated-42k-lines-of-angular-without-losing-my-mind-90b65f03ca9d?source=rss-5e064d2a60ca------2</link>
            <guid isPermaLink="false">https://medium.com/p/90b65f03ca9d</guid>
            <category><![CDATA[angular-material]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[monorepo]]></category>
            <category><![CDATA[nx]]></category>
            <dc:creator><![CDATA[Hamza EL GHAZOUANI]]></dc:creator>
            <pubDate>Mon, 18 Aug 2025 17:17:33 GMT</pubDate>
            <atom:updated>2025-08-18T18:38:51.767Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*tpDRxzivAEsQfx4Y.jpg" /></figure><p>The day I decided to migrate, my terminal lit up with warning lights: <strong>23 critical vulns</strong>, build logs longer than my grocery list, and a dev server that needed a coffee break after every save. Our Angular monorepo (900+ files) felt like an old city beautiful, historic, and full of one‑way streets.</p><p>I didn’t want a hero sprint. I wanted a <strong>map</strong>.</p><p>So, I designed a <strong>linear migration</strong>: one lane, one milestone at a time. Each step unlocked a small feat faster build, safer deps, cleaner components until we reached <strong>Angular 20</strong> without burning weekends.</p><p>If you’re a junior dev, here’s the version I wish someone handed me: <strong>ideas first, commands second</strong>, with memes to keep you smiling when CI doesn’t.</p><h3><strong>You’ll leave with</strong></h3><ul><li>A mental model to control scope and risk.</li><li>A linear roadmap of <strong>14 feats</strong> from v12‑ish foundations to Angular 20.</li><li>Commands, explainers, and resources for each feat.</li><li>Field notes and quick <em>advice </em>callouts you can copy into your backlog.</li></ul><h3>TL; DR</h3><ul><li>Migrated a large Angular monorepo from legacy to <strong>Angular 20</strong>.</li><li>Moved from Webpack to <strong>Vite</strong> with Nx, adopted <strong>Tailwind CSS</strong>, upgraded <strong>ESLint</strong>, and replaced deprecated <strong>Iconify</strong> icons with <strong>Angular Material</strong>.</li><li>Converted <strong>NgModules </strong>→ <strong>standalone </strong>components.</li><li>Fixed vulnerabilities, cut dev build time drastically, and made hot reload feel instant.</li></ul><h3>Concepts &amp; Mental Models (read this first)</h3><p>A migration is not a code sprint. It’s a <strong>change management</strong> project. These ideas kept me sane.</p><ul><li><strong>Compatibility Ladder</strong>: climb versions step‑by‑step (15 → 16 → 17 → 18 → 20) instead of cliff‑jumping. Each rung must boot the app.</li><li><strong>Seams &amp; Adapters</strong>: create small wrappers (icons, layout, Excel) so you can swap internals without touching every component.</li><li><strong>Blast Radius &amp; Risk Budget</strong>: one major risk per PR. If you switch build tools, don’t also redesign the navbar.</li><li><strong>Golden Path</strong>: decide the three things that must always work (dev server boots, main route renders, auth flow ok). Guard them with a smoke test.</li><li><strong>Migration Rings</strong>: platform (TypeScript/Angular/Nx), build system (Vite), cross‑cutting UI libs (Material/Tailwind), app features, perf polish.</li><li><strong>Strangler‑Fig UI</strong>: route‑by‑route replacement: add the new thing next to the old thing, then slowly cut the old.</li><li><strong>Observe or it didn’t happen</strong>: measure build time, HMR latency, and bundle size after every rung.</li></ul><h3>My Backstory (Why I Usually Avoid Libraries)</h3><p>I love building UI from scratch vanilla TS/SCSS, custom kits, zero bloat. It’s fast and fits the use case perfectly. But in a team with deadlines, <strong>time = money</strong>. Custom everything doesn’t scale. This migration taught me where to be pragmatic and where to be picky.</p><h3>The Story four breakthroughs</h3><ol><li><strong>The icon cliff that didn’t kill us.</strong> I ripped out Iconify and everything exploded. A tiny adapter saved the day: one `&lt;app-icon name=&quot;...&quot;&gt;` wrapper that mapped old names to Material icons. Replace calls one by one, keep shipping.</li><li><strong>The day hot‑reload felt instant</strong>. First run on Vite and the page refreshed before I found my coffee. That single win changed team morale and review velocity.</li><li>The Tailwind tidy‑up. We deleted hundreds of lines of home‑grown layout CSS and replaced it with a consistent spacing scale and tokens. Fewer fights in code review.</li><li><strong>Goodbye, NgModule maze.</strong> Converting to standalone components simplified routing and made lazy‑loading obvious. The day we deleted the last NgModule felt like spring cleaning.</li></ol><h3>The Battlefield: What I Started With</h3><ul><li><strong>Monorepo</strong> with Nx, Angular v15 range (legacy parts), 900+ files.</li><li>Deprecated internal UI library, old layout utilities, lots of transitive deps.</li><li>Security issues in some packages.</li></ul><h3>Risks I wrote down</h3><ul><li>Breakage from big Angular jumps.</li><li>Icon library incompatibilities.</li><li>Build tooling churn (Webpack → Vite).</li><li>NgModule spaghetti.</li></ul><h3>Roadmap: the 14 Feats (Linear Migration)</h3><p>Below is the single lane I drove in. For every feat you’ll see <strong>Why it matters</strong>, <strong>Key commands</strong>, <strong>Resources</strong>, and an <strong>Advice note</strong> you can paste into your planning doc.</p><blockquote>Tip: Keep the app bootable after each feat. Ship small PRs. Measure.</blockquote><p><strong>Feat 1: Baseline &amp; Cleanup</strong></p><p><strong>Why</strong>: Reduce noise before upgrades; remove auth/libs you won’t carry forward; pin TS/Zone for the next hop.</p><pre>npm uninstall @aws-amplify/auth @aws-amplify/core<br>npm i -D typescript@~4.9.0 zone.js@^0.13.3</pre><p><strong>Resources</strong>: Angular Update Guide (<a href="https://angular.dev/update-guide">update angular</a>).</p><blockquote><strong>Advice:</strong> Make a <strong>removed deps</strong> list with owners and replacements to avoid surprises.</blockquote><p><strong>Feat 2: Hop to Angular 16</strong></p><p><strong>Why</strong>: Unlocks modern builders and compatibility for later steps.</p><pre>npm run migrate 16<br>npm migrate @angular/core@16 @angular/material@16<br>npm i @ng-bootstrap/ng-bootstrap@15.1.2 primeng@16.9.1</pre><p><strong>Resources</strong>: <a href="https://blog.angular.dev/angular-v16-is-here-4d7a28ec680d">Angular 16 migration</a>.</p><p><strong>Advice</strong>: After the hop, run a <strong>smoke test</strong> route and update CI Node version if needed.</p><p><strong>Feat 3: Iconify → Angular Material Icons</strong></p><pre>npm uninstall @iconify/icons-emojione @iconify/icons-fa-solid @iconify/icons-ic @iconify/icons-logos @visurel/iconify-angular</pre><p>Resources: Angular Material `<em>MatIcon</em>` <a href="https://v7.material.angular.dev/components/icon/overview">docs</a>.</p><blockquote>Advice: Create an `&lt;app-icon&gt;` adapter so old names map to new ones; swap calls incrementally.</blockquote><p><strong>Feat 4: Flex‑Layout/ng‑bootstrap → Tailwind CSS</strong></p><pre>npm uninstall @angular/flex-layout @ng-bootstrap/ng-bootstrap<br>npm i -D tailwindcss@^3 postcss@^8 autoprefixer@^10<br>npx tailwindcss init -p</pre><p><strong>Resources</strong>: Tailwind <a href="https://v3.tailwindcss.com/docs/installation">docs</a>.</p><blockquote><strong>Advice</strong>: Define a <strong>spacing/typography </strong>scale and purge config early to avoid bloat.</blockquote><p><strong>Feat 5: ESLint Alignment</strong></p><p><strong>Why</strong>: Ensure lints actually run and match your TS/Angular versions.</p><pre>npm i -D eslint @typescript-eslint/eslint-plugin @eslint/eslintrc</pre><blockquote><strong>Advice</strong>: Start with a <strong>minimal ruleset</strong> focused on imports, unused vars, and template linting; expand later.</blockquote><p><strong>Feat 6: Hop to Angular 17</strong></p><p><strong>Why</strong>: Prepares the ground for control‑flow improvements and future compatibility.</p><pre>npm run migrate 17<br>npm migrate @angular/core@17 @angular/material@17</pre><p><strong>Resources</strong>: <a href="https://blog.angular.dev/introducing-angular-v17-4d7033312e4b">Angular 17 release</a>, new <strong>control flow</strong>.</p><blockquote><strong>Advice: </strong>Remove legacy polyfills; verify `zone.js`/TS versions are compatible.</blockquote><p><strong>Feat 7: Sass Tooling &amp; Material Version Sync</strong></p><p><strong>Why</strong>: Align Material versions and enable theming/codemods.</p><pre>npm i -D sass sass-loader sass-migrator</pre><p><strong>Resources</strong>: <a href="https://sass-lang.com/guide">Sass docs</a>.</p><blockquote><strong>Advice</strong>: Introduce <strong>design tokens</strong> now; don’t let colors live inline.</blockquote><p><strong>Feat 8: Material v2 → v3 (M3) Syntax</strong></p><p><strong>Why</strong>: Future‑proof UI and prepare for updated components.</p><ul><li>Update templates to M3 APIs; keep temporary shims where needed.</li><li><strong>Resources</strong>: <a href="https://v17.material.angular.dev/guide/material-3">Angular Material M3 docs</a>.</li></ul><blockquote><strong>Advice</strong>: Convert <strong>one feature route at a time</strong>; keep a regression checklist for density/contrast.</blockquote><p><strong>Feat 9: Build System: Webpack → Vite (via Nx)</strong></p><pre>npm i -D @nx/vite@latest<br># switch project targets to vite executor in project.json</pre><ul><li><strong>Resources</strong>: Nx Vite executor docs.</li></ul><blockquote><strong>Advice</strong>: <strong>Pin TypeScript</strong> for this step; test env vars and asset handling before merging.</blockquote><p><strong>Feat 10: Angular 18 + Nx 19</strong></p><p><strong>Why</strong>: Keep framework and monorepo tooling in lockstep.</p><ul><li>Bump `@nx/angular`, `@nx/cypress`, `@nx/workspace`, etc.</li><li><strong>Resources</strong>: <a href="https://blog.angular.dev/angular-v18-is-now-available-e79d5ac0affe">Angular 18 notes</a>; <a href="https://nx.dev/recipes/adopting-nx/manual">Nx migration guide</a>.</li></ul><blockquote><strong>Advice</strong>: Remove dead npm scripts and stale generators to shorten CI logs.</blockquote><p><strong>Feat 11: Workspace Migration `@nrwl/*` → `@nx/*`</strong></p><p><strong>Why</strong>: Modern namespace, clearer executors, easier future upgrades.</p><ul><li>Update package names and builder references.</li><li><strong>Resources</strong>: <a href="https://nx.dev/technologies/angular/migration/angular">Nx workspace migration docs</a>.</li></ul><blockquote><strong>Advice</strong>: Run the repo‑wide import rewrite with a codemod; keep one PR just for renames.</blockquote><p><strong>Feat 12: Standalone Components Everywhere</strong></p><ul><li>Convert NgModules → `standalone: true` components; update routes to lazy‑load components directly.</li></ul><blockquote>Advice: Add a <strong>lint rule</strong> that forbids new NgModules unless justified.</blockquote><p><strong>Feat 13: Angular 20 + Build Updates</strong></p><p><strong>Why</strong>: Latest performance improvements, security, and features.</p><ul><li>Upgrade core to v20</li><li>add `@angular/build` where needed</li><li>make sure TS ≥ 5.8</li><li><strong>Resources</strong>: Angular 20 update guide, `@angular/build` docs.</li></ul><blockquote><strong>Advice</strong>: Re‑measure your <strong>golden path</strong> and capture a new baseline chart.</blockquote><p><strong>Feat 14: xlsx → ExcelJS</strong></p><p><strong>Why</strong>: Better large‑file performance and richer styling.</p><pre>npm uninstall xlsx<br>npm i exceljs</pre><p><strong>Advice</strong>: Create a <strong>service</strong> that wraps Excel operations, so future swaps don’t touch components.</p><h3>Before / After (What Changed for Real)</h3><ul><li><strong>Build speed</strong>: cold dev builds went from coffee‑break to snack‑break.</li><li><strong>Hot reload:</strong> instant with Vite.</li><li><strong>Runtime</strong>: smoother thanks to newer Angular control flow.</li><li><strong>Security</strong>: critical vulns eliminated by removing/patching old deps.</li><li><strong>DX</strong>: Tailwind + standalone components simplified daily work.</li></ul><h3>Mistakes I Made (So You Don’t Have To)</h3><ul><li><strong>Changing too much at once</strong>. Bundle refactors with icon swaps. Chaos. Ship in small PRs.</li><li><strong>Not freezing TypeScript</strong> during a tooling hop. Pin your TS version for each big step.</li><li><strong>Assuming old CSS utilities still work</strong>. Tailwind needs a real purge/config pass; audit your class names.</li><li><strong>Skipping design tokens</strong>. When moving to Material M3, define tokens early.</li></ul><h3>Practical Do/Don’t (Copy/Paste This)</h3><h4><strong>Do:</strong></h4><ul><li>Create a <em>migration board</em> (per‑feature or per‑library) and close tasks weekly.</li><li>Keep the app booting after <em>every</em> step.</li><li>Write a codemod for repetitive imports when moving to standalone.</li><li>Add ESLint rules for standalone: true patterns and lazy routes.</li></ul><h4><strong>Don’t</strong></h4><ul><li>Upgrade Angular + switch build system + redesign UI in one PR.</li><li>Leave deprecated icon packages in your lockfile.</li></ul><h3>Command Grab‑Bag</h3><pre># Angular hops<br>npm migrate 16<br>npm migrate @angular/core@17 @angular/material@17</pre><pre># Tailwind stack<br>npm i -D tailwindcss postcss autoprefixer</pre><pre># Icon cleanup<br>npm uninstall @iconify/icons-emojione @iconify/icons-fa-solid @iconify/icons-ic @iconify/icons-logos @visurel/iconify-angular</pre><pre># Excel switch<br>npm uninstall xlsx &amp;&amp; npm i exceljs@^4</pre><h3>What I’d Do Differently Next Time</h3><ul><li>Start with <strong>standalone + routing</strong> conversion sooner.</li><li>Add a <strong>design tokens</strong> layer before touching Material themes.</li></ul><h3>Final Advice for Juniors</h3><ol><li><strong>Break the migration into chapters:</strong> Treat each as a mini‑release.</li><li><strong>Keep the app running:</strong> Feature flags and “compat” wrappers are your friends.</li><li><strong>Measure real things</strong> (build time, TTI, route FPS), not vibes.</li><li><strong>Document every bump</strong> so future‑you (or your teammate) can jump back in fast.</li></ol><p>You’ve got this. Deprecations don’t have to dominate your roadmap <em>you</em> can dominate them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90b65f03ca9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>