forked from olcxjas-softworks/LarpixClient
update electron to v43
This commit is contained in:
parent
68ac0beedf
commit
fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions
50
electron/node_modules/app-builder-lib/out/publish/updateInfoBuilder.js
generated
vendored
50
electron/node_modules/app-builder-lib/out/publish/updateInfoBuilder.js
generated
vendored
|
|
@ -1,7 +1,8 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.writeUpdateInfoFiles = exports.createUpdateInfoTasks = void 0;
|
||||
const bluebird_lst_1 = require("bluebird-lst");
|
||||
exports.createUpdateInfoTasks = createUpdateInfoTasks;
|
||||
exports.writeUpdateInfoFiles = writeUpdateInfoFiles;
|
||||
const tiny_async_pool_1 = require("tiny-async-pool");
|
||||
const builder_util_1 = require("builder-util");
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const lazy_val_1 = require("lazy-val");
|
||||
|
|
@ -14,7 +15,7 @@ async function getReleaseInfo(packager) {
|
|||
const releaseInfo = { ...(packager.platformSpecificBuildOptions.releaseInfo || packager.config.releaseInfo) };
|
||||
if (releaseInfo.releaseNotes == null) {
|
||||
const releaseNotesFile = await packager.getResource(releaseInfo.releaseNotesFile, `release-notes-${packager.platform.buildConfigurationKey}.md`, `release-notes-${packager.platform.name}.md`, `release-notes-${packager.platform.nodeName}.md`, "release-notes.md");
|
||||
const releaseNotes = releaseNotesFile == null ? null : await fs_extra_1.readFile(releaseNotesFile, "utf-8");
|
||||
const releaseNotes = releaseNotesFile == null ? null : await (0, fs_extra_1.readFile)(releaseNotesFile, "utf-8");
|
||||
// to avoid undefined in the file, check for null
|
||||
if (releaseNotes != null) {
|
||||
releaseInfo.releaseNotes = releaseNotes;
|
||||
|
|
@ -68,16 +69,15 @@ function computeIsisElectronUpdater1xCompatibility(updaterCompatibility, publish
|
|||
const updaterVersion = packager.metadata.dependencies == null ? null : packager.metadata.dependencies["electron-updater"];
|
||||
return updaterVersion == null || semver.lt(updaterVersion, "4.0.0");
|
||||
}
|
||||
/** @internal */
|
||||
async function createUpdateInfoTasks(event, _publishConfigs) {
|
||||
const packager = event.packager;
|
||||
const publishConfigs = await PublishManager_1.getPublishConfigsForUpdateInfo(packager, _publishConfigs, event.arch);
|
||||
const publishConfigs = await (0, PublishManager_1.getPublishConfigsForUpdateInfo)(packager, _publishConfigs, event.arch);
|
||||
if (publishConfigs == null || publishConfigs.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const outDir = event.target.outDir;
|
||||
const version = packager.appInfo.version;
|
||||
const sha2 = new lazy_val_1.Lazy(() => hash_1.hashFile(event.file, "sha256", "hex"));
|
||||
const sha2 = new lazy_val_1.Lazy(() => (0, hash_1.hashFile)(event.file, "sha256", "hex"));
|
||||
const isMac = packager.platform === core_1.Platform.MAC;
|
||||
const createdFiles = new Set();
|
||||
const sharedInfo = await createUpdateInfo(version, event, await getReleaseInfo(packager));
|
||||
|
|
@ -123,16 +123,16 @@ async function createUpdateInfoTasks(event, _publishConfigs) {
|
|||
info,
|
||||
publishConfiguration,
|
||||
packager,
|
||||
arch: event.arch,
|
||||
});
|
||||
}
|
||||
}
|
||||
return tasks;
|
||||
}
|
||||
exports.createUpdateInfoTasks = createUpdateInfoTasks;
|
||||
async function createUpdateInfo(version, event, releaseInfo) {
|
||||
const customUpdateInfo = event.updateInfo;
|
||||
const url = path.basename(event.file);
|
||||
const sha512 = (customUpdateInfo == null ? null : customUpdateInfo.sha512) || (await hash_1.hashFile(event.file));
|
||||
const sha512 = (customUpdateInfo == null ? null : customUpdateInfo.sha512) || (await (0, hash_1.hashFile)(event.file));
|
||||
const files = [{ url, sha512 }];
|
||||
const result = {
|
||||
// @ts-ignore
|
||||
|
|
@ -153,11 +153,23 @@ async function createUpdateInfo(version, event, releaseInfo) {
|
|||
}
|
||||
async function writeUpdateInfoFiles(updateInfoFileTasks, packager) {
|
||||
// zip must be first and zip info must be used for old path/sha512 properties in the update info
|
||||
updateInfoFileTasks.sort((a, b) => (a.info.files[0].url.endsWith(".zip") ? 0 : 100) - (b.info.files[0].url.endsWith(".zip") ? 0 : 100));
|
||||
// universal installer (arch === null) must precede arch-specific ones so path:/sha512: point to the right artifact
|
||||
updateInfoFileTasks.sort((a, b) => {
|
||||
var _a, _b;
|
||||
const zipDiff = (a.info.files[0].url.endsWith(".zip") ? 0 : 100) - (b.info.files[0].url.endsWith(".zip") ? 0 : 100);
|
||||
if (zipDiff !== 0) {
|
||||
return zipDiff;
|
||||
}
|
||||
// universal (arch === null) before arch-specific; tie-break by Arch enum value for full determinism
|
||||
// undefined arch (external callers predating this field) treated as arch-specific via strict === null check
|
||||
const aArch = a.arch === null ? -1 : ((_a = a.arch) !== null && _a !== void 0 ? _a : Number.MAX_SAFE_INTEGER);
|
||||
const bArch = b.arch === null ? -1 : ((_b = b.arch) !== null && _b !== void 0 ? _b : Number.MAX_SAFE_INTEGER);
|
||||
return aArch - bArch;
|
||||
});
|
||||
const updateChannelFileToInfo = new Map();
|
||||
for (const task of updateInfoFileTasks) {
|
||||
// https://github.com/electron-userland/electron-builder/pull/2994
|
||||
const key = `${task.file}@${builder_util_1.safeStringifyJson(task.publishConfiguration, new Set(["releaseType"]))}`;
|
||||
const key = `${task.file}@${(0, builder_util_1.safeStringifyJson)(task.publishConfiguration, new Set(["releaseType"]))}`;
|
||||
const existingTask = updateChannelFileToInfo.get(key);
|
||||
if (existingTask == null) {
|
||||
updateChannelFileToInfo.set(key, task);
|
||||
|
|
@ -166,7 +178,8 @@ async function writeUpdateInfoFiles(updateInfoFileTasks, packager) {
|
|||
existingTask.info.files.push(...task.info.files);
|
||||
}
|
||||
const releaseDate = new Date().toISOString();
|
||||
await bluebird_lst_1.default.map(updateChannelFileToInfo.values(), async (task) => {
|
||||
const concurrency = 4;
|
||||
await (0, tiny_async_pool_1.default)(concurrency, Array.from(updateChannelFileToInfo.values()), async (task) => {
|
||||
const publishConfig = task.publishConfiguration;
|
||||
if (publishConfig.publishAutoUpdate === false) {
|
||||
builder_util_1.log.debug({
|
||||
|
|
@ -178,9 +191,9 @@ async function writeUpdateInfoFiles(updateInfoFileTasks, packager) {
|
|||
if (task.info.releaseDate == null) {
|
||||
task.info.releaseDate = releaseDate;
|
||||
}
|
||||
const fileContent = Buffer.from(builder_util_1.serializeToYaml(task.info, false, true));
|
||||
await fs_extra_1.outputFile(task.file, fileContent);
|
||||
packager.dispatchArtifactCreated({
|
||||
const fileContent = Buffer.from((0, builder_util_1.serializeToYaml)(task.info, false, true));
|
||||
await (0, fs_extra_1.outputFile)(task.file, fileContent);
|
||||
await packager.emitArtifactCreated({
|
||||
file: task.file,
|
||||
fileContent,
|
||||
arch: null,
|
||||
|
|
@ -188,21 +201,20 @@ async function writeUpdateInfoFiles(updateInfoFileTasks, packager) {
|
|||
target: null,
|
||||
publishConfig,
|
||||
});
|
||||
}, { concurrency: 4 });
|
||||
});
|
||||
}
|
||||
exports.writeUpdateInfoFiles = writeUpdateInfoFiles;
|
||||
// backward compatibility - write json file
|
||||
async function writeOldMacInfo(publishConfig, outDir, dir, channel, createdFiles, version, packager) {
|
||||
const isGitHub = publishConfig.provider === "github";
|
||||
const updateInfoFile = isGitHub && outDir === dir ? path.join(dir, "github", `${channel}-mac.json`) : path.join(dir, `${channel}-mac.json`);
|
||||
if (!createdFiles.has(updateInfoFile)) {
|
||||
createdFiles.add(updateInfoFile);
|
||||
await fs_extra_1.outputJson(updateInfoFile, {
|
||||
await (0, fs_extra_1.outputJson)(updateInfoFile, {
|
||||
version,
|
||||
releaseDate: new Date().toISOString(),
|
||||
url: PublishManager_1.computeDownloadUrl(publishConfig, packager.generateName2("zip", "mac", isGitHub), packager),
|
||||
url: (0, PublishManager_1.computeDownloadUrl)(publishConfig, packager.generateName2("zip", "mac", isGitHub), packager),
|
||||
}, { spaces: 2 });
|
||||
packager.info.dispatchArtifactCreated({
|
||||
await packager.info.emitArtifactCreated({
|
||||
file: updateInfoFile,
|
||||
arch: null,
|
||||
packager,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue