You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/tailwindcss-patch/MIGRATION.md
+45-8Lines changed: 45 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,41 @@ Migration mapping:
79
79
80
80
If you still have legacy fields, run `tw-patch migrate --dry-run` first, then apply the rewritten config before upgrading.
81
81
82
+
### Quick config diff
83
+
84
+
```ts
85
+
// before
86
+
exportdefaultdefineConfig({
87
+
registry: {
88
+
output: {
89
+
file: '.tw-patch/tw-class-list.json',
90
+
},
91
+
tailwind: {
92
+
package: 'tailwindcss',
93
+
classic: {
94
+
cwd: 'apps/web',
95
+
},
96
+
},
97
+
},
98
+
})
99
+
100
+
// after
101
+
exportdefaultdefineConfig({
102
+
registry: {
103
+
extract: {
104
+
file: '.tw-patch/tw-class-list.json',
105
+
},
106
+
tailwindcss: {
107
+
version: 4,
108
+
packageName: 'tailwindcss',
109
+
v3: {
110
+
cwd: 'apps/web',
111
+
},
112
+
},
113
+
},
114
+
})
115
+
```
116
+
82
117
## 3. CLI changes
83
118
84
119
-`tw-patch install` still applies the runtime patch, but logging and error handling were refreshed.
@@ -104,7 +139,7 @@ If you still have legacy fields, run `tw-patch migrate --dry-run` first, then ap
104
139
- The affected-shards template supports repo-level shard config via `.tw-patch/ci-shards.json` (example: `packages/tailwindcss-patch/examples/github-actions/ci-shards.example.json`).
105
140
- README/README-cn now include a CI copy checklist and troubleshooting notes for local action wiring and common failure modes.
106
141
- Migration report tooling now has public exports from package entry (`migrateConfigFiles`, `restoreConfigFiles`, report constants/types) and published JSON schema subpaths: `tailwindcss-patch/migration-report.schema.json`, `tailwindcss-patch/restore-result.schema.json`, `tailwindcss-patch/validate-result.schema.json`.
107
-
- Commands resolve configuration from `tailwindcss-patch.config.ts` via `@tailwindcss-mangle/config`. Existing configuration files continue to work without changes.
142
+
- Commands resolve configuration from `tailwindcss-patch.config.ts` via `@tailwindcss-mangle/config`. Upgrade configs to the modern `registry` shape before moving to v9.
108
143
109
144
## 4. Cache handling
110
145
@@ -125,7 +160,7 @@ Starting from the cache governance update, the on-disk cache also moved to **sch
125
160
- Legacy array files are still readable, but treated as cache-miss and lazily rebuilt.
126
161
-`TailwindcssPatcher#clearCache()` can clear current-context (default) or all contexts.
127
162
128
-
This keeps public APIs backward compatible while preventing cross-project cache pollution in monorepos.
163
+
This preserves cache-file compatibility while preventing cross-project cache pollution in monorepos.
129
164
130
165
## 5. Exported helpers
131
166
@@ -153,11 +188,13 @@ Update imports accordingly when consuming these helpers directly.
153
188
154
189
## 9. Checklist for upgrading projects
155
190
156
-
1. Update the dependency to the latest version of `tailwindcss-patch`.
157
-
2. Review custom imports from `tailwindcss-patch/core/*` and switch to the new module paths.
158
-
3. If you instantiate the patcher manually, adopt the new options object.
159
-
4. Refresh CLI usage in scripts (e.g. add `--output` or `--no-write` where appropriate).
160
-
5. For Tailwind v4 projects, configure `tailwindcss.v4.cssEntries` and `sources` so that `extract()` can discover candidates.
161
-
6. Run your extraction workflow and ensure the generated class list matches expectations.
191
+
1. Run `tw-patch migrate --dry-run` and inspect every reported config rewrite.
192
+
2. Rewrite or migrate all config files to modern `registry.extract`, `registry.apply`, and `registry.tailwindcss` fields.
193
+
3. Set `registry.tailwindcss.version` explicitly in every project config.
194
+
4. Update custom imports from `tailwindcss-patch/core/*` to the new module paths.
195
+
5. If you instantiate the patcher manually, switch to the modern constructor shape.
196
+
6. Refresh CLI usage in scripts and rerun `tw-patch install`.
197
+
7. For Tailwind v4 projects, configure `tailwindcss.v4.cssEntries` and `sources` so `extract()` can discover candidates.
198
+
8. Run extraction in each project and compare the generated class list with the pre-upgrade output.
162
199
163
200
For any regressions or gaps discovered during migration, please open an issue with reproduction details so we can iterate quickly.
Copy file name to clipboardExpand all lines: packages/tailwindcss-patch/README.md
+42-2Lines changed: 42 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,6 +117,48 @@ Skip `next()` to fully replace a command (e.g. custom `init` or cache clearing b
117
117
118
118
The CLI loads `tailwindcss-patch.config.ts` via `@tailwindcss-mangle/config`. v9 expects the modern `registry` shape; use `tw-patch migrate` before upgrading if your config still uses deprecated keys.
119
119
120
+
### v9 upgrade flow
121
+
122
+
1. Run `pnpm dlx tw-patch migrate --dry-run` to preview required config rewrites.
123
+
2. Apply the migration, or rewrite the config manually to modern `registry` fields.
124
+
3. Confirm every config sets `registry.tailwindcss.version` explicitly.
125
+
4. Upgrade to v9 and rerun `tw-patch install` / `tw-patch extract` in your project.
0 commit comments