Skip to content

Commit

Permalink
doc: update modernization docs - tell how to run automated migration (#…
Browse files Browse the repository at this point in the history
…19977)

Co-authored-by: Matthew <[email protected]>
  • Loading branch information
Platonn and gladius-mtl authored Feb 10, 2025
1 parent 8ce468d commit d06b3eb
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

New Angular 19 apps are configured a bit differently than the Angular 17 apps migrated to v19. This document is a migration guide for modernizing the migrated apps to look as much as possible like the new Angular 19 apps.

# Automatic migration

The Spartacus team provides special schematics that automatically modernize the app to look as much as possible like the new Angular 19 apps.

Please run the following command from your project root directory:

```bash
ng g @spartacus/schematics:modernize-app-migrated-from-2211_32-to-2211_35
```

In case of any issues during the automatic migration, you can always fall back to the manual migration steps below.

# Manual migration

Here are the migration steps in detail:

### `angular.json`

1. In the section `architect > build > options > assets`, please replace 2 string values in the array: `"src/favicon.ico"` and `"src/assets"` with a single object `{ "glob": "**/*", "input": "public" }`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,40 @@ The benefits of using the new Angular configuration format are:
The side-effect consequences of using the new configuration format are:
- For SSR apps: the server-side rendering and prerendering scripts will be executed differently (it will be explained in the last section of this page "[New commands for SSR projects](#new-commands-for-ssr-projects)")


# Automatic migration

The Spartacus team provides special schematics that automatically modernize the app to look as much as possible like the new Angular 17 apps.

Note: the tool was released only in `@spartacus/schematics` v2211.35.0, but you need to run it before fully upgrading your app to this version.
To do this, you'll need to install `@spartacus/[email protected]` in a temporary directory and execute the migration schematic from there.

Please run those commands from your project root directory:

```bash
# 1. Create a temporary sibling directory for the isolated Schematics v2211.35 installation
node -e "require('fs').mkdirSync('../temp-schematics-35')"

# 2. Install schematics in the temporary directory
npm install @spartacus/[email protected] --prefix ../temp-schematics-35

# 3. Execute in your project the schematics from the temporary directory
ng g ../temp-schematics-35/node_modules/@spartacus/schematics:modernize-app-migrated-from-6_8-to-2211_19

# 4. Clean up the temporary directory
node -e "require('fs').rmSync('../temp-schematics-35', { recursive: true, force: true })"
```

In case of any issues during the automatic migration, you can always fall back to the manual migration steps below.

> ⚠️ Warning:
>
> Reminder for SSR apps: from now on the server-side rendering and prerendering scripts will be executed differently (see the last section of this page "[New commands for SSR projects](#new-commands-for-ssr-projects)")
In case of any issues during the automatic migration, you can always fall back to the manual migration steps below.

# Manual migration

Here are the migration steps in detail:

## Migration to the new Angular `application` builder
Expand Down

0 comments on commit d06b3eb

Please sign in to comment.