nicoalbanese / kirimase

Build full-stack Next.js apps, incredibly fast
https://kirimase.dev
MIT License
2.39k stars 107 forks source link

[Bug] Kirimase init Command Installs ShadCDN Outside Specified 'src' Folder #108

Closed pieterbb closed 6 months ago

pieterbb commented 6 months ago

Hi Nico, love the project.

It amazes me that something similair didn't exist before. I've looked at Rails so many times because of the scaffolding CLI but couldn't be bothered to make the switch to RoR. It's crazy to write the same boilerplate over and over for each project and reinvent the wheel instead of foccusing on business logic. So I'm happy with this project and hope it will continue to grow, especially the integration of server actions now!

Bug report

Description: When initializing Kirimase and selecting the 'src' folder option, the ShadCDN component is unexpectedly installed in the project's root directory under an 'undefined' folder, instead of the specified 'src' folder. This behavior occurs even though the 'src' folder toggle is selected during the initialization process.

Steps to Reproduce:

Expected Behavior: All files related to Shadcn UI should be installed within the specified 'src' folder.

Actual Behavior: Files associated with Shadcn UI are being created in a directory labeled 'undefined' at the root of the project, despite selecting the 'src' folder during setup.

CleanShot 2023-12-16 at 14 41 38@2x

code/playground/bugreport2 on  main via ⬢ v20.9.0 
❯ npx kirimase init
Need to install the following packages:
kirimase@0.0.38
Ok to proceed? (y) y
? Are you using a 'src' folder? Yes
? Please pick your preferred package manager NPM
✔ File created at ./kirimase.config.json                                                                                                                                                  2:39:23 PM
✔ Kirimase initialized!                                                                                                                                                                   2:39:23 PM
ℹ You can now add packages.                                                                                                                                                               2:39:23 PM
◐ Checking project for existing packages...                                                                                                                                                2:39:23 PM
✔ Successfully searched project and found no additional packages.                                                                                                                         2:39:23 PM
? Select a component library to use: Shadcn UI (with next-themes)
◐ Installing Shadcn UI...                                                                                                                                                                  2:39:30 PM
◐ Installing packages: tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react next-themes ...                                                                       2:39:30 PM

added 6 packages, and audited 340 packages in 5s

119 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
✔ Packages installed: tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react next-themes                                                                           2:39:35 PM
✔ File created at tailwind.config.js                                                                                                                                                      2:39:35 PM
✔ File replaced at src/app/globals.css                                                                                                                                                    2:39:35 PM
✔ File created at src/lib/utils.ts                                                                                                                                                        2:39:35 PM
✔ File created at components.json                                                                                                                                                         2:39:35 PM
✔ File created at src/app/loading.tsx                                                                                                                                                     2:39:35 PM
✔ File created at src/components/ThemeProvider.tsx                                                                                                                                        2:39:35 PM
✔ File created at src/components/ui/ThemeToggle.tsx                                                                                                                                       2:39:35 PM
✔ File replaced at src/app/layout.tsx                                                                                                                                                     2:39:35 PM
✔ Shadcn initialized successfully.                                                                                                                                                        2:39:35 PM
◐ Installing shadcn-ui components: button, toast, avatar, dropdown-menu, input, label                                                                                                      2:39:35 PM
✔ Done.
✔ Installed components: button, toast, avatar, dropdown-menu, input, label                                                                                                                2:39:38 PM
✔ File replaced at src/app/layout.tsx                                                                                                                                                     2:39:38 PM
? Select an ORM to use: Prisma
nicoalbanese commented 6 months ago

Hey Pieter - thanks so much for the kind words! So sorry you are having this bug. I've just tried to recreate using the same environment but not experiencing the issue. The only thing I can think is that it could possibly be an older version of kirimase in the npm cache causing problems. Could you try resetting the cache? Or using another package manager just to see if the issue persists?

pieterbb commented 6 months ago

Hi Nico, did some digging. Was a misstake from my end 🙃

Using create next app I was setting a custom path import by accident using the CLI arguments.

This caused my TS Config to have an import path which Kirimase could not understand and therefore installing ShadCDN under an 'undefined' folder

Not working

    "paths": {
      "@": [
        "./src/*"
      ],

Setting up using create-next-app with default options:

Working

    "paths": {
      "@/*": ["./src/*"]
    }

Thank you for looking into this


If you have the time / interest, I would love to see a 10-20 min video of you walking through the project and explaining the architecture. With React / Next.JS there is no 'correct' way of doing things. Perhaps this is not your ambition with this project but it doesn't hurt to ask.

Like, I used ShadCDN over Mantine because it can do X, Y, Z here, I'm inheriting the Zod types here because of X and decide to narrow the type because of Y.

Basically walking on a high level over the code and explaining why you have chosen certain patterns etc...

nicoalbanese commented 6 months ago

No problem at all and happy to hear you figured it out! Those can be the most frustrating errors I know!

For sure - I'm definitely planning on doing a walkthrough soon and also providing some more info in the documentation. Really appreciate the feedback!