mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
This PR improves the PostCSS migrations to make sure that we install `@tailwindcss/postcss` in the same bucket as `tailwindcss`. If `tailwindcss` exists in the `dependencies` bucket, we install `@tailwindcss/postcss` in the same bucket. If `tailwindcss` exists in the `devDependencies` bucket, we install `@tailwindcss/postcss` in the same bucket. This also contains an internal refactor that normalizes the package manager to make sure we can install a package to the correct bucket depending on the package manager. --------- Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
16 lines
550 B
TypeScript
16 lines
550 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(base).add(['prettier-plugin-tailwindcss@latest'])
|
|
success(`Prettier plugin migrated to latest version.`)
|
|
}
|
|
} catch {}
|
|
}
|