瀏覽代碼

Document better

Manav Rathi 1 年之前
父節點
當前提交
c8b9b4cd8f
共有 4 個文件被更改,包括 29 次插入17 次删除
  1. 19 15
      desktop/README.md
  2. 4 0
      desktop/docs/dev.md
  3. 2 2
      desktop/package.json
  4. 4 0
      desktop/src/utils/main.ts

+ 19 - 15
desktop/README.md

@@ -10,12 +10,6 @@ To know more about Ente, see [our main README](../README.md) or visit
 
 
 ## Building from source
 ## 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
 Fetch submodules
 
 
 ```sh
 ```sh
@@ -28,22 +22,32 @@ Install dependencies
 yarn install
 yarn install
 ```
 ```
 
 
-Run the app
+Create a binary for your platform
 
 
 ```sh
 ```sh
-yarn dev
+yarn build
 ```
 ```
 
 
-To recompile automatically using electron-reload, run this in a separate
-terminal:
+## Developing
 
 
-```bash
-yarn watch
+Instead of building, you can run the app in development mode
+
+```sh
+yarn dev
 ```
 ```
 
 
-`yarn dev` is handy during development, but if you wish, you can also create a
-binary for your platform by using
+> [!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:
 
 
 ```sh
 ```sh
-yarn build
+yarn watch
 ```
 ```

+ 4 - 0
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.

+ 2 - 2
desktop/package.json

@@ -7,10 +7,10 @@
     "main": "app/main.js",
     "main": "app/main.js",
     "scripts": {
     "scripts": {
         "build": "yarn build-renderer && yarn build-main",
         "build": "yarn build-renderer && yarn build-main",
-        "build-local": "yarn build-renderer && yarn build-main-local",
         "build-main": "tsc && electron-builder",
         "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-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": "concurrently \"yarn dev-main\" \"yarn dev-renderer\"",
         "dev-main": "tsc && electron build/app/main.js",
         "dev-main": "tsc && electron build/app/main.js",
         "dev-renderer": "cd ../web && yarn install && yarn dev:photos",
         "dev-renderer": "cd ../web && yarn install && yarn dev:photos",

+ 4 - 0
desktop/src/utils/main.ts

@@ -79,6 +79,10 @@ export async function setupMainMenu(mainWindow: BrowserWindow) {
 }
 }
 
 
 export function setupMainHotReload() {
 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) {
     if (isDev) {
         electronReload(__dirname, {});
         electronReload(__dirname, {});
     }
     }