mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
feat(nx/desktop): get electron to start on NixOS
This commit is contained in:
parent
f0c735e4fc
commit
e94d8b5b47
@ -59,7 +59,7 @@
|
|||||||
"cwd": "{projectRoot}"
|
"cwd": "{projectRoot}"
|
||||||
},
|
},
|
||||||
"nixos": {
|
"nixos": {
|
||||||
"command": "electron-rebuild -f -v $(nix-shell -p electron_35 --run \"electron --version\") dist/main.js -m dist",
|
"command": "cross-env DEBUG=* tsx scripts/rebuild.mts $(nix-shell -p electron_33 --run \"electron --version\")",
|
||||||
"cwd": "{projectRoot}"
|
"cwd": "{projectRoot}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@
|
|||||||
"cwd": "{projectRoot}/dist"
|
"cwd": "{projectRoot}/dist"
|
||||||
},
|
},
|
||||||
"nixos": {
|
"nixos": {
|
||||||
"command": "nix-shell -p electron_35 --run \"electron {projectRoot}/dist/main.js\"",
|
"command": "nix-shell -p electron_33 --run \"electron {projectRoot}/dist/main.js\"",
|
||||||
"cwd": ".",
|
"cwd": ".",
|
||||||
"forwardAllArgs": false
|
"forwardAllArgs": false
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,10 @@ const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|||||||
const rootDir = join(scriptDir, "..");
|
const rootDir = join(scriptDir, "..");
|
||||||
|
|
||||||
function getElectronVersion() {
|
function getElectronVersion() {
|
||||||
|
if (process.argv[2]) {
|
||||||
|
return process.argv[2];
|
||||||
|
}
|
||||||
|
|
||||||
const packageJsonPath = join(rootDir, "package.json");
|
const packageJsonPath = join(rootDir, "package.json");
|
||||||
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
||||||
return packageJson.devDependencies.electron;
|
return packageJson.devDependencies.electron;
|
||||||
@ -22,13 +26,16 @@ function getElectronVersion() {
|
|||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
const distDir = join(rootDir, "dist");
|
const distDir = join(rootDir, "dist");
|
||||||
|
const electronVersion = getElectronVersion();
|
||||||
|
|
||||||
|
console.log(`Rebuilding with version ${electronVersion}...`);
|
||||||
|
|
||||||
rebuild({
|
rebuild({
|
||||||
// We force the project root path to avoid electron-rebuild from rebuilding the monorepo-level dependency and breaking the server.
|
// We force the project root path to avoid electron-rebuild from rebuilding the monorepo-level dependency and breaking the server.
|
||||||
projectRootPath: distDir,
|
projectRootPath: distDir,
|
||||||
buildPath: distDir,
|
buildPath: distDir,
|
||||||
force: true,
|
force: true,
|
||||||
electronVersion: getElectronVersion(),
|
electronVersion,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user