feat: CXSPA-13564 auto feature toggle migration#21667
Open
StanislavSukhanov wants to merge 13 commits into
Open
feat: CXSPA-13564 auto feature toggle migration#21667StanislavSukhanov wants to merge 13 commits into
StanislavSukhanov wants to merge 13 commits into
Conversation
Add schematic to comment out removed feature toggles during ng update, and wire config:update to automatically insert the migrations.json entry for the current PUBLISHING_VERSION on each release. close: https://jira.tools.sap/browse/CXSPA-13564
Contributor
Merge Checks Failed |
Contributor
Merge Checks Failed |
Contributor
Merge Checks Failed |
spartacus
|
||||||||||||||||||||||||||||
| Project |
spartacus
|
| Branch Review |
feat/CXSPA-13564-auto-feature-toggle-migration
|
| Run status |
|
| Run duration | 04m 33s |
| Commit |
|
| Committer | Stanislav Sukhanov |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
3
|
|
|
0
|
|
|
0
|
|
|
103
|
| View all changes introduced in this branch ↗︎ | |
…ggle-migration' into feat/CXSPA-13564-auto-feature-toggle-migration
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CXSPA-13564 — Auto-add feature toggle migration entry on release
What does this PR do?
Automates two things that previously required manual steps on every Spartacus release:
ng updatemigration — When a customer runsng update @spartacus/schematics, outdated feature toggles in theirprovideFeatureToggles({...})are automatically commented out with a// [REMOVED]marker, preventing TypeScript "does not exist in type" errors after upgrading.Auto-insertion of the
migrations.jsonentry — A newnpm run manage-migrationsscript (invoked fromminor-release.yml) automatically upserts the migration entry for the currentPUBLISHING_VERSIONon every release. No manual edit ofmigrations.jsonneeded.Changes
core-libs/schematics/src/shared/utils/update-feature-toggles.ts(new)The
ng updatemigration logic:FeatureTogglesInterfacefrom the installednode_modules/@spartacus/core/types/spartacus-core.d.tsto get valid toggle namesspartacus-features.module.ts(checks common locations, falls back to tree walk)provideFeatureToggles({...})key not present in the interface, prefixing it with// [REMOVED]provideFeatureToggles({...})blocks in the same filecore-libs/schematics/src/shared/utils/update-feature-toggles_spec.ts(new)Full unit test coverage calling
migrate()directly (no dependency on a committedmigrations.jsonentry):[REMOVED]provideFeatureTogglescallsrc/app/spartacus-features.module.ts)tools/config/manage-migrations.ts(new)Standalone script that keeps
migrations.jsonin sync withPUBLISHING_VERSION:npm run config:check-migrations): fails with a clear message if the entry for the current minor is missing or has the wrong versionnpm run manage-migrations): upserts the entry — creates it if absent, updatesversionin-place if a same-minor entry exists with a different patch/pre-release00-migration-v{major}_{minor}-update-feature-toggles) so patch/pre-release bumps of the same minor update the version rather than creating a duplicate entry.github/workflows/minor-release.yml(updated)Added a dedicated step after
Run Config Update:manage-migrationsruns unconditionally — it handles all cases (create / update / no-op) internally.package.json(updated)Added script:
core-libs/schematics/copy-feature-toggles.js(updated)Minor: switched
require('fs')torequire('node:fs')for explicit Node.js built-in resolution.How the release pipeline uses this
The
migrations.jsonentry is not committed to the feature branch — it is written at release time. Tests callmigrate()directly and do not depend on the entry being present.results of a test run were successful.
https://github.com/SAP/spartacus/pull/21678/changes#diff-df6132f32d2815c36326f633148f7b1ba428c10716422fede6e73a9f16c78dd8