Skip to content

Commit a937418

Browse files
committed
fix(scripts): electron not rebuilding edit-docs
1 parent 14896fe commit a937418

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/electron-rebuild.mts

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* the server build (and it doesn't expose a CLI option to override this).
77
*/
88

9-
import path, { join } from "path";
9+
import { join, resolve } from "path";
1010
import { rebuild } from "@electron/rebuild"
1111
import { readFileSync } from "fs";
1212

@@ -18,13 +18,17 @@ function getElectronVersion(distDir: string) {
1818
const packageJsonPath = join(distDir, "package.json");
1919
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
2020

21-
const electronVersion = packageJson.devDependencies.electron || packageJson.dependencies.electron;
21+
const electronVersion = packageJson?.devDependencies?.electron ?? packageJson?.dependencies?.electron;
22+
if (!electronVersion) {
23+
console.error(`Unable to retrieve Electron version in '${resolve(packageJsonPath)}'.`);
24+
process.exit(3);
25+
}
2226

2327
return electronVersion;
2428
}
2529

2630
function main() {
27-
const distDir = path.resolve(process.argv[2]);
31+
const distDir = resolve(process.argv[2]);
2832
if (!distDir) {
2933
console.error("Missing root dir as argument.");
3034
process.exit(1);

0 commit comments

Comments
 (0)