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.
76 lines
3.2 KiB
JavaScript
76 lines
3.2 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/*
|
|
Copyright 2026 Element Creations 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.
|
|
*/
|
|
|
|
// Utility script to mimic yarn classic `link` behaviour
|
|
// to enable rapid development of libraries like matrix-js-sdk using symlinks/directory junctions
|
|
// reads .link-config file for DEPENDENCY=PATH values and removes those dependencies from node_modules,
|
|
// replacing them with a symlink/directory junction.
|
|
// This tool is a helpful substitute to `pnpm link` as that modifies the package.json & pnpm-lock.yaml files.
|
|
|
|
import * as fs from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { execSync } from "node:child_process";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const configPath = path.join(__dirname, "..", ".link-config");
|
|
const nodeModulesPath = path.join(__dirname, "..", "node_modules");
|
|
|
|
try {
|
|
if (process.env.PLAYWRIGHT_COMMON_DOCKER) process.exit(0); // Skip in docker env
|
|
|
|
const configFile = await fs.readFile(configPath, "utf-8");
|
|
for (const line of configFile.trim().split("\n")) {
|
|
if (!line || line.startsWith("#")) continue;
|
|
const [dependency, targetPath, dir] = line.split("=");
|
|
const nodeModules = dir ? path.join(dir, "node_modules") : nodeModulesPath;
|
|
const dependencyPath = path.join(nodeModules, dependency);
|
|
|
|
try {
|
|
try {
|
|
const stat = await fs.lstat(dependencyPath);
|
|
console.log(`Existing is ${stat.isSymbolicLink() ? "symlink" : "directory"}`);
|
|
if (stat.isSymbolicLink()) {
|
|
const linkPath = await fs.readlink(dependencyPath);
|
|
if (linkPath === targetPath) {
|
|
// already done
|
|
continue;
|
|
} else {
|
|
await fs.unlink(dependencyPath);
|
|
}
|
|
} else {
|
|
await fs.rm(dependencyPath, { recursive: true });
|
|
}
|
|
} catch (e: any) {
|
|
// fs.lstat throws ENOENT if the path doesn't exist (on Windows)
|
|
if (e.code === "ENOENT") {
|
|
console.log("Received ENOENT error on dependency path - assuming it doesn't exist");
|
|
} else {
|
|
throw e;
|
|
}
|
|
}
|
|
|
|
console.log(`Linking ${dependency} to ${targetPath}`);
|
|
await fs.symlink(targetPath, dependencyPath, "junction"); // use a junction type to avoid EPERM errors on Windows
|
|
|
|
const pkgJson = JSON.parse(await fs.readFile(path.join(targetPath, "package.json"), "utf-8"));
|
|
const pkgManager =
|
|
pkgJson.devEngines?.packageManager?.name ?? pkgJson.packageManager?.split("@").at(0) ?? "yarn";
|
|
// pnpm install may have wiped out the `node_modules` dir so we have to restore it
|
|
execSync(`${pkgManager} install --ignore-scripts --frozen-lockfile`, {
|
|
cwd: dependencyPath,
|
|
});
|
|
} catch (e) {
|
|
console.error(`Failed to link ${dependency}`, e);
|
|
}
|
|
}
|
|
} catch {
|
|
// Ignore config file not existing
|
|
}
|