This repository was archived by the owner on Jun 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +45
-10
lines changed Expand file tree Collapse file tree 2 files changed +45
-10
lines changed Original file line number Diff line number Diff line change 1414 "nx" : {
1515 "name" : " edit-docs" ,
1616 "targets" : {
17- "postbuild " : {
17+ "rebuild-deps " : {
1818 "executor" : " nx:run-commands" ,
19- "dependsOn" : [
20- " build"
21- ],
19+ "dependsOn" : [ " build" ],
2220 "defaultConfiguration" : " default" ,
2321 "cache" : true ,
2422 "configurations" : {
2523 "default" : {
26- "command" : " electron- rebuild" ,
27- "cwd" : " {projectRoot}/dist "
24+ "command" : " cross-env DEBUG=* tsx scripts/ rebuild.ts " ,
25+ "cwd" : " {projectRoot}"
2826 },
2927 "nixos" : {
30- "command" : " electron-rebuild -v $(nix-shell -p electron_35 --run \" electron --version\" )" ,
31- "cwd" : " {projectRoot}/dist "
28+ "command" : " electron-rebuild -f - v $(nix-shell -p electron_35 --run \" electron --version\" ) dist/main.js -m dist " ,
29+ "cwd" : " {projectRoot}"
3230 }
33- }
31+ }
3432 },
3533 "serve" : {
3634 "executor" : " nx:run-commands" ,
3735 "dependsOn" : [
38- " postbuild "
36+ " rebuild-deps "
3937 ],
4038 "defaultConfiguration" : " default" ,
4139 "configurations" : {
Original file line number Diff line number Diff line change 1+ /**
2+ * @module
3+ *
4+ * This script is used internally by the `rebuild-deps` target of the `desktop`. Normally we could use
5+ * `electron-rebuild` CLI directly, but it would rebuild the monorepo-level dependencies and breaks
6+ * the server build (and it doesn't expose a CLI option to override this).
7+ */
8+
9+ // TODO: Deduplicate with apps/desktop/scripts/rebuild.ts.
10+
11+ import { fileURLToPath } from "url" ;
12+ import { dirname , join } from "path" ;
13+ import rebuild from "@electron/rebuild"
14+ import { readFileSync } from "fs" ;
15+
16+ const scriptDir = dirname ( fileURLToPath ( import . meta. url ) ) ;
17+ const rootDir = join ( scriptDir , ".." ) ;
18+
19+ function getElectronVersion ( ) {
20+ const packageJsonPath = join ( rootDir , "package.json" ) ;
21+ const packageJson = JSON . parse ( readFileSync ( packageJsonPath , "utf-8" ) ) ;
22+ return packageJson . devDependencies . electron ;
23+ }
24+
25+ function main ( ) {
26+ const distDir = join ( rootDir , "dist" ) ;
27+
28+ rebuild ( {
29+ // We force the project root path to avoid electron-rebuild from rebuilding the monorepo-level dependency and breaking the server.
30+ projectRootPath : distDir ,
31+ buildPath : distDir ,
32+ force : true ,
33+ electronVersion : getElectronVersion ( ) ,
34+ } ) ;
35+ }
36+
37+ main ( ) ;
You can’t perform that action at this time.
0 commit comments