shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
75.11k stars 4.69k forks source link

[bug]: Electron vite init #5005

Open mrafieefard opened 1 month ago

mrafieefard commented 1 month ago

Describe the bug

I'm trying to install shadcn on electron vite but when I use bunx --bun shadcn@latest init I get Verifying framework error

✔ Preflight checks.
✖ Verifying framework.

We could not detect a supported framework at I:\Nodejs\test-app2.
Visit https://ui.shadcn.com/docs/installation/manual to manually configure your project.
Once configured, you can use the cli to add components.

I know there are other module for electron, vite and shadcn but I want to use officials

When I use shadcn cli 0.8.0 I can install successful but not for latest version

Affected component/components

None

How to reproduce

  1. init electron vite project
  2. install tailwind
  3. try to init shadcn using bunx

Codesandbox/StackBlitz link

No response

Logs

✔ Preflight checks.
✖ Verifying framework.

We could not detect a supported framework at I:\Nodejs\test-app2.
Visit https://ui.shadcn.com/docs/installation/manual to manually configure your project.
Once configured, you can use the cli to add components.

System Info

Windows 10

Before submitting

mrafieefard commented 1 month ago

electron.vite.config.ts is part of electron vite package

rafeautie commented 3 weeks ago

@mrafieefard Duplicate your electron.vite.config.ts to vite.config.ts, shadcn needs the vite.config.ts to exist (for its preflight checks), but electron-vite requires electron.vite.config.ts to exist (no idea why, but it cant be named vite.config.ts). To prevent duplicating files you can import one into the other so you only have to write the config once.

ilomon10 commented 1 week ago

@rafeautie can you please share your electron-vite-shadcn project structure?

mrafieefard commented 1 week ago

@rafeautie can you please share your electron-vite-shadcn project structure?

Sure image

@mrafieefard Duplicate your electron.vite.config.ts to vite.config.ts, shadcn needs the vite.config.ts to exist (for its preflight checks), but electron-vite requires electron.vite.config.ts to exist (no idea why, but it cant be named vite.config.ts). To prevent duplicating files you can import one into the other so you only have to write the config once.

I will check it but I think this idea works