Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/upgrade/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @astrojs/upgrade

## 0.6.3

### Patch Changes

- Fixed issue where upgrading projects with `@astrojs/tailwind` using `bunx @astrojs/upgrade` would fail with "migration tool can only be run on v3 project" error. The upgrade tool now properly handles the deprecated `@astrojs/tailwind` integration by showing a deprecation warning and guiding users to migrate to `@tailwindcss/vite` instead of attempting to upgrade to the deprecated v6.0.0.

## 0.6.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/upgrade/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@astrojs/upgrade",
"version": "0.6.2",
"version": "0.6.3",
"type": "module",
"author": "withastro",
"license": "MIT",
Expand Down
17 changes: 16 additions & 1 deletion packages/upgrade/src/actions/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ export async function install(
) {
await banner();
newline();

// Special handling for deprecated @astrojs/tailwind
const tailwindPackage = ctx.packages.find(pkg => pkg.name === '@astrojs/tailwind');
if (tailwindPackage) {
await warn('deprecated', `@astrojs/tailwind is deprecated in favor of @tailwindcss/vite`);
await info('migrate', 'Please follow the migration guide: https://tailwindcss.com/docs/installation/framework-guides/astro');
newline();
}

const { current, dependencies, devDependencies } = filterPackages(ctx);
const toInstall = [...dependencies, ...devDependencies].sort(sortPackages);
for (const packageInfo of current.sort(sortPackages)) {
Expand Down Expand Up @@ -90,7 +99,13 @@ function filterPackages(ctx: Pick<Context, 'packages'>) {
const dependencies: PackageInfo[] = [];
const devDependencies: PackageInfo[] = [];
for (const packageInfo of ctx.packages) {
const { currentVersion, targetVersion, isDevDependency } = packageInfo;
const { currentVersion, targetVersion, isDevDependency, name } = packageInfo;

// Skip @astrojs/tailwind as it's deprecated and should not be upgraded
if (name === '@astrojs/tailwind') {
continue;
}

// Remove prefix from version before comparing
if (currentVersion.replace(/^\D+/, '') === targetVersion.replace(/^\D+/, '')) {
current.push(packageInfo);
Expand Down
10 changes: 10 additions & 0 deletions packages/upgrade/src/actions/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ async function verifyVersions(
}

async function resolveTargetVersion(packageInfo: PackageInfo, registry: string): Promise<void> {
// Special handling for deprecated @astrojs/tailwind integration
// to prevent upgrade to v6.0.0 which is deprecated in favor of @tailwindcss/vite
if (packageInfo.name === '@astrojs/tailwind') {
packageInfo.isMajor = true;
packageInfo.changelogURL = 'https://tailwindcss.com/docs/installation/framework-guides/astro';
packageInfo.changelogTitle = 'Migrate to @tailwindcss/vite plugin';
// Don't upgrade @astrojs/tailwind, user should migrate to @tailwindcss/vite
return;
}

const packageMetadata = await fetch(`${registry}/${packageInfo.name}`, {
headers: { accept: 'application/vnd.npm.install-v1+json' },
});
Expand Down
Loading