|
1 | | -# electron-shadcn |
| 1 | +# Electron-Vite-ShadCN |
2 | 2 |
|
3 | | -Electron in all its glory. Everything you will need to develop your beautiful desktop application. |
| 3 | +A complete template to build beautiful desktop applications with Electron. |
4 | 4 |
|
5 | | - |
6 | 5 |
|
7 | | -## Libs and tools |
| 6 | +## Libraries and Tools |
8 | 7 |
|
9 | | -To develop a Electron app, you probably will need some UI, test, formatter, style or other kind of library or framework, so let me install and configure some of them to you. |
| 8 | +- **Core**: [Electron](https://www.electronjs.org), [Vite](https://vitejs.dev), [SWC](https://swc.rs) |
| 9 | +- **DX**: [TypeScript](https://www.typescriptlang.org), [Prettier](https://prettier.io), [Zod](https://zod.dev), [React Query](https://react-query.tanstack.com) |
| 10 | +- **UI**: [React](https://reactjs.org), [Tailwind CSS](https://tailwindcss.com), [Shadcn UI](https://ui.shadcn.com), [i18next](https://www.i18next.com) |
| 11 | +- **Testing**: [Jest](https://jestjs.io), [Playwright](https://playwright.dev), [React Testing Library](https://testing-library.com) |
| 12 | +- **Packaging**: [Electron Forge](https://www.electronforge.io) |
10 | 13 |
|
11 | | -### Core 🏍️ |
| 14 | +## Project Preferences |
12 | 15 |
|
13 | | -- [Electron 32](https://www.electronjs.org) |
14 | | -- [Vite 5](https://vitejs.dev) |
15 | | -- [SWC](https://swc.rs) |
| 16 | +- `Context isolation enabled` |
| 17 | +- `Custom title bar` |
| 18 | +- `Outfit font as default` |
16 | 19 |
|
17 | | -### DX 🛠️ |
18 | 20 |
|
19 | | -- [TypeScript 5](https://www.typescriptlang.org) |
20 | | -- [Prettier](https://prettier.io) |
21 | | -- [Zod](https://zod.dev) |
22 | | -- [React Query (Tan Stack)](https://react-query.tanstack.com) |
23 | | - |
24 | | -### UI 🎨 |
25 | | - |
26 | | -- [React](https://reactjs.org) |
27 | | -- [Tailwind CSS](https://tailwindcss.com) |
28 | | -- [Shadcn UI](https://ui.shadcn.com) |
29 | | -- [Geist](https://vercel.com/font) as default font |
30 | | -- [i18next](https://www.i18next.com) |
31 | | -- [Lucide](https://lucide.dev) |
32 | | - |
33 | | -### Test 🧪 |
34 | | - |
35 | | -- [Jest](https://jestjs.io) |
36 | | -- [Playwright](https://playwright.dev) |
37 | | -- [React Testing Library](https://testing-library.com/docs/react-testing-library/intro) |
38 | | - |
39 | | -### Packing and distribution 📦 |
40 | | - |
41 | | -- [Electron Forge](https://www.electronforge.io) |
42 | | - |
43 | | -### Documentation 📚 |
44 | | - |
45 | | -- [Storybook](https://storybook.js.org) |
46 | | - |
47 | | -### CI/CD 🚀 |
48 | | - |
49 | | -- Pre-configured [GitHub Actions workflow](https://github.com/LuanRoger/electron-shadcn/blob/main/.github/workflows/playwright.yml), for test with Playwright |
50 | | - |
51 | | -### Project preferences 🎯 |
52 | | - |
53 | | -- Use Context isolation |
54 | | -- `titleBarStyle`: hidden (Using custom title bar) |
55 | | -- Geist as default font |
56 | | -- Some default styles was applied, check the [`styles`](https://github.com/LuanRoger/electron-shadcn/tree/main/src/styles) directory |
57 | | - |
58 | | -> If you don't know some of these libraries or tools, I recommend you to check their documentation to understand how they work and how to use them. |
59 | | -
|
60 | | -## Directory structure |
| 21 | +## Directory Structure |
61 | 22 |
|
62 | 23 | ```plaintext |
63 | | -. |
64 | | -└── ./src/ |
65 | | - ├── ./src/assets/ |
66 | | - │ └── ./src/assets/fonts/ |
67 | | - ├── ./src/components/ |
68 | | - │ └── ./src/components/ui/ |
69 | | - ├── ./src/helpers/ |
70 | | - │ └── ./src/helpers/ipc/ |
71 | | - ├── ./src/layout/ |
72 | | - ├── ./src/lib/ |
73 | | - ├── ./src/pages/ |
74 | | - ├── ./src/stories/ |
75 | | - ├── ./src/style/ |
76 | | - └── ./src/tests/ |
| 24 | +src/ |
| 25 | + assets/ |
| 26 | + fonts/ |
| 27 | + components/ |
| 28 | + ui/ |
| 29 | + helpers/ |
| 30 | + ipc/ |
| 31 | + layout/ |
| 32 | + lib/ |
| 33 | + pages/ |
| 34 | + stories/ |
| 35 | + style/ |
| 36 | + tests/ |
77 | 37 | ``` |
78 | 38 |
|
79 | | -- `src/`: Main directory |
80 | | - - `assets/`: Store assets like images, fonts, etc. |
81 | | - - `components/`: Store UI components |
82 | | - - `ui/`: Store Shadcn UI components (this is the default direcotry used by Shadcn UI) |
83 | | - - `helpers/`: Store IPC related functions to be called in the renderer process |
84 | | - - `ipc/`: Directory to store IPC context and listener functions |
85 | | - - Some implementations are already done, like `theme` and `window` for the custom title bar |
86 | | - - `layout/`: Directory to store layout components |
87 | | - - `lib/`: Store libraries and other utilities |
88 | | - - `pages/`: Store app's pages |
89 | | - - `stories/`: Store Storybook stories |
90 | | - - `style/`: Store global styles |
91 | | - - `tests/`: Store tests (from Jest and Playwright) |
92 | | - |
93 | | -## NPM script |
94 | | - |
95 | | -To run any of those scripts: |
96 | | - |
97 | | -```bash |
98 | | -npm run <script> |
99 | | -``` |
100 | | - |
101 | | -- `start`: Start the app in development mode |
102 | | -- `package`: Package your application into a platform-specific executable bundle and put the result in a folder. |
103 | | -- `make`: Generate platform-specific distributables (e.g. .exe, .dmg, etc) of your application for distribution. |
104 | | -- `publish`: Electron Forge's way of taking the artifacts generated by the `make` command and sending them to a service somewhere for you to distribute or use as updates. |
105 | | -- `prett`: Run Prettier to format the code |
106 | | -- `storybook`: Start Storybook |
107 | | -- `build-storybook`: Run the Storybook's build command |
108 | | -- `test`: Run the default unit-test script (Jest) |
109 | | -- `test:watch`: Run the default unit-test script in watch mode (Jest) |
110 | | -- `test:unit`: Run the Jest tests |
111 | | -- `test:e2e`: Run the Playwright tests |
112 | | -- `test:all`: Run all tests (Jest and Playwright) |
113 | | - |
114 | | -The test scripts involving Playwright require the app be builded before running the tests. So, before run the tests, run the `package`, `make` or `publish` script. |
115 | | - |
116 | | -## How to use |
117 | | - |
118 | | -1. Clone this repository |
119 | | - |
120 | | -```bash |
121 | | -git clone https://github.com/LuanRoger/electron-shadcn.git |
122 | | -``` |
123 | | - |
124 | | -Or use it as a template on GitHub |
125 | | - |
126 | | -2. Install dependencies |
127 | | - |
128 | | -```bash |
129 | | -npm install |
130 | | -``` |
131 | | - |
132 | | -3. Run the app |
133 | | - |
134 | | -```bash |
135 | | -npm run start |
136 | | -``` |
137 | | - |
138 | | -## Used by |
139 | | - |
140 | | -- [yaste](https://github.com/LuanRoger/yaste) - yaste (Yet another super ₛᵢₘₚₗₑ text editor) is a text editor, that can be used as an alternative to the native text editor of your SO, maybe. |
141 | | -- [eletric-drizzle](https://github.com/LuanRoger/electric-drizzle) - shadcn-ui and Drizzle ORM with Electron. |
142 | | - |
143 | | -> Does you've used this template in your project? Add it here and open a PR. |
144 | | -
|
145 | | -## License |
| 39 | +## NPM Scripts |
146 | 40 |
|
147 | | -This project is licensed under the MIT License - see the [LICENSE](https://github.com/LuanRoger/electron-shadcn/blob/main/LICENSE) file for details. |
| 41 | +- `start`: Run the app in dev mode |
| 42 | +- `package`: Create platform-specific executable |
| 43 | +- `make`: Build platform-specific distributables |
| 44 | +- `test`: Run Jest and Playwright tests |
0 commit comments