nuxt-electron
Advanced tools
Comparing version 0.4.1 to 0.4.2
import { type Configuration } from 'vite-electron-plugin'; | ||
import { NuxtModule } from '@nuxt/schema'; | ||
export interface ElectronOptions extends Partial<Configuration> { | ||
/** | ||
* @see https://github.com/electron-vite/vite-plugin-electron-renderer | ||
*/ | ||
renderer?: Parameters<typeof import('vite-plugin-electron-renderer').default>[0]; | ||
} | ||
declare const _default: NuxtModule<ElectronOptions>; | ||
export default _default; |
{ | ||
"name": "nuxt-electron", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Nuxt Integration with Electron", | ||
@@ -12,2 +12,7 @@ "main": "./dist/index.cjs", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"./*": { | ||
"types": "./dist/*.d.ts", | ||
"import": "./dist/*.mjs", | ||
"require": "./dist/*.cjs" | ||
} | ||
@@ -29,4 +34,13 @@ }, | ||
"esbuild": "*", | ||
"vite-electron-plugin": "*" | ||
"vite-electron-plugin": "*", | ||
"vite-plugin-electron-renderer": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"esbuild": { | ||
"optional": true | ||
}, | ||
"vite-plugin-electron-renderer": { | ||
"optional": true | ||
} | ||
}, | ||
"devDependencies": { | ||
@@ -38,3 +52,4 @@ "@types/node": "^18.13.0", | ||
"vite": "^4.1.1", | ||
"vite-electron-plugin": "^0.7.4" | ||
"vite-electron-plugin": "^0.7.4", | ||
"vite-plugin-electron-renderer": "^0.12.1" | ||
}, | ||
@@ -41,0 +56,0 @@ "files": [ |
110
README.md
@@ -5,21 +5,13 @@ <p align="center"> | ||
<div align="center"> | ||
<h1>Nuxt Electron</h1> | ||
</div> | ||
<p align="center">Integrate Nuxt and Electron</p> | ||
<p align="center"> | ||
<a href="https://npmjs.org/package/nuxt-electron"> | ||
<img src="https://img.shields.io/npm/v/nuxt-electron.svg?colorA=18181B&colorB=28CF8D"> | ||
</a> | ||
<a href="https://npmjs.org/package/nuxt-electron"> | ||
<img src="https://img.shields.io/npm/dm/nuxt-electron.svg?colorA=18181B&colorB=28CF8D"> | ||
</a> | ||
<img src="https://camo.githubusercontent.com/1355d11db24d82f2b23bbe4957178a05c7d5ca0948ddfc9eec38f5a6864fe4e5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e7578742f6e7578742e7376673f7374796c653d666c617426636f6c6f72413d31383138314226636f6c6f72423d323843463844"> | ||
</p> | ||
# Nuxt Electron | ||
<br/> | ||
[![npm version][npm-version-src]][npm-version-href] | ||
[![npm downloads][npm-downloads-src]][npm-downloads-href] | ||
[![License][license-src]][license-href] | ||
> Integrate Nuxt and Electron | ||
## Features | ||
- 🚀 High-performance (Not Bundle, based on esbuild) | ||
- 🚀 High-performance <sub><sup>(Not Bundle, based on esbuild)</sup></sub> | ||
- 📦 Out of the box | ||
@@ -34,9 +26,9 @@ - 🔥 Hot restart | ||
# Using pnpm | ||
pnpm add -D nuxt-electron vite-electron-plugin electron electron-builder | ||
pnpm add -D nuxt-electron vite-electron-plugin vite-plugin-electron-renderer electron electron-builder | ||
# Using yarn | ||
yarn add --dev nuxt-electron vite-electron-plugin electron electron-builder | ||
yarn add --dev nuxt-electron vite-electron-plugin vite-plugin-electron-renderer electron electron-builder | ||
# Using npm | ||
npm install --save-dev nuxt-electron vite-electron-plugin electron electron-builder | ||
npm install --save-dev nuxt-electron vite-electron-plugin vite-plugin-electron-renderer electron electron-builder | ||
``` | ||
@@ -54,28 +46,27 @@ | ||
That's it! You can now use Electron in your Nuxt app ✨ | ||
3. Create the `electron/main.ts` file and type the following code | ||
## Recommend structure | ||
```ts | ||
import { app, BrowserWindow } from 'electron' | ||
Let's use the official [nuxt-starter-v3](https://codeload.github.com/nuxt/starter/tar.gz/refs/heads/v3) template as an example | ||
app.whenReady().then(() => { | ||
new BrowserWindow().loadURL(process.env.VITE_DEV_SERVER_URL) | ||
}) | ||
``` | ||
4. Add the `main` entry to `package.json` | ||
```diff | ||
+ ├─┬ electron | ||
+ │ └── main.ts | ||
├─┬ public | ||
│ └── favicon.ico | ||
├── .gitignore | ||
├── .npmrc | ||
├── index.html | ||
├── app.vue | ||
├── nuxt.config.ts | ||
├── package.json | ||
├── README.md | ||
└── tsconfig.json | ||
{ | ||
+ "main": "dist-electron/main.js" | ||
} | ||
``` | ||
## Electron options | ||
That's it! You can now use Electron in your Nuxt app ✨ | ||
## Electron Options | ||
> 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 | ||
Here is the default `electron` options | ||
@@ -85,3 +76,3 @@ ```ts | ||
modules: [ | ||
'nuxt-electron' | ||
'nuxt-electron', | ||
], | ||
@@ -95,4 +86,39 @@ electron: { | ||
## Examples | ||
Use Node.js in Renderer process | ||
```ts | ||
export default defineNuxtConfig({ | ||
modules: [ | ||
'nuxt-electron', | ||
], | ||
electron: { | ||
/** | ||
* @see https://github.com/electron-vite/vite-plugin-electron-renderer | ||
*/ | ||
renderer: {}, | ||
}, | ||
}) | ||
``` | ||
## 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 | ||
``` | ||
## [Examples](https://github.com/caoxiemeihao/nuxt-electron/tree/main/examples) | ||
- [quick-start](https://github.com/caoxiemeihao/nuxt-electron/tree/main/examples/quick-start) | ||
@@ -103,1 +129,11 @@ - [nuxt-electron-trpc-prisma](https://github.com/gurvancampion/nuxt-electron-trpc-prisma) | ||
By default, we force the App to run in SPA mode since we don't need SSR for desktop apps | ||
<!-- Badges --> | ||
[npm-version-src]: https://img.shields.io/npm/v/nuxt-electron/latest.svg?style=flat&colorA=18181B&colorB=28CF8D | ||
[npm-version-href]: https://npmjs.com/package/nuxt-electron | ||
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-electron.svg?style=flat&colorA=18181B&colorB=28CF8D | ||
[npm-downloads-href]: https://npmjs.com/package/nuxt-electron | ||
[license-src]: https://img.shields.io/npm/l/nuxt-electron.svg?style=flat&colorA=18181B&colorB=28CF8D | ||
[license-href]: https://npmjs.com/package/nuxt-electron |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14611
11
196
134
0
3
7