From c8b9b4cd8f871e8da3943354c784a0c9c98e65ec Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Tue, 12 Mar 2024 16:31:16 +0530 Subject: [PATCH] Document better --- desktop/README.md | 36 ++++++++++++++++++++---------------- desktop/docs/dev.md | 4 ++++ desktop/package.json | 4 ++-- desktop/src/utils/main.ts | 4 ++++ 4 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 desktop/docs/dev.md diff --git a/desktop/README.md b/desktop/README.md index 9d637de04..e947e2a70 100644 --- a/desktop/README.md +++ b/desktop/README.md @@ -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 -``` diff --git a/desktop/docs/dev.md b/desktop/docs/dev.md new file mode 100644 index 000000000..4575188fd --- /dev/null +++ b/desktop/docs/dev.md @@ -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. diff --git a/desktop/package.json b/desktop/package.json index b3db86f73..a835b81c6 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -7,10 +7,10 @@ "main": "app/main.js", "scripts": { "build": "yarn build-renderer && yarn build-main", - "build-local": "yarn build-renderer && yarn build-main-local", "build-main": "tsc && electron-builder", - "build-main-local": "tsc && electron-builder --config.compression=store", + "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", diff --git a/desktop/src/utils/main.ts b/desktop/src/utils/main.ts index 21bb3b9e7..417e5cc48 100644 --- a/desktop/src/utils/main.ts +++ b/desktop/src/utils/main.ts @@ -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, {}); }