Skip to content

Commit 3dfef1e

Browse files
committed
change order
This swaps the "migrate stylesheets" and "migrate source files" steps. This will make things easier _if_ we don't even need to migrate JS config files and can rely on the CSS file itself. This will happen if you run the upgrade tool in Tailwind CSS v4 projects.
1 parent d5fa112 commit 3dfef1e

File tree

1 file changed

+35
-35
lines changed
  • packages/@tailwindcss-upgrade/src

1 file changed

+35
-35
lines changed

packages/@tailwindcss-upgrade/src/index.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -148,41 +148,6 @@ async function run() {
148148
}
149149
}
150150

151-
// Migrate source files
152-
if (configBySheet.size > 0) {
153-
info('Migrating templates…')
154-
}
155-
{
156-
// Template migrations
157-
for (let config of configBySheet.values()) {
158-
let set = new Set<string>()
159-
for (let globEntry of config.sources.flatMap((entry) => hoistStaticGlobParts(entry))) {
160-
let files = await globby([globEntry.pattern], {
161-
absolute: true,
162-
gitignore: true,
163-
cwd: globEntry.base,
164-
})
165-
166-
for (let file of files) {
167-
set.add(file)
168-
}
169-
}
170-
171-
let files = Array.from(set)
172-
files.sort()
173-
174-
// Migrate each file
175-
await Promise.allSettled(
176-
files.map((file) => migrateTemplate(config.designSystem, config.userConfig, file)),
177-
)
178-
179-
success(
180-
`Migrated templates for configuration file: ${highlight(relative(config.configFilePath, base))}`,
181-
{ prefix: '↳ ' },
182-
)
183-
}
184-
}
185-
186151
// Migrate each CSS file
187152
if (stylesheets.length > 0) {
188153
info('Migrating stylesheets…')
@@ -259,6 +224,41 @@ async function run() {
259224
success(`Migrated stylesheet: ${highlight(relative(sheet.file, base))}`, { prefix: '↳ ' })
260225
}
261226
}
227+
228+
// Migrate source files
229+
if (configBySheet.size > 0) {
230+
info('Migrating templates…')
231+
}
232+
{
233+
// Template migrations
234+
for (let config of configBySheet.values()) {
235+
let set = new Set<string>()
236+
for (let globEntry of config.sources.flatMap((entry) => hoistStaticGlobParts(entry))) {
237+
let files = await globby([globEntry.pattern], {
238+
absolute: true,
239+
gitignore: true,
240+
cwd: globEntry.base,
241+
})
242+
243+
for (let file of files) {
244+
set.add(file)
245+
}
246+
}
247+
248+
let files = Array.from(set)
249+
files.sort()
250+
251+
// Migrate each file
252+
await Promise.allSettled(
253+
files.map((file) => migrateTemplate(config.designSystem, config.userConfig, file)),
254+
)
255+
256+
success(
257+
`Migrated templates for configuration file: ${highlight(relative(config.configFilePath, base))}`,
258+
{ prefix: '↳ ' },
259+
)
260+
}
261+
}
262262
}
263263

264264
if (version.isMajor(3)) {

0 commit comments

Comments
 (0)