Skip to content

Commit

Permalink
Merge pull request #7 from caoxiemeihao/v0.4.0
Browse files Browse the repository at this point in the history
V0.4.0
  • Loading branch information
caoxiemeihao authored Feb 15, 2023
2 parents 608df09 + 3b26472 commit 149337e
Show file tree
Hide file tree
Showing 6 changed files with 1,986 additions and 259 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.4.0 (2023-02-15)

#### Main Changed

- a48a15a feat: add `meta`, better default `options`

## 0.3.1 (2023-01-01)

- 9c845f2 fix: correct `baseURL`
Expand Down
58 changes: 49 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# nuxt-electron
# Nuxt Electron

Integrate Nuxt and Electron

Expand All @@ -7,20 +7,56 @@ Integrate Nuxt and Electron

![screenshort.png](https://github.com/caoxiemeihao/nuxt-electron/blob/main/screenshot.png?raw=true)

## Install
## Features

- 🚀 High-performance (Not Bundle, based on esbuild)
- 📦 Out of the box
- 🔥 Hot restart

## Quick Setup

1. Add the following dependency to your project

```sh
npm i -D nuxt-electron vite-electron-plugin electron electron-builder
```

## Examples
2. Add `nuxt-electron` to the modules section of `nuxt.config.ts`

- [quick-start](https://github.com/caoxiemeihao/nuxt-electron/tree/main/examples/quick-start)
- [nuxt-electron-trpc-prisma](https://github.com/gurvancampion/nuxt-electron-trpc-prisma)
```ts
export default defineNuxtConfig({
modules: [
['nuxt-electron'],
],
})
```

That's it! You can now use Electron in your Nuxt app ✨

## Recommend structure

Let's use the official [nuxt-starter-v3](https://codeload.github.com/nuxt/starter/tar.gz/refs/heads/v3) template as an example

```diff
+ ├─┬ electron
+ │ └── main.ts
├─┬ public
│ └── favicon.ico
├── .gitignore
├── .npmrc
├── index.html
├── app.vue
├── nuxt.config.ts
├── package.json
├── README.md
└── tsconfig.json
```

## Usage
## ElectronOptions

nuxt.config.ts
> This is based on the `vite-electron-plugin`, see the **[Documents](https://github.com/electron-vite/vite-electron-plugin#configuration)** for more detailed options
Here is the default `nuxt-electron` options

```ts
import type { ElectronOptions } from 'nuxt-electron'
Expand All @@ -29,12 +65,16 @@ export default defineNuxtConfig({
modules: [
['nuxt-electron', <ElectronOptions>{
include: ['electron'],
outDir: 'dist-electron',
}],
],
})
```

This is based on the `vite-electron-plugin` package, see the **[Documents](https://github.com/electron-vite/vite-electron-plugin#configuration)** for more detailed configuration information.
## Examples

- [quick-start](https://github.com/caoxiemeihao/nuxt-electron/tree/main/examples/quick-start)
- [nuxt-electron-trpc-prisma](https://github.com/gurvancampion/nuxt-electron-trpc-prisma)

## Notes
By default, we force the App to run in SPA mode since we don't need SSR for desktop apps.
By default, we force the App to run in SPA mode since we don't need SSR for desktop apps
4 changes: 1 addition & 3 deletions examples/quick-start/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import type { ElectronOptions } from 'nuxt-electron'

export default defineNuxtConfig({
modules: [
['nuxt-electron', <ElectronOptions>{
include: ['electron'],
}],
['nuxt-electron', <ElectronOptions>{}],
],
})
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-electron",
"version": "0.3.1",
"version": "0.4.0",
"description": "Nuxt Integration with Electron",
"main": "index.mjs",
"types": "types",
Expand All @@ -27,12 +27,12 @@
"vite-electron-plugin": "*"
},
"devDependencies": {
"@types/node": "^18.11.18",
"esbuild": "^0.16.12",
"nuxt": "^3.0.0",
"typescript": "^4.9.4",
"vite": "^4.0.3",
"vite-electron-plugin": "^0.7.1"
"@types/node": "^18.13.0",
"esbuild": "^0.17.8",
"nuxt": "^3.2.0",
"typescript": "^4.9.5",
"vite": "^4.1.1",
"vite-electron-plugin": "^0.7.4"
},
"files": [
"electron-env.d.ts",
Expand Down
Loading

0 comments on commit 149337e

Please sign in to comment.