mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
fix(scripts): electron not rebuilding edit-docs
This commit is contained in:
parent
14896fe845
commit
a9374185d9
@ -6,7 +6,7 @@
|
|||||||
* the server build (and it doesn't expose a CLI option to override this).
|
* the server build (and it doesn't expose a CLI option to override this).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import path, { join } from "path";
|
import { join, resolve } from "path";
|
||||||
import { rebuild } from "@electron/rebuild"
|
import { rebuild } from "@electron/rebuild"
|
||||||
import { readFileSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
|
|
||||||
@ -18,13 +18,17 @@ function getElectronVersion(distDir: string) {
|
|||||||
const packageJsonPath = join(distDir, "package.json");
|
const packageJsonPath = join(distDir, "package.json");
|
||||||
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
||||||
|
|
||||||
const electronVersion = packageJson.devDependencies.electron || packageJson.dependencies.electron;
|
const electronVersion = packageJson?.devDependencies?.electron ?? packageJson?.dependencies?.electron;
|
||||||
|
if (!electronVersion) {
|
||||||
|
console.error(`Unable to retrieve Electron version in '${resolve(packageJsonPath)}'.`);
|
||||||
|
process.exit(3);
|
||||||
|
}
|
||||||
|
|
||||||
return electronVersion;
|
return electronVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
const distDir = path.resolve(process.argv[2]);
|
const distDir = resolve(process.argv[2]);
|
||||||
if (!distDir) {
|
if (!distDir) {
|
||||||
console.error("Missing root dir as argument.");
|
console.error("Missing root dir as argument.");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user