@atomazing-org/design-system 1.2.9 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +92 -0
- package/README.MD +47 -392
- package/dist/index.d.ts +21 -1000
- package/dist/index.js +37 -118
- package/dist/presets/index.d.ts +26 -7
- package/dist/presets/index.js +339 -2
- package/dist/{typography-Dq0wCojD.d.mts → typography-B-BeIk0v.d.ts} +4 -5
- package/migrations/README.UPDATE.md +41 -0
- package/migrations/docs/migrations/design-system/README.md +100 -0
- package/migrations/docs/migrations/design-system/routes/adopt-existing/AEROCRM-EXAMPLE.md +197 -0
- package/migrations/docs/migrations/design-system/routes/adopt-existing/RUNBOOK.md +194 -0
- package/migrations/docs/migrations/design-system/routes/adopt-existing/migration.spec.json +109 -0
- package/migrations/docs/migrations/design-system/routes/greenfield/RUNBOOK.md +61 -0
- package/migrations/docs/migrations/design-system/routes/greenfield/migration.spec.json +58 -0
- package/migrations/docs/migrations/design-system/routes/mui4-to-latest/RUNBOOK.md +140 -0
- package/migrations/docs/migrations/design-system/routes/mui4-to-latest/migration.spec.json +143 -0
- package/migrations/docs/migrations/design-system/routes/mui4-to-latest/token-map.csv +4 -0
- package/migrations/docs/migrations/design-system/schema/migration.spec.schema.json +63 -0
- package/migrations/docs/migrations/design-system/shared/FOUNDATION.md +39 -0
- package/migrations/docs/migrations/design-system/shared/WORKING-RULES.md +194 -0
- package/migrations/docs/migrations/design-system/shared/acceptance.md +83 -0
- package/migrations/docs/migrations/design-system/shared/common-regressions.md +218 -0
- package/migrations/docs/migrations/design-system/shared/gates.md +71 -0
- package/migrations/docs/migrations/design-system/shared/manual-qa-matrix.md +70 -0
- package/migrations/docs/migrations/design-system/shared/phase-exit-criteria.md +129 -0
- package/migrations/docs/migrations/design-system/shared/phases.md +377 -0
- package/migrations/docs/migrations/design-system/shared/rollback.md +13 -0
- package/migrations/skills/design-system-consumer-agent/SKILL.md +84 -0
- package/migrations/skills/design-system-migration-agent/SKILL.md +158 -0
- package/package.json +40 -17
- package/dist/chunk-OYZ4FCLV.mjs +0 -2
- package/dist/chunk-OYZ4FCLV.mjs.map +0 -1
- package/dist/index.d.mts +0 -1181
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -273
- package/dist/index.mjs.map +0 -1
- package/dist/presets/index.d.mts +0 -17
- package/dist/presets/index.js.map +0 -1
- package/dist/presets/index.mjs +0 -2
- package/dist/presets/index.mjs.map +0 -1
- package/dist/typography-Dq0wCojD.d.ts +0 -121
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../schema/migration.spec.schema.json",
|
|
3
|
+
"id": "adopt-existing",
|
|
4
|
+
"title": "Adopt @atomazing-org/design-system in an existing modern MUI project",
|
|
5
|
+
"detect": {
|
|
6
|
+
"packageJson": {
|
|
7
|
+
"anyDependencies": ["@mui/material"]
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"entryConditions": [
|
|
11
|
+
"the project already uses @mui/material",
|
|
12
|
+
"the migration is normalizing an existing app instead of bootstrapping a new one"
|
|
13
|
+
],
|
|
14
|
+
"exitConditions": [
|
|
15
|
+
"ThemeProviderWrapper is connected at the app root",
|
|
16
|
+
"forbidden token imports and outdated design-system imports are removed",
|
|
17
|
+
"the app boots without browser console startup errors",
|
|
18
|
+
"migration-caused startup warnings are fixed",
|
|
19
|
+
"tests and build are green"
|
|
20
|
+
],
|
|
21
|
+
"steps": [
|
|
22
|
+
{
|
|
23
|
+
"name": "Inventory and baseline",
|
|
24
|
+
"run": ["npm test", "npm run build"],
|
|
25
|
+
"manualReview": [
|
|
26
|
+
"Map current design-system usage, theme entrypoints, local token modules, shared shell code, shared overlays, and protected routes.",
|
|
27
|
+
"Record pre-existing failing checks separately from migration defects.",
|
|
28
|
+
"Split the repo into shared-infrastructure scope and domain migration waves before broad edits begin."
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "Add safety net",
|
|
33
|
+
"manualReview": [
|
|
34
|
+
"Add or tighten smoke coverage for the application shell before broad refactors.",
|
|
35
|
+
"If route guards exist, ensure at least one protected content route can be validated as a real screen.",
|
|
36
|
+
"If shared overlays will be touched, add at least one stable overlay interaction to smoke coverage."
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "Add design-system deps",
|
|
41
|
+
"run": [
|
|
42
|
+
"node migrations/scripts/migrations/design-system/actions/update-package-json.mjs --add @atomazing-org/design-system:<SET_VERSION>"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "Install deps",
|
|
47
|
+
"run": ["npm install"]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "Root theme unification",
|
|
51
|
+
"manualReview": [
|
|
52
|
+
"Connect ThemeProviderWrapper at the application root.",
|
|
53
|
+
"Remove or collapse any competing root ThemeProvider so the design system becomes the single theme source of truth.",
|
|
54
|
+
"Replace outdated or removed design-system root imports with the correct public API or local app abstractions.",
|
|
55
|
+
"Move preset selection into one explicit app-level theme module instead of leaving it scattered across generic constants layers."
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "Runtime boot cleanup",
|
|
60
|
+
"manualReview": [
|
|
61
|
+
"Start the app with the repo's normal dev/start command and open the first route in a real browser.",
|
|
62
|
+
"Fix startup console errors before continuing.",
|
|
63
|
+
"Fix migration-caused startup warnings before continuing, especially duplicate runtime singleton warnings for react, react-dom, @emotion/react, and @emotion/styled.",
|
|
64
|
+
"Remove module-scope code that requires browser APIs, storage, or i18n locale activation.",
|
|
65
|
+
"Move browser event listeners into effects with cleanup instead of render paths or module scope.",
|
|
66
|
+
"If smoke mode disables auth redirect, seed a deterministic role-bearing user so protected routes can render real content."
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "Shared infrastructure stabilization",
|
|
71
|
+
"manualReview": [
|
|
72
|
+
"Stabilize the application shell, route wrappers, and shared layout containers before domain-by-domain work.",
|
|
73
|
+
"Restore dialog, drawer, bottom-sheet, and search-overlay semantics before broad feature cleanup.",
|
|
74
|
+
"Preserve display, grid or flex templates, min-width, min-height, overflow, and scroll behavior when refactoring shell containers.",
|
|
75
|
+
"If shell workspaces, route wrappers, or page roots were touched, verify the main content still fills the available content region and that dashboard or workflow grids did not collapse into partial-width stacks.",
|
|
76
|
+
"Audit compact shared UI such as chart legends, chips, segmented filters, and metric badges for preset drift; replace ad hoc chip-like chrome with neutral MUI composition when needed.",
|
|
77
|
+
"Search for placeholder regressions in shared UI and restore explicit visual contracts before closeout."
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "Token and primitive cleanup",
|
|
82
|
+
"manualReview": [
|
|
83
|
+
"Fill token-gate.config.json for the target project.",
|
|
84
|
+
"Prepare CSV or targeted replacements for legacy tokens and review the diff file by file.",
|
|
85
|
+
"Normalize visible text to Typography with explicit semantic variants.",
|
|
86
|
+
"Remove zero-value wrapper components and zero-value surface wrappers.",
|
|
87
|
+
"Replace palette alpha suffix hacks with alpha() and simplify decorative consumer surface chrome.",
|
|
88
|
+
"If bulk replacements or file rewrites touched localized copy, scan for mojibake or replacement characters and verify non-Latin UI text still renders readable strings."
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "Domain migration waves",
|
|
93
|
+
"manualReview": [
|
|
94
|
+
"Migrate feature areas in waves after shared infrastructure is stable.",
|
|
95
|
+
"Keep each wave small enough to validate independently.",
|
|
96
|
+
"Re-run the relevant smoke or route checks after each wave before moving to the next domain."
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "Quality gates",
|
|
101
|
+
"run": [
|
|
102
|
+
"node migrations/scripts/migrations/design-system/gates/no-hardcoded-tokens.mjs --root src --config migrations/scripts/migrations/design-system/shared/token-gate.config.json",
|
|
103
|
+
"npm run lint",
|
|
104
|
+
"npm test",
|
|
105
|
+
"npm run build"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Route: greenfield
|
|
2
|
+
|
|
3
|
+
Use this route when the target app is new and does not need a legacy theme or
|
|
4
|
+
token migration before adopting `@atomazing-org/design-system`.
|
|
5
|
+
|
|
6
|
+
## Use This Route When
|
|
7
|
+
|
|
8
|
+
- the project is new or lightly scaffolded
|
|
9
|
+
- there is no inherited token layer to normalize
|
|
10
|
+
- there is no legacy MUI v4 migration path to perform first
|
|
11
|
+
|
|
12
|
+
## Target Outcome
|
|
13
|
+
|
|
14
|
+
- `ThemeProviderWrapper` is connected at the app root
|
|
15
|
+
- preset choice lives in one explicit app-level theme module when the app exposes multiple presets
|
|
16
|
+
- theme switching, if added, uses `useThemeSettings()`
|
|
17
|
+
- the app boots cleanly with the new provider wiring
|
|
18
|
+
|
|
19
|
+
Use `../../shared/phases.md` as the canonical step-by-step phase checklist, then
|
|
20
|
+
apply the route-specific requirements below.
|
|
21
|
+
|
|
22
|
+
## Required Workflow (Phases)
|
|
23
|
+
|
|
24
|
+
1. Baseline the repo
|
|
25
|
+
- confirm the repo installs and the normal validation commands can run
|
|
26
|
+
- record any pre-existing setup failures separately from integration defects
|
|
27
|
+
2. Add dependencies
|
|
28
|
+
- add `@atomazing-org/design-system`
|
|
29
|
+
- add `@mui/material`, `@mui/icons-material`, `@emotion/react`, and `@emotion/styled` when the scaffold does not already include them
|
|
30
|
+
3. Connect the root provider
|
|
31
|
+
- wrap the app root with `ThemeProviderWrapper`
|
|
32
|
+
- do not add a competing root `ThemeProvider`
|
|
33
|
+
- if the app will expose multiple presets, keep selection in one explicit app-level theme module
|
|
34
|
+
4. Add optional theme controls
|
|
35
|
+
- if the app needs theme switching or dark-mode controls, wire them through `useThemeSettings()`
|
|
36
|
+
- keep UI labels and visible text aligned with the typography contract from the start
|
|
37
|
+
5. Runtime-safe integration
|
|
38
|
+
- if the app uses SSR or Next.js, keep provider wiring inside a client boundary
|
|
39
|
+
- keep browser-only APIs out of module scope
|
|
40
|
+
- start the app and verify the first route boots cleanly in a real browser
|
|
41
|
+
- if the app shell exposes a dedicated workspace or content pane, verify the first route root actually fills that region instead of shrinking to intrinsic content width
|
|
42
|
+
- if the app ships non-Latin copy or seeds localized mocks, keep files in UTF-8 and verify the first route does not render mojibake or replacement characters
|
|
43
|
+
6. Run quality gates
|
|
44
|
+
- run the repo's validation commands
|
|
45
|
+
- verify build, tests, and runtime startup are clean before closeout
|
|
46
|
+
|
|
47
|
+
## Common Failure Modes
|
|
48
|
+
|
|
49
|
+
- adding `ThemeProviderWrapper` while leaving a second competing root theme provider in place
|
|
50
|
+
- keeping preset choice scattered across constants passthrough files instead of one app theme module
|
|
51
|
+
- adding browser-only logic at module scope during initial provider setup
|
|
52
|
+
- first-route page roots or layout containers not stretching to fill the intended workspace
|
|
53
|
+
- localized starter copy or mock data landing in the repo with mojibake because file encoding was not validated
|
|
54
|
+
- declaring greenfield success on build output alone without an actual browser startup check
|
|
55
|
+
|
|
56
|
+
## Shared Gates
|
|
57
|
+
|
|
58
|
+
Use common gate definitions from:
|
|
59
|
+
|
|
60
|
+
- `../../shared/gates.md`
|
|
61
|
+
- `../../shared/acceptance.md`
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../schema/migration.spec.schema.json",
|
|
3
|
+
"id": "greenfield",
|
|
4
|
+
"title": "Greenfield install of @atomazing-org/design-system",
|
|
5
|
+
"detect": {
|
|
6
|
+
"packageJson": {
|
|
7
|
+
"allDependencies": []
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"entryConditions": ["package.json exists"],
|
|
11
|
+
"exitConditions": [
|
|
12
|
+
"ThemeProviderWrapper is connected at the app root",
|
|
13
|
+
"the app boots cleanly on the first route",
|
|
14
|
+
"tests and build are green"
|
|
15
|
+
],
|
|
16
|
+
"steps": [
|
|
17
|
+
{
|
|
18
|
+
"name": "Baseline",
|
|
19
|
+
"manualReview": [
|
|
20
|
+
"Confirm the repo installs and the normal validation commands can run.",
|
|
21
|
+
"Record any pre-existing setup failures separately from integration defects."
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "Add deps",
|
|
26
|
+
"run": [
|
|
27
|
+
"node migrations/scripts/migrations/design-system/actions/update-package-json.mjs --add @atomazing-org/design-system:<SET_VERSION> --add @mui/material:^7 --add @mui/icons-material:^7 --add @emotion/react:^11 --add @emotion/styled:^11"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "Install deps",
|
|
32
|
+
"run": ["npm install"]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "Manual integration",
|
|
36
|
+
"manualReview": [
|
|
37
|
+
"Connect ThemeProviderWrapper at the application root.",
|
|
38
|
+
"If the app exposes multiple presets, keep selection in one explicit app-level theme module.",
|
|
39
|
+
"If Next.js or another SSR framework is in use, ensure the provider lives in a client boundary."
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "Runtime boot verification",
|
|
44
|
+
"manualReview": [
|
|
45
|
+
"Start the app with the repo's normal dev/start command and open the first route in a real browser.",
|
|
46
|
+
"Fix startup console errors before closeout.",
|
|
47
|
+
"Keep browser-only APIs out of module scope during initial provider integration.",
|
|
48
|
+
"If the app shell exposes a dedicated workspace or content pane, verify the first route root fills that region instead of shrinking to intrinsic content width.",
|
|
49
|
+
"If the app ships non-Latin copy or localized mocks, scan for mojibake or replacement characters and verify readable text on the first route."
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "Quality",
|
|
54
|
+
"run": ["npm run lint", "npm test", "npm run build"]
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"gates": ["lint", "tests", "build"]
|
|
58
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Route: mui4-to-latest
|
|
2
|
+
|
|
3
|
+
Use this route when the target app still depends on Material-UI v4 and must land
|
|
4
|
+
on the `@atomazing-org/design-system` v2 contract with a MUI v7 baseline.
|
|
5
|
+
|
|
6
|
+
## Use This Route When
|
|
7
|
+
|
|
8
|
+
- `package.json` still contains `@material-ui/*`
|
|
9
|
+
- the app still uses legacy styling APIs such as `makeStyles`, `withStyles`, or `createMuiTheme`
|
|
10
|
+
- a piecemeal integration would otherwise leave the repo in a mixed MUI v4 and MUI v7 state
|
|
11
|
+
|
|
12
|
+
## Target Outcome
|
|
13
|
+
|
|
14
|
+
- the project runs on `@mui/material` v7 plus Emotion
|
|
15
|
+
- `ThemeProviderWrapper` is the only app-level theme root
|
|
16
|
+
- legacy MUI v4 imports and styling APIs are removed
|
|
17
|
+
- major UI surfaces and typography rely on modern MUI theme contracts instead of legacy local tokens
|
|
18
|
+
- the app boots cleanly after migration, not just after a codemod
|
|
19
|
+
|
|
20
|
+
Use `../../shared/phases.md` as the canonical step-by-step phase checklist, then
|
|
21
|
+
apply the route-specific requirements below.
|
|
22
|
+
|
|
23
|
+
## Large-Project Execution Model
|
|
24
|
+
|
|
25
|
+
- keep the app runnable at the end of every phase
|
|
26
|
+
- keep one main change class per phase:
|
|
27
|
+
- dependency landing
|
|
28
|
+
- mechanical codemod
|
|
29
|
+
- legacy styling cleanup
|
|
30
|
+
- root theme unification
|
|
31
|
+
- runtime cleanup
|
|
32
|
+
- shared infrastructure
|
|
33
|
+
- domain waves
|
|
34
|
+
- final token cleanup
|
|
35
|
+
- do not mix shell rewrites, broad token cleanup, and dependency upgrades in one unvalidated batch
|
|
36
|
+
- checkpoint each phase with a commit or equivalent rollback point before continuing
|
|
37
|
+
|
|
38
|
+
## Required Workflow (Phases)
|
|
39
|
+
|
|
40
|
+
1. Inventory and segmentation
|
|
41
|
+
- map `@material-ui/*` dependencies and imports
|
|
42
|
+
- map `makeStyles`, `withStyles`, `createStyles`, `StylesProvider`, `ServerStyleSheets`, and `createMuiTheme`
|
|
43
|
+
- map local token modules, app shell entrypoints, shared overlays, auth-guarded routes, and build-system risks
|
|
44
|
+
- split the migration into shared-infrastructure scope plus domain waves
|
|
45
|
+
2. Baseline and safety net
|
|
46
|
+
- run the repo's normal validation commands
|
|
47
|
+
- record pre-existing red checks separately from migration defects
|
|
48
|
+
- add or tighten smoke coverage for:
|
|
49
|
+
- the application shell
|
|
50
|
+
- at least one protected content route when route guards exist
|
|
51
|
+
- at least one stable overlay interaction when dialogs, drawers, or command surfaces are in scope
|
|
52
|
+
3. Dependency landing zone
|
|
53
|
+
- remove `@material-ui/*`
|
|
54
|
+
- add `@mui/material`, `@mui/icons-material`, `@emotion/react`, `@emotion/styled`, and `@atomazing-org/design-system`
|
|
55
|
+
- separately align adjacent packages such as pickers, data-grid, lab, or other MUI ecosystem packages
|
|
56
|
+
4. Mechanical v4 to v5 migration
|
|
57
|
+
- run the official MUI codemod
|
|
58
|
+
- resolve compile failures and TODO markers left by the codemod
|
|
59
|
+
- keep the output as a mechanical landing step, not a full visual cleanup
|
|
60
|
+
5. Legacy styling and theme API cleanup
|
|
61
|
+
- replace `makeStyles`, `withStyles`, `createStyles`, and other JSS-specific patterns
|
|
62
|
+
- replace `createMuiTheme`, legacy `overrides` or `props`, and deprecated spacing or theme API usage
|
|
63
|
+
- remove legacy styling providers that no longer belong in the runtime
|
|
64
|
+
6. Stabilize on modern MUI before design-system adoption
|
|
65
|
+
- get the app compiling and booting on modern MUI plus Emotion before changing the theme source of truth
|
|
66
|
+
- resolve duplicate React or Emotion runtime loading
|
|
67
|
+
- preserve the structural shell layout while removing legacy APIs
|
|
68
|
+
7. Root theme unification
|
|
69
|
+
- connect `ThemeProviderWrapper` at the app root
|
|
70
|
+
- remove competing root `ThemeProvider` instances unless they are thin wrappers around the design system
|
|
71
|
+
- move preset selection into one explicit app-level theme module such as `src/theme/appThemes.ts`
|
|
72
|
+
8. Runtime boot cleanup
|
|
73
|
+
- start the app with the repo's normal dev or start command
|
|
74
|
+
- open the first route in a real browser
|
|
75
|
+
- fix startup console errors before continuing
|
|
76
|
+
- fix migration-caused startup warnings before continuing
|
|
77
|
+
- remove module-scope code that depends on browser APIs, storage, or i18n locale activation
|
|
78
|
+
- move browser listeners such as `beforeinstallprompt`, `matchMedia`, or resize subscriptions into effects with cleanup
|
|
79
|
+
- if smoke mode disables auth redirects, seed a deterministic role-bearing user so protected routes can render real content
|
|
80
|
+
9. Shared infrastructure migration
|
|
81
|
+
- stabilize the app shell, route wrappers, and shared layout containers first
|
|
82
|
+
- migrate shared primitives that should now use MUI directly or thin MUI wrappers
|
|
83
|
+
- restore shared dialogs, drawers, bottom sheets, and search overlays with stable semantics and layout contracts
|
|
84
|
+
- explicitly preserve `display`, grid or flex templates, `min-width`, `min-height`, `overflow`, and scroll behavior when refactoring shell containers
|
|
85
|
+
- if shell workspaces, route wrappers, or page roots were touched, verify the main content still fills the available content region instead of collapsing into partial-width cards or broken dashboard stacks
|
|
86
|
+
- audit compact shared UI such as chart legends, chips, segmented filters, and metric badges for preset drift; if they now read as ad hoc chip chrome, rebuild them with neutral MUI composition
|
|
87
|
+
10. Token and consumer cleanup
|
|
88
|
+
- apply token remaps in controlled batches instead of one repo-wide blind replace
|
|
89
|
+
- replace hardcoded tokens with `theme.palette`, `theme.typography`, and MUI theme helpers
|
|
90
|
+
- remove zero-value wrappers and zero-value surface wrappers
|
|
91
|
+
- normalize visible text to `Typography` with explicit variants
|
|
92
|
+
- replace palette alpha suffix hacks with `alpha()`
|
|
93
|
+
- remove app-owned gradient or shadow chrome from normal consumer surfaces
|
|
94
|
+
- if codemods, token remaps, or file rewrites touched localized copy, keep files in UTF-8, scan for mojibake or replacement characters, and verify at least one real localized route renders readable text
|
|
95
|
+
11. Domain waves
|
|
96
|
+
- migrate feature areas in waves after shared infrastructure is stable
|
|
97
|
+
- keep each wave small enough to validate independently
|
|
98
|
+
- run smoke and visual checks after each wave before moving to the next domain
|
|
99
|
+
12. Final quality gates and closeout
|
|
100
|
+
- re-run lint, tests, build, and route-specific gates
|
|
101
|
+
- verify no `@material-ui/*` dependencies remain
|
|
102
|
+
- verify no `@material-ui/*` imports remain in source
|
|
103
|
+
- verify the app root uses `ThemeProviderWrapper`
|
|
104
|
+
- verify the first route boots without browser console startup errors or migration-caused runtime warnings
|
|
105
|
+
|
|
106
|
+
## Common Failure Modes
|
|
107
|
+
|
|
108
|
+
- treating the codemod result as a finished migration instead of a mechanical landing step
|
|
109
|
+
- removing `@material-ui/*` but leaving JSS runtime or theme APIs in place
|
|
110
|
+
- adopting the design system before the app is stable on modern MUI plus Emotion
|
|
111
|
+
- mixing dependency upgrades, shell rewrites, and token cleanup into one giant diff that cannot be debugged safely
|
|
112
|
+
- module-scope `window`, `document`, `navigator`, or storage access that breaks startup once providers move
|
|
113
|
+
- module-scope i18n work that runs before locale activation
|
|
114
|
+
- duplicate React or Emotion runtimes after moving to modern MUI
|
|
115
|
+
- protected-route smoke checks that only render fallback pages instead of real product screens
|
|
116
|
+
- shared shell or overlay rewrites that accidentally drop layout constraints, semantics, or spacing
|
|
117
|
+
- route roots or page containers lose fill behavior, so the workspace shows partial-width cards, collapsed analytics grids, or unused content area
|
|
118
|
+
- compact legends, analytics chips, metric badges, or segmented filters drift into consumer-owned chip chrome that visibly fights the preset
|
|
119
|
+
- codemods or encoding fixes leave mojibake, replacement characters, or broken non-Latin text in screens, fixtures, or mock data
|
|
120
|
+
- repo-wide token replacements applied before shared infrastructure is stabilized
|
|
121
|
+
|
|
122
|
+
## Practical Fix Patterns
|
|
123
|
+
|
|
124
|
+
- land on modern MUI plus Emotion first, then adopt `ThemeProviderWrapper`
|
|
125
|
+
- keep a dedicated app theme module for preset selection
|
|
126
|
+
- treat shell wrappers and overlay wrappers as behavior, not decoration
|
|
127
|
+
- if a shell exposes a workspace pane, keep route roots and page containers on explicit flex growth with preserved `min-width`, `min-height`, and width constraints so the page actually fills the workspace
|
|
128
|
+
- add smoke coverage before broad shared-component rewrites
|
|
129
|
+
- migrate shared infrastructure before feature-specific pages
|
|
130
|
+
- batch token replacement by shared area or domain instead of by global search alone
|
|
131
|
+
- if compact legends, chips, or segmented filters drift away from the preset, rebuild them from `Stack`, markers, and `Typography` instead of preserving ad hoc chip styling
|
|
132
|
+
- after bulk replacements or encoding-sensitive edits, run a mojibake scan and verify one localized route in a real browser before closing the migration
|
|
133
|
+
- expand repo-local design and typography gates once the broad cleanup begins
|
|
134
|
+
|
|
135
|
+
## Shared Gates
|
|
136
|
+
|
|
137
|
+
Use common gate definitions from:
|
|
138
|
+
|
|
139
|
+
- `../../shared/gates.md`
|
|
140
|
+
- `../../shared/acceptance.md`
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../schema/migration.spec.schema.json",
|
|
3
|
+
"id": "mui4-to-latest",
|
|
4
|
+
"title": "MUI v4 to MUI v7 plus @atomazing-org/design-system",
|
|
5
|
+
"detect": {
|
|
6
|
+
"packageJson": {
|
|
7
|
+
"anyDependencies": [
|
|
8
|
+
"@material-ui/core",
|
|
9
|
+
"@material-ui/styles",
|
|
10
|
+
"@material-ui/icons"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"entryConditions": [
|
|
15
|
+
"package.json contains @material-ui/*",
|
|
16
|
+
"the migration needs a full route-based upgrade instead of piecemeal edits"
|
|
17
|
+
],
|
|
18
|
+
"exitConditions": [
|
|
19
|
+
"package.json does not contain @material-ui/*",
|
|
20
|
+
"app source no longer imports @material-ui/*",
|
|
21
|
+
"the app root uses ThemeProviderWrapper",
|
|
22
|
+
"the app boots without migration-caused startup console errors",
|
|
23
|
+
"tests and build are green"
|
|
24
|
+
],
|
|
25
|
+
"steps": [
|
|
26
|
+
{
|
|
27
|
+
"name": "Inventory and baseline",
|
|
28
|
+
"run": ["npm ci", "npm test", "npm run build"],
|
|
29
|
+
"manualReview": [
|
|
30
|
+
"Map @material-ui/* imports and dependencies plus legacy styling APIs such as makeStyles, withStyles, createMuiTheme, StylesProvider, and ServerStyleSheets.",
|
|
31
|
+
"Record pre-existing failing checks separately from migration defects.",
|
|
32
|
+
"Split the repo into shared-infrastructure scope and domain migration waves before broad edits begin."
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "Add safety net",
|
|
37
|
+
"manualReview": [
|
|
38
|
+
"Add or tighten smoke coverage for the application shell before broad refactors.",
|
|
39
|
+
"If route guards exist, ensure at least one protected content route can be validated as a real screen.",
|
|
40
|
+
"If shared overlays will be touched, add at least one stable overlay interaction to smoke coverage."
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "Update package.json deps (v4 to modern MUI plus design-system)",
|
|
45
|
+
"run": [
|
|
46
|
+
"node migrations/scripts/migrations/design-system/actions/update-package-json.mjs --remove @material-ui/core --remove @material-ui/styles --remove @material-ui/icons --add @mui/material:^7 --add @mui/icons-material:^7 --add @emotion/react:^11 --add @emotion/styled:^11 --add @atomazing-org/design-system:<SET_VERSION>"
|
|
47
|
+
],
|
|
48
|
+
"manualReview": [
|
|
49
|
+
"Check for adjacent ecosystem packages such as mui lab, x packages, date-pickers, or data-grid and align them separately.",
|
|
50
|
+
"Treat this as a dependency landing step only; do not mix in broad visual cleanup."
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "Install deps",
|
|
55
|
+
"run": ["npm install"]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "Run official codemod (v4 to v5)",
|
|
59
|
+
"run": ["npx @mui/codemod@latest v5.0.0/preset-safe src"],
|
|
60
|
+
"manualReview": [
|
|
61
|
+
"Review TODO markers and compile errors left by the codemod.",
|
|
62
|
+
"Treat the codemod output as a mechanical landing step, not as a finished migration."
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "Remove legacy styling and theme APIs",
|
|
67
|
+
"manualReview": [
|
|
68
|
+
"Replace makeStyles, withStyles, createStyles, and other JSS-only patterns.",
|
|
69
|
+
"Replace createMuiTheme, legacy overrides or props usage, and deprecated theme API calls such as theme.spacing.unit.",
|
|
70
|
+
"Remove legacy styling providers that no longer belong in the runtime."
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "Stabilize on modern MUI baseline",
|
|
75
|
+
"manualReview": [
|
|
76
|
+
"Get the app compiling and booting on modern MUI plus Emotion before changing the theme root.",
|
|
77
|
+
"Resolve duplicate React or Emotion runtime loading before design-system adoption.",
|
|
78
|
+
"Preserve the structural shell layout while modernizing the underlying MUI stack."
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "Connect design-system provider",
|
|
83
|
+
"manualReview": [
|
|
84
|
+
"Connect ThemeProviderWrapper at the application root.",
|
|
85
|
+
"Remove or collapse any competing root ThemeProvider so the design system becomes the single theme source of truth.",
|
|
86
|
+
"Move preset selection into one explicit app-level theme module instead of leaving it scattered across generic constants layers."
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "Runtime boot cleanup",
|
|
91
|
+
"manualReview": [
|
|
92
|
+
"Start the app with the repo's normal dev or start command and open the first route in a real browser.",
|
|
93
|
+
"Fix startup console errors before continuing.",
|
|
94
|
+
"Fix migration-caused startup warnings before continuing, especially duplicate runtime singleton warnings for react, react-dom, @emotion/react, and @emotion/styled.",
|
|
95
|
+
"Remove module-scope code that requires browser APIs, storage, or i18n locale activation.",
|
|
96
|
+
"Move browser event listeners into effects with cleanup instead of render paths or module scope.",
|
|
97
|
+
"If smoke mode disables auth redirect, seed a deterministic role-bearing user so protected routes can render real content."
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "Shared infrastructure migration",
|
|
102
|
+
"manualReview": [
|
|
103
|
+
"Stabilize the app shell, route wrappers, and shared layout containers before domain-by-domain work.",
|
|
104
|
+
"Migrate shared primitives that should now use MUI directly or thin MUI wrappers.",
|
|
105
|
+
"Restore dialog, drawer, bottom-sheet, and search-overlay semantics before broad feature cleanup.",
|
|
106
|
+
"Preserve display, grid or flex templates, min-width, min-height, overflow, and scroll behavior when refactoring shell containers.",
|
|
107
|
+
"If shell workspaces, route wrappers, or page roots were touched, verify the main content still fills the available content region and that dashboard or workflow grids did not collapse into partial-width stacks.",
|
|
108
|
+
"Audit compact shared UI such as chart legends, chips, segmented filters, and metric badges for preset drift; replace ad hoc chip-like chrome with neutral MUI composition when needed."
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "Apply token remap (project-specific)",
|
|
113
|
+
"run": [
|
|
114
|
+
"node migrations/scripts/migrations/design-system/shared/apply-replacements-from-csv.mjs --csv migrations/docs/migrations/design-system/routes/mui4-to-latest/token-map.csv --root src"
|
|
115
|
+
],
|
|
116
|
+
"manualReview": [
|
|
117
|
+
"Enable only the rows needed in token-map.csv and review the diff in controlled batches.",
|
|
118
|
+
"For large repos, apply token replacement after shared infrastructure is stable instead of doing a blind repo-wide rewrite first.",
|
|
119
|
+
"For complex replacements, add dedicated rules or perform manual edits.",
|
|
120
|
+
"If bulk replacements or file rewrites touched localized copy, scan for mojibake or replacement characters and verify non-Latin UI text still renders readable strings."
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "Domain migration waves",
|
|
125
|
+
"manualReview": [
|
|
126
|
+
"Migrate feature areas in waves after the shared shell and shared primitives are stable.",
|
|
127
|
+
"Keep each wave small enough to validate independently.",
|
|
128
|
+
"Re-run the relevant smoke or route checks after each wave before moving to the next domain."
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "Quality gates",
|
|
133
|
+
"run": [
|
|
134
|
+
"node migrations/scripts/migrations/design-system/gates/no-legacy-material-ui.mjs --root src",
|
|
135
|
+
"node migrations/scripts/migrations/design-system/gates/no-hardcoded-tokens.mjs --root src --config migrations/scripts/migrations/design-system/shared/token-gate.config.json",
|
|
136
|
+
"npm run lint",
|
|
137
|
+
"npm test",
|
|
138
|
+
"npm run build"
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"gates": ["no-legacy-material-ui", "no-hardcoded-tokens", "lint", "tests", "build"]
|
|
143
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
kind,from,to,notes,enabled
|
|
2
|
+
literal,colors.primary,"(t) => t.palette.brand.main","пример: локальный colors.primary → theme.palette.brand.main",false
|
|
3
|
+
literal,colors.accent,"(t) => t.palette.accent.main",,"",false
|
|
4
|
+
regex,"\\bspacing\\((\\d+)\\)","(t) => t.spacing($1)","пример: перенос spacing() на theme.spacing",false
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://atomazing.org/schemas/design-system/migration.spec.schema.json",
|
|
4
|
+
"title": "Design System Migration Spec",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["id", "title", "steps"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"id": { "type": "string" },
|
|
9
|
+
"title": { "type": "string" },
|
|
10
|
+
"detect": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"packageJson": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"anyDependencies": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"items": { "type": "string" }
|
|
19
|
+
},
|
|
20
|
+
"allDependencies": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"items": { "type": "string" }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"additionalProperties": false
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"additionalProperties": true
|
|
29
|
+
},
|
|
30
|
+
"entryConditions": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": { "type": "string" }
|
|
33
|
+
},
|
|
34
|
+
"exitConditions": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": { "type": "string" }
|
|
37
|
+
},
|
|
38
|
+
"steps": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"items": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"required": ["name"],
|
|
43
|
+
"properties": {
|
|
44
|
+
"name": { "type": "string" },
|
|
45
|
+
"run": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": { "type": "string" }
|
|
48
|
+
},
|
|
49
|
+
"manualReview": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": { "type": "string" }
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"additionalProperties": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"gates": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": { "type": "string" }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"additionalProperties": true
|
|
63
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Общий фундамент миграции
|
|
2
|
+
|
|
3
|
+
## Цель
|
|
4
|
+
|
|
5
|
+
Привести проект к состоянию, где:
|
|
6
|
+
- корневой провайдер темы — **ThemeProviderWrapper** из `@atomazing-org/design-system`;
|
|
7
|
+
- цвета/типографика/компонентные значения берутся из темы (MUI theme), а не из локальных хардкодов;
|
|
8
|
+
- переключение темы/режима (при необходимости) делается через **useThemeSettings**.
|
|
9
|
+
|
|
10
|
+
## Минимальная интеграция
|
|
11
|
+
|
|
12
|
+
В корне приложения оборачиваем UI:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { ThemeProviderWrapper } from "@atomazing-org/design-system";
|
|
16
|
+
|
|
17
|
+
export function App() {
|
|
18
|
+
return (
|
|
19
|
+
<ThemeProviderWrapper>
|
|
20
|
+
{/* app */}
|
|
21
|
+
</ThemeProviderWrapper>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Типовые элементы дизайн-системы
|
|
27
|
+
|
|
28
|
+
- **Dynamic themes**: можно передать массив тем `themes` (name + цвета), чтобы UI мог переключаться между ними.
|
|
29
|
+
- **Dark mode**: чтение/запись режима через `useThemeSettings()`.
|
|
30
|
+
- **Расширенная палитра**: дополнительные цвета (например, `brand`, `neutral`, `accent`, `muted`) доступны в `theme.palette.*` и на ряде компонентов через `color`.
|
|
31
|
+
- **Типографика**: расширенные `Typography` variants (например, семейства `text_*` и `header_*`).
|
|
32
|
+
|
|
33
|
+
## SSR / Next.js
|
|
34
|
+
|
|
35
|
+
Если проект SSR:
|
|
36
|
+
- избегайте обращения к `window/document/navigator/localStorage` на уровне модуля;
|
|
37
|
+
- провайдер темы размещайте в клиентской границе (например, в `layout.tsx` с директивой `"use client"`).
|
|
38
|
+
|
|
39
|
+
|