浏览代码

Move out the electron-builder config to separate file

Manav Rathi 1 年之前
父节点
当前提交
e4684b22df
共有 5 个文件被更改,包括 77 次插入73 次删除
  1. 22 0
      desktop/docs/dependencies.md
  2. 2 2
      desktop/docs/dev.md
  3. 43 0
      desktop/electron-builder.yml
  4. 0 68
      desktop/package.json
  5. 10 3
      web/docs/dependencies.md

+ 22 - 0
desktop/docs/dependencies.md

@@ -32,8 +32,30 @@ There is also a third environment that gets temporarily created:
 [Electron Builder](https://www.electron.build) is used for packaging the app for
 distribution.
 
+During the build it uses
+[electron-builder-notarize](https://github.com/karaggeorge/electron-builder-notarize)
+to notarize the macOS binary.
+
 ### next-electron-server
 
 This spins up a server for serving files using a protocol handler inside our
 Electron process. This allows us to directly use the output produced by
 `next build` for loading into our renderer process.
+
+### electron-reload
+
+Reloads contents of the BrowserWindow (renderer process) when source files are
+changed.
+
+* TODO (MR): Do we need this? Isn't the next-electron-server HMR covering this?
+
+## DX
+
+See [web/docs/dependencies#DX](../../web/docs/dependencies.md#dx) for the
+general development experience related dependencies like TypeScript etc, which
+are similar to that in the web code.
+
+Some extra ones specific to the code here are:
+
+* [concurrently](https://github.com/open-cli-tools/concurrently) for spawning
+  parallel tasks when we do `yarn dev`.

+ 2 - 2
desktop/docs/dev.md

@@ -26,7 +26,7 @@ During development, you might find `yarn build:quick` helpful. It is a variant
 of `yarn build` that omits some steps to build a binary quicker, something that
 can be useful during development.
 
-## postinstall
+### postinstall
 
 When using native node modules (those written in C/C++), we need to ensure they
 are built against `electron`'s packaged `node` version. We use
@@ -34,7 +34,7 @@ are built against `electron`'s packaged `node` version. We use
 to rebuild those modules automatically after each `yarn install` by invoking it
 in as the `postinstall` step in our package.json.
 
-## lint and lint-fix
+### lint and lint-fix
 
 Use `yarn lint` to check that your code formatting is as expected, and that
 there are no linter errors. Use `yarn lint-fix` to try and automatically fix the

+ 43 - 0
desktop/electron-builder.yml

@@ -0,0 +1,43 @@
+appId: io.ente.bhari-frame
+artifactName: ${productName}-${version}-${arch}.${ext}
+nsis:
+    deleteAppDataOnUninstall: true
+linux:
+    target:
+        - target: AppImage
+          arch:
+              - x64
+              - arm64
+        - target: deb
+          arch:
+              - x64
+              - arm64
+        - target: rpm
+          arch:
+              - x64
+              - arm64
+        - target: pacman
+          arch:
+              - x64
+              - arm64
+    icon: ./resources/icon.icns
+    category: Photography
+mac:
+    target:
+        target: default
+        arch:
+            - universal
+    category: public.app-category.photography
+    hardenedRuntime: true
+    x64ArchFiles: Contents/Resources/ggmlclip-mac
+afterSign: electron-builder-notarize
+asarUnpack:
+    - node_modules/ffmpeg-static/bin/${os}/${arch}/ffmpeg
+    - node_modules/ffmpeg-static/index.js
+    - node_modules/ffmpeg-static/package.json
+extraFiles:
+    - from: build
+      to: resources
+files:
+    - app/**/*
+    - out

+ 0 - 68
desktop/package.json

@@ -56,73 +56,5 @@
         "prettier-plugin-packagejson": "^2.4",
         "typescript": "^5"
     },
-    "build": {
-        "appId": "io.ente.bhari-frame",
-        "artifactName": "${productName}-${version}-${arch}.${ext}",
-        "nsis": {
-            "deleteAppDataOnUninstall": true
-        },
-        "linux": {
-            "target": [
-                {
-                    "target": "AppImage",
-                    "arch": [
-                        "x64",
-                        "arm64"
-                    ]
-                },
-                {
-                    "target": "deb",
-                    "arch": [
-                        "x64",
-                        "arm64"
-                    ]
-                },
-                {
-                    "target": "rpm",
-                    "arch": [
-                        "x64",
-                        "arm64"
-                    ]
-                },
-                {
-                    "target": "pacman",
-                    "arch": [
-                        "x64",
-                        "arm64"
-                    ]
-                }
-            ],
-            "icon": "./resources/icon.icns",
-            "category": "Photography"
-        },
-        "mac": {
-            "target": {
-                "target": "default",
-                "arch": [
-                    "universal"
-                ]
-            },
-            "category": "public.app-category.photography",
-            "hardenedRuntime": true,
-            "x64ArchFiles": "Contents/Resources/ggmlclip-mac"
-        },
-        "afterSign": "electron-builder-notarize",
-        "asarUnpack": [
-            "node_modules/ffmpeg-static/bin/${os}/${arch}/ffmpeg",
-            "node_modules/ffmpeg-static/index.js",
-            "node_modules/ffmpeg-static/package.json"
-        ],
-        "extraFiles": [
-            {
-                "from": "build",
-                "to": "resources"
-            }
-        ],
-        "files": [
-            "app/**/*",
-            "out"
-        ]
-    },
     "productName": "ente"
 }

+ 10 - 3
web/docs/dependencies.md

@@ -1,18 +1,25 @@
 # Dependencies
 
-## Global
+## DX
 
 These are some global dev dependencies in the root `package.json`. These set the
-baseline for how our code be in all the workspaces in the monorepo.
+baseline for how our code be in all the workspaces in this (yarn) monorepo.
 
 * "prettier" - Formatter
 * "eslint" - Linter
 * "typescript" - Type checker
 
-They also need some support packages:
+They also need some support packages, which come from the leaf `@/build-config`
+package:
 
 * "@typescript-eslint/parser" - Tells ESLint how to read TypeScript syntax
 * "@typescript-eslint/eslint-plugin" - Provides TypeScript rules and presets
+* "eslint-plugin-react-hooks", "eslint-plugin-react-namespace-import" - Some
+  React specific ESLint rules and configurations that are used by the workspaces
+  that have React code.
+* "prettier-plugin-organize-imports" - A Prettier plugin to sort imports.
+* "prettier-plugin-packagejson" - A Prettier plugin to also prettify
+  `package.json`.
 
 ## Utils