Add electron-builder packaging configuration
- Install electron-builder as dev dependency - Configure build targets for macOS (dmg, zip), Windows (nsis, zip), and Linux (AppImage, deb) - Add npm scripts for building unpacked app (dist:dir) and macOS packages (dist:mac) - Set base path to "./" in production builds for proper asset loading in packaged app - Fix index.html asset paths to use relative paths (./ prefix) - Update README to document packaging commands and note unsigned/unnotarized status
This commit is contained in:
16
README.md
16
README.md
@@ -58,6 +58,8 @@ npm run dev:renderer # Vite frontend only
|
|||||||
npm run dev:electron # Electron only, expects renderer on port 1420
|
npm run dev:electron # Electron only, expects renderer on port 1420
|
||||||
npm run build # TypeScript + Vite production build
|
npm run build # TypeScript + Vite production build
|
||||||
npm run desktop # Run Electron against the built dist/
|
npm run desktop # Run Electron against the built dist/
|
||||||
|
npm run dist:dir # Build an unpacked Electron app in release/
|
||||||
|
npm run dist:mac # Build macOS .dmg and .zip packages in release/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Production-Like Local Run
|
## Production-Like Local Run
|
||||||
@@ -119,16 +121,18 @@ Current limitation:
|
|||||||
|
|
||||||
That is convenient for development, but it is not the right long-term storage mechanism for a production desktop app. A future improvement should move credentials into the OS keychain or another secure secret store.
|
That is convenient for development, but it is not the right long-term storage mechanism for a production desktop app. A future improvement should move credentials into the OS keychain or another secure secret store.
|
||||||
|
|
||||||
## Packaging Status
|
## Packaging
|
||||||
|
|
||||||
Electron packaging for release builds is not set up yet.
|
Electron packaging is set up with `electron-builder`.
|
||||||
|
|
||||||
Right now, the repository supports:
|
Current packaging commands:
|
||||||
|
|
||||||
- local development with `npm run dev:desktop`
|
- `npm run dist:dir` creates an unpacked app bundle in `release/`
|
||||||
- local production-style execution with `npm run build && npm run desktop`
|
- `npm run dist:mac` creates macOS `.dmg` and `.zip` artifacts in `release/`
|
||||||
|
|
||||||
If you want distributable `.dmg`, `.AppImage`, `.deb`, or `.exe` artifacts, the next step is to add an Electron packaging tool such as Electron Forge or electron-builder.
|
The current mac build is unsigned and not notarized, which is fine for local use and testing but not enough for friction-free public distribution through Gatekeeper.
|
||||||
|
|
||||||
|
Windows and Linux targets are also configured in `package.json`, but they have not been validated in this repository yet.
|
||||||
|
|
||||||
## Legacy Tauri Script
|
## Legacy Tauri Script
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="./vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta
|
<meta
|
||||||
http-equiv="Content-Security-Policy"
|
http-equiv="Content-Security-Policy"
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
/>
|
/>
|
||||||
<title>Nextcloud Notes</title>
|
<title>Nextcloud Notes</title>
|
||||||
<!-- Local fonts for offline support -->
|
<!-- Local fonts for offline support -->
|
||||||
<link rel="stylesheet" href="/fonts/fonts.css">
|
<link rel="stylesheet" href="./fonts/fonts.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="./src/main.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
3435
package-lock.json
generated
3435
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
40
package.json
40
package.json
@@ -2,6 +2,7 @@
|
|||||||
"name": "nextcloud-notes-tauri",
|
"name": "nextcloud-notes-tauri",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.2.2",
|
"version": "0.2.2",
|
||||||
|
"description": "Desktop client for Nextcloud Notes built with Electron, React, and TypeScript.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "electron/main.cjs",
|
"main": "electron/main.cjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -11,6 +12,8 @@
|
|||||||
"dev:desktop": "concurrently -k \"npm:dev:renderer\" \"npm:dev:electron\"",
|
"dev:desktop": "concurrently -k \"npm:dev:renderer\" \"npm:dev:electron\"",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
"desktop": "electron .",
|
"desktop": "electron .",
|
||||||
|
"dist:dir": "npm run build && electron-builder --dir",
|
||||||
|
"dist:mac": "npm run build && electron-builder --mac dmg zip",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"tauri": "tauri"
|
"tauri": "tauri"
|
||||||
},
|
},
|
||||||
@@ -42,10 +45,47 @@
|
|||||||
"concurrently": "^9.2.1",
|
"concurrently": "^9.2.1",
|
||||||
"cross-env": "^10.1.0",
|
"cross-env": "^10.1.0",
|
||||||
"electron": "^37.3.1",
|
"electron": "^37.3.1",
|
||||||
|
"electron-builder": "^26.8.1",
|
||||||
"postcss": "^8.5.8",
|
"postcss": "^8.5.8",
|
||||||
"tailwindcss": "^3.4.19",
|
"tailwindcss": "^3.4.19",
|
||||||
"typescript": "~5.8.3",
|
"typescript": "~5.8.3",
|
||||||
"vite": "^7.0.4",
|
"vite": "^7.0.4",
|
||||||
"wait-on": "^8.0.5"
|
"wait-on": "^8.0.5"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"appId": "cz.davidrelich.nextcloud-notes-desktop",
|
||||||
|
"productName": "Nextcloud Notes Desktop",
|
||||||
|
"directories": {
|
||||||
|
"output": "release"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist/**/*",
|
||||||
|
"electron/**/*",
|
||||||
|
"package.json"
|
||||||
|
],
|
||||||
|
"asar": true,
|
||||||
|
"npmRebuild": false,
|
||||||
|
"mac": {
|
||||||
|
"category": "public.app-category.productivity",
|
||||||
|
"icon": "src-tauri/icons/icon.icns",
|
||||||
|
"target": [
|
||||||
|
"dmg",
|
||||||
|
"zip"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"win": {
|
||||||
|
"icon": "src-tauri/icons/icon.ico",
|
||||||
|
"target": [
|
||||||
|
"nsis",
|
||||||
|
"zip"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"icon": "src-tauri/icons/icon.png",
|
||||||
|
"target": [
|
||||||
|
"AppImage",
|
||||||
|
"deb"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import react from "@vitejs/plugin-react";
|
|||||||
const host = process.env.TAURI_DEV_HOST;
|
const host = process.env.TAURI_DEV_HOST;
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig(async () => ({
|
export default defineConfig(async ({ command }) => ({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
|
base: command === "build" ? "./" : "/",
|
||||||
|
|
||||||
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user