-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migration schematics for 2211.35 to silence sass deprecations i…
…n angular.json (#19970) fixes https://jira.tools.sap/browse/CXSPA-9375 QA steps: - create app with ng17 and spa2211.32 - build and publish libs from this branch to verdaccio - update Angular and spartacus according to this guide (using libs from verdaccio) https://github.com/SAP/spartacus/blob/develop/docs/migration/2211_35/migration.md - verify the warning was presented in terminal during migration : <img width="1333" alt="image" src="https://github.com/user-attachments/assets/bb83de0f-65a0-4724-a7cb-ea38199ffc78" /> - verify in angular.json the warnings are configured to be supressed: <img width="532" alt="image" src="https://github.com/user-attachments/assets/5d1dd7ad-4c69-4a7c-ae1b-87e76643c5c7" /> - run dev server and verify there are no warnings <img width="593" alt="image" src="https://github.com/user-attachments/assets/265f8434-dd0a-42c0-9fe2-a3611fd4decb" />
- Loading branch information
Showing
4 changed files
with
83 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
.../schematics/src/migrations/2211_35/silence-sass-deprecations/silence-sass-deprecations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2025 SAP Spartacus team <spartacus-team@sap.com> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; | ||
import { | ||
getWorkspace, | ||
getDefaultProjectNameFromWorkspace, | ||
createSassSilenceDeprecations, | ||
} from '../../../shared/utils/workspace-utils'; | ||
|
||
export function migrate(): Rule { | ||
return (tree: Tree, context: SchematicContext) => { | ||
const { path, workspace: angularJson } = getWorkspace(tree); | ||
const projectName = getDefaultProjectNameFromWorkspace(tree); | ||
const project = angularJson.projects[projectName]; | ||
const architect = project.architect; | ||
|
||
const buildOptions = architect?.build?.options as any; | ||
const buildStylePreprocessorOptions = buildOptions.stylePreprocessorOptions; | ||
buildOptions.stylePreprocessorOptions = { | ||
...buildStylePreprocessorOptions, | ||
...createSassSilenceDeprecations(context, buildStylePreprocessorOptions), | ||
}; | ||
|
||
const JSON_INDENT = 2; | ||
|
||
tree.overwrite(path, JSON.stringify(angularJson, null, JSON_INDENT)); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters