Skip to content

Commit 0fd30fc

Browse files
committed
improve output messages
1 parent 29eccfe commit 0fd30fc

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

integrations/upgrade/index.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,13 +1702,13 @@ test(
17021702
17031703
│ No input stylesheets provided. Searching for CSS files in the current directory and its subdirectories…
17041704
1705-
Found config file: \`./tailwind.config.ts\` for \`./src/root.1.css\`
1705+
Linked \`./tailwind.config.ts\` to \`./src/root.1.css\`
17061706
1707-
Found config file: \`./tailwind.config.ts\` for \`./src/root.3.css\`
1707+
Linked \`./tailwind.config.ts\` to \`./src/root.3.css\`
17081708
1709-
Found config file: \`./tailwind.config.ts\` for \`./src/root.4.css\`
1709+
Linked \`./tailwind.config.ts\` to \`./src/root.4.css\`
17101710
1711-
Found config file: \`./tailwind.config.ts\` for \`./src/root.5/tailwind.css\`
1711+
Linked \`./tailwind.config.ts\` to \`./src/root.5/tailwind.css\`
17121712
17131713
│ You have multiple stylesheets that do not have an \`@config\`.
17141714
│ Please add a \`@config "…";\` referencing the correct Tailwind config file to:

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { args, type Arg } from './utils/args'
2323
import { isRepoDirty } from './utils/git'
2424
import { hoistStaticGlobParts } from './utils/hoist-static-glob-parts'
2525
import { pkg } from './utils/packages'
26-
import { eprintln, error, header, highlight, info, success } from './utils/renderer'
26+
import { eprintln, error, header, highlight, info, relative, success } from './utils/renderer'
2727

2828
const options = {
2929
'--config': { type: 'string', description: 'Path to the configuration file', alias: '-c' },
@@ -112,7 +112,6 @@ async function run() {
112112
}
113113

114114
// Migrate js config files, linked to stylesheets
115-
info('Migrating JavaScript configuration files using the provided configuration file.')
116115
let configBySheet = new Map<Stylesheet, Awaited<ReturnType<typeof prepareConfig>>>()
117116
let jsConfigMigrationBySheet = new Map<
118117
Stylesheet,
@@ -124,6 +123,7 @@ async function run() {
124123
let config = await prepareConfig(sheet.linkedConfigPath, { base })
125124
configBySheet.set(sheet, config)
126125

126+
info(`Migrating JavaScript configuration file: \`${relative(config.configFilePath, base)}\``)
127127
let jsConfigMigration = await migrateJsConfig(
128128
config.designSystem,
129129
config.configFilePath,
@@ -140,9 +140,10 @@ async function run() {
140140
// Migrate source files, linked to config files
141141
{
142142
// Template migrations
143-
144-
info('Migrating templates using the provided configuration file.')
145143
for (let config of configBySheet.values()) {
144+
info(
145+
`Migrating templates using the provided configuration file: \`${relative(config.configFilePath, base)}\`.`,
146+
)
146147
let set = new Set<string>()
147148
for (let globEntry of config.globs.flatMap((entry) => hoistStaticGlobParts(entry))) {
148149
let files = await globby([globEntry.pattern], {
@@ -163,12 +164,13 @@ async function run() {
163164
await Promise.allSettled(
164165
files.map((file) => migrateTemplate(config.designSystem, config.userConfig, file)),
165166
)
166-
}
167167

168-
success('Template migration complete.')
168+
success('↳ Template migration complete.')
169+
}
169170
}
170171

171172
// Migrate each CSS file
173+
info('Migrating stylesheets')
172174
let migrateResults = await Promise.allSettled(
173175
stylesheets.map((sheet) => {
174176
let config = configBySheet.get(sheet)!
@@ -235,7 +237,7 @@ async function run() {
235237
await fs.writeFile(sheet.file, sheet.root.toString())
236238
}
237239

238-
success('Stylesheet migration complete.')
240+
success('Stylesheet migration complete.')
239241
}
240242

241243
{

packages/@tailwindcss-upgrade/src/migrate-js-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type { DesignSystem } from '../../tailwindcss/src/design-system'
1919
import { escape } from '../../tailwindcss/src/utils/escape'
2020
import { isValidSpacingMultiplier } from '../../tailwindcss/src/utils/infer-data-type'
2121
import { findStaticPlugins, type StaticPluginOptions } from './utils/extract-static-plugins'
22-
import { info } from './utils/renderer'
22+
import { info, relative } from './utils/renderer'
2323

2424
const __filename = fileURLToPath(import.meta.url)
2525
const __dirname = path.dirname(__filename)
@@ -44,7 +44,7 @@ export async function migrateJsConfig(
4444

4545
if (!canMigrateConfig(unresolvedConfig, source)) {
4646
info(
47-
'Your configuration file could not be automatically migrated to the new CSS configuration format, so your CSS has been updated to load your existing configuration file.',
47+
`Your configuration file at \`${relative(fullConfigPath, base)}\` could not be automatically migrated to the new CSS configuration format, so your CSS has been updated to load your existing configuration file.`,
4848
)
4949
return null
5050
}

packages/@tailwindcss-upgrade/src/migrate-postcss.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export async function migratePostCSSConfig(base: string) {
105105
} catch {}
106106
}
107107

108-
success(`PostCSS config has been upgraded.`)
108+
success(`PostCSS config has been upgraded.`)
109109
}
110110

111111
async function migratePostCSSJSConfig(

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,7 @@ export async function linkConfigs(
350350
localConfigPath = path.resolve(base, localConfigPath)
351351
}
352352

353-
info(
354-
`Found config file: \`${relative(localConfigPath, base)}\` for \`${relative(sheet.file, base)}\``,
355-
)
353+
info(`Linked \`${relative(localConfigPath, base)}\` to \`${relative(sheet.file, base)}\``)
356354
configPathBySheet.set(sheet, localConfigPath)
357355
sheetByConfigPath.get(localConfigPath).add(sheet)
358356
}

0 commit comments

Comments
 (0)