Update electron (#2115)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
11
scripts/@types/node-pre-gyp.d.ts
vendored
11
scripts/@types/node-pre-gyp.d.ts
vendored
@@ -1,11 +0,0 @@
|
||||
/*
|
||||
Copyright 2022-2024 New Vector Ltd.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
declare module "@mapbox/node-pre-gyp/lib/util/versioning" {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
export function get_runtime_abi(runtime: string, version: string): string;
|
||||
}
|
||||
@@ -8,31 +8,24 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
import path from "node:path";
|
||||
import os from "node:os";
|
||||
import nodePreGypVersioning from "@mapbox/node-pre-gyp/lib/util/versioning";
|
||||
import { getElectronVersionFromInstalled } from "app-builder-lib/out/electron/electronVersion.js";
|
||||
import childProcess, { SpawnOptions } from "node:child_process";
|
||||
|
||||
import { Arch, Target, TARGETS, getHost, isHostId, TargetId } from "./target.js";
|
||||
|
||||
async function getRuntime(projectRoot: string): Promise<string> {
|
||||
const electronVersion = await getElectronVersionFromInstalled(projectRoot);
|
||||
return electronVersion ? "electron" : "node-webkit";
|
||||
}
|
||||
|
||||
async function getRuntimeVersion(projectRoot: string): Promise<string> {
|
||||
const electronVersion = await getElectronVersionFromInstalled(projectRoot);
|
||||
if (electronVersion) {
|
||||
return electronVersion;
|
||||
} else {
|
||||
return process.version.substr(1);
|
||||
if (!electronVersion) {
|
||||
throw new Error("Can't determine Electron version");
|
||||
}
|
||||
return electronVersion;
|
||||
}
|
||||
|
||||
export type Tool = [cmd: string, ...args: string[]];
|
||||
|
||||
export default class HakEnv {
|
||||
public readonly target: Target;
|
||||
public runtime?: string;
|
||||
public runtime: string = "electron";
|
||||
public runtimeVersion?: string;
|
||||
public dotHakDir: string;
|
||||
|
||||
@@ -50,19 +43,9 @@ export default class HakEnv {
|
||||
}
|
||||
|
||||
public async init(): Promise<void> {
|
||||
this.runtime = await getRuntime(this.projectRoot);
|
||||
this.runtimeVersion = await getRuntimeVersion(this.projectRoot);
|
||||
}
|
||||
|
||||
public getRuntimeAbi(): string {
|
||||
return nodePreGypVersioning.get_runtime_abi(this.runtime!, this.runtimeVersion!);
|
||||
}
|
||||
|
||||
// {node_abi}-{platform}-{arch}
|
||||
public getNodeTriple(): string {
|
||||
return this.getRuntimeAbi() + "-" + this.target.platform + "-" + this.target.arch;
|
||||
}
|
||||
|
||||
public getTargetId(): TargetId {
|
||||
return this.target.id;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ import type { DependencyInfo } from "./dep.js";
|
||||
import { loadJsonFile } from "../../src/utils.js";
|
||||
import packageJson from "../../package.json";
|
||||
|
||||
const GENERALCOMMANDS = ["target"];
|
||||
|
||||
// These can only be run on specific modules
|
||||
const MODULECOMMANDS = ["check", "fetch", "link", "build", "copy", "clean"];
|
||||
|
||||
@@ -90,7 +88,8 @@ async function main(): Promise<void> {
|
||||
|
||||
for (const s of HAKSCRIPTS) {
|
||||
if (hakJson.scripts?.[s]) {
|
||||
const scriptModule = await import(path.join("file://", prefix, "hak", dep, hakJson.scripts[s]));
|
||||
// Shockingly, using path.join and backslashes here doesn't work on Windows
|
||||
const scriptModule = await import(`../../hak/${dep}/${hakJson.scripts[s]}`);
|
||||
if (scriptModule.default) {
|
||||
deps[dep].scripts[s] = scriptModule.default;
|
||||
} else {
|
||||
@@ -119,13 +118,6 @@ async function main(): Promise<void> {
|
||||
if (modules.length === 0) modules = Object.keys(deps);
|
||||
|
||||
for (const cmd of cmds) {
|
||||
if (GENERALCOMMANDS.includes(cmd)) {
|
||||
if (cmd === "target") {
|
||||
console.log(hakEnv.getNodeTriple());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MODULECOMMANDS.includes(cmd)) {
|
||||
console.error("Unknown command: " + cmd);
|
||||
console.log("Commands I know about:");
|
||||
|
||||
Reference in New Issue
Block a user