sync: update from private repo (2336949a)
CI / build-and-test (push) Canceled after 0s

This commit is contained in:
oss-sync
2026-09-17 11:29:31 +00:00
parent 28f74c4e37
commit 57702b4f34
2139 changed files with 321270 additions and 17494 deletions
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env node
/**
* Copy the Mermaid browser bundle into vendor/ so the server can render
* diagrams (#1025).
*
* The copy comes from the UI's own dependency — deliberately the SAME install
* the app renders Markdown with. Adding `mermaid` to the server's package.json
* instead would create two versions that drift apart, which is precisely the
* failure this tool exists to remove.
*
* vendor/ is gitignored and is already what the Docker image ships (noVNC lives
* there too), so the runtime stage picks this up with the COPY it already has.
* Runs at the end of `npm run build:ui`, when ui/node_modules is guaranteed.
*/
import { copyFileSync, mkdirSync, readFileSync, writeFileSync, existsSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
const src = join(root, 'ui', 'node_modules', 'mermaid', 'dist', 'mermaid.min.js');
const pkg = join(root, 'ui', 'node_modules', 'mermaid', 'package.json');
const destDir = join(root, 'vendor', 'mermaid');
const dest = join(destDir, 'mermaid.min.js');
if (!existsSync(src)) {
console.error(`[copy-mermaid-vendor] ${src} not found — run npm --prefix ui ci first.`);
process.exit(1);
}
mkdirSync(destDir, { recursive: true });
copyFileSync(src, dest);
const version = existsSync(pkg) ? JSON.parse(readFileSync(pkg, 'utf8')).version : 'unknown';
// The UMD bundle does not expose its own version, and package.json is not
// copied — leave a sidecar so the tool can report what it validated with.
writeFileSync(join(destDir, 'version.txt'), `${version}\n`);
console.log(`[copy-mermaid-vendor] mermaid ${version} -> vendor/mermaid/mermaid.min.js`);