[desktop] Fix desktop build (#1062)
`yarn dev` is still not working, but that is a previous issue unrelated to the monorepo migration. Will fix that in a subsequent PR.
9
desktop/.gitignore
vendored
|
@ -11,10 +11,11 @@ node_modules/
|
|||
.env
|
||||
.env.*.local
|
||||
|
||||
# Generated code during build
|
||||
# - tsc transpiles src/**/*.ts and emits the generated JS into build/app
|
||||
# - The out dir from the photos web app is symlinked to build/out
|
||||
build/
|
||||
# tsc transpiles src/**/*.ts and emits the generated JS into app
|
||||
app/
|
||||
|
||||
# out is a symlink to the photos web app's dir
|
||||
out
|
||||
|
||||
# electron-builder
|
||||
dist/
|
||||
|
|
|
@ -10,12 +10,6 @@ To know more about Ente, see [our main README](../README.md) or visit
|
|||
|
||||
## Building from source
|
||||
|
||||
> [!CAUTION]
|
||||
>
|
||||
> We moved a few things around when switching to a monorepo recently, and the
|
||||
> desktop app is not currently building with these instructions below. Hang
|
||||
> tight, we're on it, and will fix soon.
|
||||
|
||||
Fetch submodules
|
||||
|
||||
```sh
|
||||
|
@ -28,22 +22,32 @@ Install dependencies
|
|||
yarn install
|
||||
```
|
||||
|
||||
Run the app
|
||||
Create a binary for your platform
|
||||
|
||||
```sh
|
||||
yarn build
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
Instead of building, you can run the app in development mode
|
||||
|
||||
```sh
|
||||
yarn dev
|
||||
```
|
||||
|
||||
To recompile automatically using electron-reload, run this in a separate
|
||||
> [!CAUTION]
|
||||
>
|
||||
> `yarn dev` is currently not working (we'll fix soon). If you just want to
|
||||
> build from source and use the generated binary, use `yarn build` as described
|
||||
> above.
|
||||
|
||||
This'll launch a development server to serve the pages loaded by the renderer
|
||||
process, and will hot reload on changes.
|
||||
|
||||
If you also want hot reload for the main process, run this in a separate
|
||||
terminal:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
yarn watch
|
||||
```
|
||||
|
||||
`yarn dev` is handy during development, but if you wish, you can also create a
|
||||
binary for your platform by using
|
||||
|
||||
```sh
|
||||
yarn build
|
||||
```
|
||||
|
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 989 B After Width: | Height: | Size: 989 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 607 B |
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 259 B |
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
4
desktop/docs/dev.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Development tips
|
||||
|
||||
* `yarn build:quick` is a variant of `yarn build` that uses the
|
||||
`--config.compression=store` flag to (slightly) speed up electron-builder.
|
|
@ -4,14 +4,16 @@
|
|||
"private": true,
|
||||
"description": "Desktop client for Ente Photos",
|
||||
"author": "Ente <code@ente.io>",
|
||||
"main": "build/app/main.js",
|
||||
"main": "app/main.js",
|
||||
"scripts": {
|
||||
"build": "mkdir -p build && yarn build-renderer && yarn build-main",
|
||||
"build-main": "tsc && electron-builder --config.compression=store",
|
||||
"build-renderer": "cd ../web && yarn install && yarn build:photos && cd ../desktop/build && rm -f out && ln -sf ../../web/apps/photos/out",
|
||||
"build": "yarn build-renderer && yarn build-main",
|
||||
"build-main": "tsc && electron-builder",
|
||||
"build-main:quick": "tsc && electron-builder --config.compression=store",
|
||||
"build-renderer": "cd ../web && yarn install && yarn build:photos && cd ../desktop && rm -f out && ln -sf ../web/apps/photos/out",
|
||||
"build:quick": "yarn build-renderer && yarn build-main:quick",
|
||||
"dev": "concurrently \"yarn dev-main\" \"yarn dev-renderer\"",
|
||||
"dev-main": "tsc && electron build/app/main.js",
|
||||
"dev-renderer": "cd ../web && yarn install && yarn dev:photos && cd ../desktop/build && rm -f out && ln -sf ../../web/apps/photos/out",
|
||||
"dev-renderer": "cd ../web && yarn install && yarn dev:photos",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"lint": "yarn prettier --check . && eslint \"src/**/*.ts\"",
|
||||
"lint-fix": "yarn prettier --write . && eslint --fix .",
|
||||
|
@ -110,26 +112,20 @@
|
|||
"x64ArchFiles": "Contents/Resources/ggmlclip-mac"
|
||||
},
|
||||
"afterSign": "electron-builder-notarize",
|
||||
"extraFiles": [
|
||||
{
|
||||
"from": "resources",
|
||||
"to": "resources",
|
||||
"filter": [
|
||||
"**/*"
|
||||
]
|
||||
}
|
||||
],
|
||||
"asarUnpack": [
|
||||
"node_modules/ffmpeg-static/bin/${os}/${arch}/ffmpeg",
|
||||
"node_modules/ffmpeg-static/index.js",
|
||||
"node_modules/ffmpeg-static/package.json"
|
||||
],
|
||||
"files": [
|
||||
"build/app/**/*",
|
||||
"extraFiles": [
|
||||
{
|
||||
"from": "build/out",
|
||||
"to": "out"
|
||||
"from": "build",
|
||||
"to": "resources"
|
||||
}
|
||||
],
|
||||
"files": [
|
||||
"app/**/*",
|
||||
"out"
|
||||
]
|
||||
},
|
||||
"productName": "ente",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { app, BrowserWindow, nativeImage } from "electron";
|
||||
import ElectronLog from "electron-log";
|
||||
import * as path from "path";
|
||||
import { PROD_HOST_URL } from "../config";
|
||||
import { isAppQuitting } from "../main";
|
||||
import autoLauncher from "../services/autoLauncher";
|
||||
import { logErrorSentry } from "../services/sentry";
|
||||
import { getHideDockIconPreference } from "../services/userPreference";
|
||||
import { isDev } from "./common";
|
||||
import { isPlatform } from "./common/platform";
|
||||
import { PROD_HOST_URL } from "./main";
|
||||
|
||||
export async function createWindow(): Promise<BrowserWindow> {
|
||||
const appImgPath = isDev
|
||||
|
|
|
@ -14,7 +14,7 @@ import { isPlatform } from "./common/platform";
|
|||
import { buildContextMenu, buildMenuBar } from "./menu";
|
||||
const execAsync = util.promisify(require("child_process").exec);
|
||||
|
||||
const PROD_HOST_URL: string = "ente://app";
|
||||
export const PROD_HOST_URL: string = "ente://app";
|
||||
const RENDERER_OUTPUT_DIR: string = "./out";
|
||||
|
||||
export async function handleUpdates(mainWindow: BrowserWindow) {
|
||||
|
@ -79,6 +79,10 @@ export async function setupMainMenu(mainWindow: BrowserWindow) {
|
|||
}
|
||||
|
||||
export function setupMainHotReload() {
|
||||
// Hot reload the main process if anything changes in the source directory
|
||||
// that we're running from. In particular, this gets triggered when `yarn
|
||||
// watch` rebuilds JS files in the `app/` directory when we change the TS
|
||||
// files in the `src/` directory.
|
||||
if (isDev) {
|
||||
electronReload(__dirname, {});
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"target": "es2021",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
/* Emit the generated JS into build/app */
|
||||
"outDir": "build/app",
|
||||
/* Emit the generated JS into app */
|
||||
"outDir": "app",
|
||||
"noImplicitAny": true,
|
||||
"sourceMap": true,
|
||||
"baseUrl": "src",
|
||||
|
|