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
51
electron/node_modules/app-builder-lib/out/util/packageMetadata.js
generated
vendored
51
electron/node_modules/app-builder-lib/out/util/packageMetadata.js
generated
vendored
|
|
@ -1,6 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.checkMetadata = exports.readPackageJson = void 0;
|
||||
exports.readPackageJson = readPackageJson;
|
||||
exports.checkMetadata = checkMetadata;
|
||||
const builder_util_1 = require("builder-util");
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const path = require("path");
|
||||
|
|
@ -8,24 +9,23 @@ const semver = require("semver");
|
|||
const normalizePackageData_1 = require("./normalizePackageData");
|
||||
/** @internal */
|
||||
async function readPackageJson(file) {
|
||||
const data = await fs_extra_1.readJson(file);
|
||||
const data = await (0, fs_extra_1.readJson)(file);
|
||||
await authors(file, data);
|
||||
// remove not required fields because can be used for remote build
|
||||
delete data.scripts;
|
||||
delete data.readme;
|
||||
normalizePackageData_1.normalizePackageData(data);
|
||||
(0, normalizePackageData_1.normalizePackageData)(data);
|
||||
return data;
|
||||
}
|
||||
exports.readPackageJson = readPackageJson;
|
||||
async function authors(file, data) {
|
||||
if (data.contributors != null) {
|
||||
return;
|
||||
}
|
||||
let authorData;
|
||||
try {
|
||||
authorData = await fs_extra_1.readFile(path.resolve(path.dirname(file), "AUTHORS"), "utf8");
|
||||
authorData = await (0, fs_extra_1.readFile)(path.resolve(path.dirname(file), "AUTHORS"), "utf8");
|
||||
}
|
||||
catch (ignored) {
|
||||
catch (_ignored) {
|
||||
return;
|
||||
}
|
||||
data.contributors = authorData.split(/\r?\n/g).map(it => it.replace(/^\s*#.*$/, "").trim());
|
||||
|
|
@ -37,7 +37,7 @@ function checkMetadata(metadata, devMetadata, appPackageFile, devAppPackageFile)
|
|||
errors.push(`Please specify '${missedFieldName}' in the package.json (${appPackageFile})`);
|
||||
};
|
||||
const checkNotEmpty = (name, value) => {
|
||||
if (builder_util_1.isEmptyOrSpaces(value)) {
|
||||
if ((0, builder_util_1.isEmptyOrSpaces)(value)) {
|
||||
reportError(name);
|
||||
}
|
||||
};
|
||||
|
|
@ -45,7 +45,7 @@ function checkMetadata(metadata, devMetadata, appPackageFile, devAppPackageFile)
|
|||
errors.push(`"directories" in the root is deprecated, please specify in the "build"`);
|
||||
}
|
||||
checkNotEmpty("name", metadata.name);
|
||||
if (builder_util_1.isEmptyOrSpaces(metadata.description)) {
|
||||
if ((0, builder_util_1.isEmptyOrSpaces)(metadata.description)) {
|
||||
builder_util_1.log.warn({ appPackageFile }, `description is missed in the package.json`);
|
||||
}
|
||||
if (metadata.author == null) {
|
||||
|
|
@ -59,14 +59,13 @@ function checkMetadata(metadata, devMetadata, appPackageFile, devAppPackageFile)
|
|||
}
|
||||
}
|
||||
const devDependencies = metadata.devDependencies;
|
||||
if (devDependencies != null && "electron-rebuild" in devDependencies) {
|
||||
builder_util_1.log.info('electron-rebuild not required if you use electron-builder, please consider to remove excess dependency from devDependencies\n\nTo ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`');
|
||||
if (devDependencies != null && ("electron-rebuild" in devDependencies || "@electron/rebuild" in devDependencies)) {
|
||||
builder_util_1.log.info('@electron/rebuild already used by electron-builder, please consider to remove excess dependency from devDependencies\n\nTo ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`');
|
||||
}
|
||||
if (errors.length > 0) {
|
||||
throw new builder_util_1.InvalidConfigurationError(errors.join("\n"));
|
||||
}
|
||||
}
|
||||
exports.checkMetadata = checkMetadata;
|
||||
function versionSatisfies(version, range, loose) {
|
||||
if (version == null) {
|
||||
return false;
|
||||
|
|
@ -81,10 +80,32 @@ function checkDependencies(dependencies, errors) {
|
|||
if (dependencies == null) {
|
||||
return;
|
||||
}
|
||||
const updaterVersion = dependencies["electron-updater"];
|
||||
const requiredElectronUpdaterVersion = "4.0.0";
|
||||
if (updaterVersion != null && !versionSatisfies(updaterVersion, `>=${requiredElectronUpdaterVersion}`)) {
|
||||
errors.push(`At least electron-updater ${requiredElectronUpdaterVersion} is recommended by current electron-builder version. Please set electron-updater version to "^${requiredElectronUpdaterVersion}"`);
|
||||
let updaterVersion = dependencies["electron-updater"];
|
||||
if (updaterVersion != null) {
|
||||
// Pick the version out of yarn berry patch syntax
|
||||
// "patch:electron-updater@npm%3A6.4.1#~/.yarn/patches/electron-updater-npm-6.4.1-ef33e6cc39.patch"
|
||||
if (updaterVersion.startsWith("patch:")) {
|
||||
// codeql[js/polynomial-redos] - [^#]+ is a possessive character-class match; linear time, no catastrophic backtracking
|
||||
const match = updaterVersion.match(/@npm%3A([^#]+)#/);
|
||||
if (match) {
|
||||
updaterVersion = match[1];
|
||||
}
|
||||
}
|
||||
// for testing auto-update using workspace electron-updater
|
||||
const prefixes = ["link:", "file:"];
|
||||
for (const prefix of prefixes) {
|
||||
if (updaterVersion.startsWith(prefix)) {
|
||||
const normalized = path.normalize(updaterVersion.substring(prefix.length));
|
||||
const packageJsonPath = path.isAbsolute(normalized) ? normalized : path.resolve(__dirname, normalized);
|
||||
const json = (0, fs_extra_1.readJsonSync)(path.join(packageJsonPath, "package.json"));
|
||||
updaterVersion = json.version;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const requiredElectronUpdaterVersion = "4.0.0";
|
||||
if (!versionSatisfies(updaterVersion, `>=${requiredElectronUpdaterVersion}`)) {
|
||||
errors.push(`At least electron-updater ${requiredElectronUpdaterVersion} is recommended by current electron-builder version. Please set electron-updater version to "^${requiredElectronUpdaterVersion}". Received "${updaterVersion}"`);
|
||||
}
|
||||
}
|
||||
const swVersion = dependencies["electron-builder-squirrel-windows"];
|
||||
if (swVersion != null && !versionSatisfies(swVersion, ">=20.32.0")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue