The repo had no upstream ancestry: a whole tree arrived in one commit in May, so
every update meant re-applying our patches by hand onto a fresh checkout, and a file
Element moved would take our lines with it silently.
The real base was found by measuring tree distance across develop rather than trusting
the changelog: deadd548, not the v1.12.17 tag. With that set as a temporary graft, this
merge computed as a proper three-way merge - 32 conflicts instead of 1757.
Resolutions, each decided rather than defaulted:
- 24 GitHub workflows stay deleted; we build on GitLab CI.
- MImageBody.tsx is gone upstream, migrated to MVVM. Our ClamAV error label moved into
ImageBodyViewModel.computeErrorLabel, ahead of the DecryptError branch, matching what
VideoBodyViewModel and FileBodyViewModel already do.
- Upstream extracted the room list item body into RoomListItemContent. Our call
participants list and its getInitials helper moved there; both sides' CSS classes and
both sides' props are kept.
- matrix-js-sdk follows upstream at 42.2.0 - our git ref pin was a workaround for a
stale ref, and following upstream is the point of this merge.
- Element Call stays ours. Checked before deciding: @element-hq/element-call-embedded
is referenced nowhere in the tree, while webpack.config.ts needs
@sorb/threadnet-call-embedded, so taking upstream's line would have deleted the noise
suppression from #0054 without a word.
The lockfile was regenerated with pnpm 11.20.0, which upstream now requires through
devEngines. CI already runs corepack enable, and onFail: download makes it fetch that
version by itself.
Not yet accepted: this needs a build and the ClamAV functional test - send an encrypted
file, receive a rejected one - before it goes near main.
80 lines
2.3 KiB
JavaScript
80 lines
2.3 KiB
JavaScript
#!/usr/bin/env node
|
|
/*
|
|
Copyright 2026 Element Creations Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
/*
|
|
* Checks for the presence of a webapp, inspects its version and sets the
|
|
* version metadata of the package to match.
|
|
*/
|
|
|
|
import { promises as fs } from "node:fs";
|
|
import * as asar from "@electron/asar";
|
|
import * as childProcess from "node:child_process";
|
|
import * as url from "node:url";
|
|
|
|
export async function versionFromAsar(): Promise<string> {
|
|
try {
|
|
await fs.stat("webapp.asar");
|
|
} catch {
|
|
throw new Error("No 'webapp.asar' found. Run 'pnpm run fetch'");
|
|
}
|
|
|
|
return asar.extractFile("webapp.asar", "version").toString().trim();
|
|
}
|
|
|
|
export async function setPackageVersion(ver: string): Promise<void> {
|
|
// set version in package.json: electron-builder will use this to populate
|
|
// all the various version fields
|
|
await new Promise<void>((resolve, reject) => {
|
|
childProcess.execFile(
|
|
process.platform === "win32" ? "pnpm.cmd" : "pnpm",
|
|
[
|
|
"version",
|
|
"-s",
|
|
"--no-git-tag-version", // This also means "don't commit to git" as it turns out
|
|
"--new-version",
|
|
ver,
|
|
],
|
|
{
|
|
// We need shell mode on Windows to be able to launch `.cmd` executables
|
|
// See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
|
|
shell: process.platform === "win32",
|
|
},
|
|
(err) => {
|
|
if (err) {
|
|
reject(err);
|
|
} else {
|
|
resolve();
|
|
}
|
|
},
|
|
);
|
|
});
|
|
}
|
|
|
|
async function main(args: string[]): Promise<number> {
|
|
let version = args[0];
|
|
|
|
if (version === undefined) version = await versionFromAsar();
|
|
|
|
await setPackageVersion(version);
|
|
return 0;
|
|
}
|
|
|
|
if (import.meta.url.startsWith("file:")) {
|
|
const modulePath = url.fileURLToPath(import.meta.url);
|
|
if (process.argv[1] === modulePath) {
|
|
main(process.argv.slice(2))
|
|
.then((ret) => {
|
|
process.exit(ret);
|
|
})
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|
|
}
|
|
}
|