mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
This PR adds a migration to bump the `prettier-plugin-tailwindcss` version to the latest version when upgrading your project. This is to ensure that the plugin is compatible with the latest version of Tailwind CSS. Note: we will only do this _if_ you already used the `prettier-plugin-tailwindcss` plugin in your project.
16 lines
548 B
TypeScript
16 lines
548 B
TypeScript
import fs from 'node:fs/promises'
|
|
import path from 'node:path'
|
|
import { pkg } from './utils/packages'
|
|
import { success } from './utils/renderer'
|
|
|
|
export async function migratePrettierPlugin(base: string) {
|
|
let packageJsonPath = path.resolve(base, 'package.json')
|
|
try {
|
|
let packageJson = await fs.readFile(packageJsonPath, 'utf-8')
|
|
if (packageJson.includes('prettier-plugin-tailwindcss')) {
|
|
await pkg('add prettier-plugin-tailwindcss@latest', base)
|
|
success(`Prettier plugin migrated to latest version.`)
|
|
}
|
|
} catch {}
|
|
}
|