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
48
electron/node_modules/app-builder-lib/out/targets/FlatpakTarget.js
generated
vendored
48
electron/node_modules/app-builder-lib/out/targets/FlatpakTarget.js
generated
vendored
|
|
@ -7,16 +7,14 @@ const path = require("path");
|
|||
const core_1 = require("../core");
|
||||
const license_1 = require("../util/license");
|
||||
const targetUtil_1 = require("./targetUtil");
|
||||
const builder_util_runtime_1 = require("builder-util-runtime");
|
||||
class FlatpakTarget extends core_1.Target {
|
||||
constructor(name, packager, helper, outDir) {
|
||||
super(name);
|
||||
this.packager = packager;
|
||||
this.helper = helper;
|
||||
this.outDir = outDir;
|
||||
this.options = {
|
||||
...this.packager.platformSpecificBuildOptions,
|
||||
...this.packager.config[this.name],
|
||||
};
|
||||
this.options = (0, builder_util_runtime_1.deepAssign)({}, this.packager.platformSpecificBuildOptions, this.packager.config[this.name]);
|
||||
}
|
||||
get appId() {
|
||||
return filterFlatpakAppIdentifier(this.packager.appInfo.id);
|
||||
|
|
@ -25,16 +23,16 @@ class FlatpakTarget extends core_1.Target {
|
|||
const { packager, options } = this;
|
||||
const artifactName = packager.expandArtifactNamePattern(options, "flatpak", arch, undefined, false);
|
||||
const artifactPath = path.join(this.outDir, artifactName);
|
||||
await packager.info.callArtifactBuildStarted({
|
||||
await packager.info.emitArtifactBuildStarted({
|
||||
targetPresentableName: "flatpak",
|
||||
file: artifactPath,
|
||||
arch,
|
||||
});
|
||||
const stageDir = await this.prepareStageDir(arch);
|
||||
const { manifest, buildOptions } = this.getFlatpakBuilderOptions(appOutDir, stageDir.dir, artifactName, arch);
|
||||
await flatpak_bundler_1.bundle(manifest, buildOptions);
|
||||
await (0, flatpak_bundler_1.bundle)(manifest, buildOptions);
|
||||
await stageDir.cleanup();
|
||||
await packager.info.callArtifactBuildCompleted({
|
||||
await packager.info.emitArtifactBuildCompleted({
|
||||
file: artifactPath,
|
||||
safeArtifactName: packager.computeSafeArtifactName(artifactName, "flatpak", arch, false),
|
||||
target: this,
|
||||
|
|
@ -44,15 +42,15 @@ class FlatpakTarget extends core_1.Target {
|
|||
});
|
||||
}
|
||||
async prepareStageDir(arch) {
|
||||
const stageDir = await targetUtil_1.createStageDir(this, this.packager, arch);
|
||||
const stageDir = await (0, targetUtil_1.createStageDir)(this, this.packager, arch);
|
||||
await Promise.all([this.createSandboxBinWrapper(stageDir), this.createDesktopFile(stageDir), this.copyLicenseFile(stageDir), this.copyIcons(stageDir)]);
|
||||
return stageDir;
|
||||
}
|
||||
async createSandboxBinWrapper(stageDir) {
|
||||
const useWaylandFlags = !!this.options.useWaylandFlags;
|
||||
const electronWrapperPath = stageDir.getTempFile(path.join("bin", "electron-wrapper"));
|
||||
await fs_extra_1.outputFile(electronWrapperPath, getElectronWrapperScript(this.packager.executableName, useWaylandFlags));
|
||||
await fs_extra_1.chmod(electronWrapperPath, 0o755);
|
||||
await (0, fs_extra_1.outputFile)(electronWrapperPath, getElectronWrapperScript(this.packager.executableName, this.options.executableArgs, useWaylandFlags));
|
||||
await (0, fs_extra_1.chmod)(electronWrapperPath, 0o755);
|
||||
}
|
||||
async createDesktopFile(stageDir) {
|
||||
const appIdentifier = this.appId;
|
||||
|
|
@ -60,26 +58,30 @@ class FlatpakTarget extends core_1.Target {
|
|||
await this.helper.writeDesktopEntry(this.options, "electron-wrapper %U", desktopFile, { Icon: appIdentifier });
|
||||
}
|
||||
async copyLicenseFile(stageDir) {
|
||||
const licenseSrc = await license_1.getNotLocalizedLicenseFile(this.options.license, this.packager, ["txt", "html"]);
|
||||
const licenseSrc = await (0, license_1.getNotLocalizedLicenseFile)(this.options.license, this.packager, ["txt", "html"]);
|
||||
if (licenseSrc) {
|
||||
const licenseDst = stageDir.getTempFile(path.join("share", "doc", this.appId, "copyright"));
|
||||
await builder_util_1.copyFile(licenseSrc, licenseDst);
|
||||
await (0, builder_util_1.copyFile)(licenseSrc, licenseDst);
|
||||
}
|
||||
}
|
||||
async copyIcons(stageDir) {
|
||||
const icons = await this.helper.icons;
|
||||
const copyIcons = icons.map(async (icon) => {
|
||||
if (icon.size > 512) {
|
||||
// Flatpak does not allow icons larger than 512 pixels
|
||||
return Promise.resolve();
|
||||
}
|
||||
const extWithDot = path.extname(icon.file);
|
||||
const sizeName = extWithDot === ".svg" ? "scalable" : `${icon.size}x${icon.size}`;
|
||||
const iconDst = stageDir.getTempFile(path.join("share", "icons", "hicolor", sizeName, "apps", `${this.appId}${extWithDot}`));
|
||||
return builder_util_1.copyFile(icon.file, iconDst);
|
||||
return (0, builder_util_1.copyFile)(icon.file, iconDst);
|
||||
});
|
||||
await Promise.all(copyIcons);
|
||||
}
|
||||
getFlatpakBuilderOptions(appOutDir, stageDir, artifactName, arch) {
|
||||
const appIdentifier = this.appId;
|
||||
const { executableName } = this.packager;
|
||||
const flatpakArch = builder_util_1.toLinuxArchString(arch, "flatpak");
|
||||
const flatpakArch = (0, builder_util_1.toLinuxArchString)(arch, "flatpak");
|
||||
const manifest = {
|
||||
id: appIdentifier,
|
||||
command: "electron-wrapper",
|
||||
|
|
@ -128,23 +130,25 @@ const flatpakBuilderDefaults = {
|
|||
"--talk-name=org.freedesktop.Notifications",
|
||||
],
|
||||
};
|
||||
function getElectronWrapperScript(executableName, useWaylandFlags) {
|
||||
return useWaylandFlags
|
||||
? `#!/bin/sh
|
||||
function getElectronWrapperScript(executableName, executableArgs, useWaylandFlags) {
|
||||
const stringifiedExecutableArgs = (executableArgs === null || executableArgs === void 0 ? void 0 : executableArgs.join(" ")) || "";
|
||||
if (useWaylandFlags) {
|
||||
return `#!/bin/sh
|
||||
|
||||
export TMPDIR="$XDG_RUNTIME_DIR/app/$FLATPAK_ID"
|
||||
|
||||
if [ "\${XDG_SESSION_TYPE}" == "wayland" ]; then
|
||||
zypak-wrapper "${executableName}" --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"
|
||||
zypak-wrapper "${executableName}" ${stringifiedExecutableArgs} --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"
|
||||
else
|
||||
zypak-wrapper "${executableName}" "$@"
|
||||
zypak-wrapper "${executableName}" ${stringifiedExecutableArgs} "$@"
|
||||
fi
|
||||
`
|
||||
: `#!/bin/sh
|
||||
`;
|
||||
}
|
||||
return `#!/bin/sh
|
||||
|
||||
export TMPDIR="$XDG_RUNTIME_DIR/app/$FLATPAK_ID"
|
||||
|
||||
zypak-wrapper "${executableName}" "$@"
|
||||
zypak-wrapper "${executableName}" ${stringifiedExecutableArgs} "$@"
|
||||
`;
|
||||
}
|
||||
function filterFlatpakAppIdentifier(identifier) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue