blitz-js / blitz

⚡️ The Missing Fullstack Toolkit for Next.js
https://Blitzjs.com
MIT License
13.63k stars 799 forks source link

codemod at least has a typo, and maybe other problems #4334

Open Vandivier opened 4 months ago

Vandivier commented 4 months ago

What is the problem?

when i run npx @blitzjs/codemod upgrade-legacy as instructed in https://blitzjs.com/docs/upgrading-from-framework, I see an error: App directory doesn't exit

On inspection, this is a typo which should read App directory doesn't exist

A deeper issue, though, is that I don't expect the app dir to pre-exist. I'm expecting the code mod to create it, because I am expecting this upgrade to move from pages dir to app dir along with the rest of the upgrade.

Paste all your error logs here:

PASTE_HERE (leave the ``` marks)

Paste all relevant code snippets here:

PASTE_HERE (leave the ``` marks)

What are detailed steps to reproduce this?

1.

Run blitz -v and paste the output here:

PASTE_HERE (leave the ``` marks)

Please include below any other applicable logs and screenshots that show your problem:

No response

Vandivier commented 4 months ago

some other problems:

  1. if i have next.config.js instead of blitz.config.js the codemod unnecessarily errors
  2. it errors if i don't have an app dir. maybe this is proper? but can it just make an app dir?
  3. it errors after inserting import { withBlitz } from "app/blitz-client"; blindly, if it was already in the file under insertion; instead, the mod should check ahead of time and only insert if needed
Vandivier commented 4 months ago

error for 3 above:

image
Vandivier commented 4 months ago

i fixed the above manually, now i got this:

image
Vandivier commented 4 months ago

ran at ref https://github.com/Vandivier/ladderly-3/pull/220