Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/crossevol/electron-react-vite-starter
https://github.com/crossevol/electron-react-vite-starter
electron hono mui vite
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/crossevol/electron-react-vite-starter
- Owner: CrossEvol
- License: mit
- Created: 2023-08-08T16:24:24.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-08-22T04:46:53.000Z (5 months ago)
- Last Synced: 2024-08-22T05:34:01.917Z (5 months ago)
- Topics: electron, hono, mui, vite
- Language: TypeScript
- Homepage:
- Size: 1.04 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## What
the project structure is decided by [electron-vite-react](https://github.com/electron-vite/electron-vite-react)
use the [block-note](https://github.com/TypeCellOS/BlockNote) as the rich-text-editor.
use the [drizzle-orm](https://orm.drizzle.team/) to interact with the sqlite
can run the [hono-server](https://hono.dev/docs/) in the service_workers(the author is too lazy to migrate)## Getting Started
### Install
Install dependencies.
```bash
npm install
```before run , should initialize the drizzle-orm
```bash
npm run generate
npm run migrate
npm run rebuild
```should rebuild better-sqlite3 before run app,
if you want to restore the better-sqlite3, run `npm run reset````bash
npm run dev
```### Lint
```bash
npm run lint
```### Build
```bash
npm run build
```### Test
```bash
npm run test
```View and interact with your tests via UI.
```bash
npm run test:ui
```## References
[integrate-hono-with-openapi](https://dev.to/bimaadi/integrate-hono-with-openapiswagger-3dem)
[create-a-monorepo-using-pnpm-workspace](https://dev.to/vinomanick/create-a-monorepo-using-pnpm-workspace-1ebn)
[managing-full-stack-monorepo-pnpm](https://blog.logrocket.com/managing-full-stack-monorepo-pnpm/#create-root-project)
[pnpm-workspace-examples](https://github.com/ashleydavis/pnpm-workspace-examples)## Q & A
### pnpm workspace
rename the `pnpm-workspace.yaml.example` to `pnpm-workspace.yaml`
in `package.json` ,
rewrite `"reset": "rm -rf ./node_modules/better-sqlite3 && npm install better-sqlite3",`
to `"reset": "rm -rf ./node_modules/better-sqlite3 && rm -rf ./node_modules/.pnpm/[email protected] && pnpm install -w better-sqlite3",`
then you can use `pnpm --filter ${sub-app-name}` to control them in root### run in service_worker
`vite.config.ts`
```ts
build: {
sourcemap,
minify: isBuild,
outDir: 'dist-electron/main',
rollupOptions: {
external: Object.keys(
'dependencies' in pkg
? pkg.dependencies
: {}
),
input: {
index: 'electron/main/index.ts',
'worker':
'electron/main/worker.ts',
}
},
},
````run-worker`
```ts
import path from 'node:path'
import { Worker } from 'node:worker_threads'export const startScheduleWorker = () => {
const worker = new Worker(path.resolve(__dirname, 'worker.js'))worker.on('message', (message) => {})
worker.on('error', (err) => {
console.error('Worker thread error:', err)
})
worker.on('exit', (code) => {
if (code !== 0) console.error(`Worker stopped with exit code ${code}`)
})
}
```