Some checks failed
CI / Lint, typecheck, test (pull_request) Successful in 6m51s
CI / Build container images (pull_request) Successful in 1m13s
CI / Auth e2e pack (pull_request) Successful in 9m28s
CI / Import/export fidelity gate (pull_request) Successful in 54s
CD / Build and push images (push) Successful in 15s
CD / Deploy to Test (push) Successful in 16s
CD / Smoke tests against Test (push) Successful in 1m18s
CD / Promote to Int (push) Successful in 12s
CI / Lint, typecheck, test (push) Successful in 6m57s
CI / Build container images (push) Has been skipped
CI / Auth e2e pack (push) Successful in 9m7s
CI / Import/export fidelity gate (push) Successful in 57s
Restore drill / Restore the latest backup into a scratch stack (push) Failing after 17s
The drawio, excalidraw, and mermaid plugin packages redistribute third-party material (the draw.io webapp, the Excalidraw editor and its fonts, mermaid and its dependency tree) without the license texts their licenses require. Every affected ZIP now carries a licenses/ directory: - licenses/THIRD-PARTY-NOTICES.txt is generated from the esbuild metafile (packages/plugins/third-party-licenses.mjs), so the notice list is derived from what actually lands in plugin.js and cannot drift the way a hand-maintained list would. - drawio additionally extracts the upstream LICENSE from the pinned release tarball (Apache-2.0 requires the text with redistribution); the extraction guard also heals vendor/ caches from before this change. The CI fast path (no vendor fetch, no ZIP) is unchanged. - excalidraw additionally commits curated texts (MIT for Excalidraw, per-font OFL-1.1/MIT with each font's own copyright statement, plus a FONT-NOTICES.md attribution table), because neither the npm package nor upstream ships any license files for them. The api-side package validator accepts additional ZIP entries, so installed plugins are unaffected beyond the new files. Closes #345 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012aoPvnakfBP28nAfijgUY9
41 lines
1.6 KiB
JavaScript
41 lines
1.6 KiB
JavaScript
// Builds the installable plugin (plugin-architecture.md §Package format):
|
|
// bundles src/plugin.ts (SDK + i18n inlined — the sandbox CSP forbids runtime
|
|
// fetches) into plugin.js as a single ES module, then packs the ZIP for the
|
|
// admin upload / dropzone watcher.
|
|
import { mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
import { dirname, join } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
import { build } from 'esbuild';
|
|
import { zipSync } from 'fflate';
|
|
|
|
import { thirdPartyNotices } from '../third-party-licenses.mjs';
|
|
|
|
const root = dirname(fileURLToPath(import.meta.url));
|
|
const manifest = JSON.parse(readFileSync(join(root, 'manifest.json'), 'utf8'));
|
|
|
|
mkdirSync(join(root, 'dist'), { recursive: true });
|
|
const buildResult = await build({
|
|
entryPoints: [join(root, 'src/plugin.ts')],
|
|
bundle: true,
|
|
format: 'esm',
|
|
outfile: join(root, 'dist/plugin.js'),
|
|
minify: true,
|
|
metafile: true,
|
|
});
|
|
|
|
const files = {
|
|
'manifest.json': readFileSync(join(root, 'manifest.json')),
|
|
'plugin.js': readFileSync(join(root, 'dist/plugin.js')),
|
|
// mermaid and its transitive dependencies are bundled into plugin.js; their
|
|
// license texts ship with the package they belong to (issue #345).
|
|
'licenses/THIRD-PARTY-NOTICES.txt': Buffer.from(thirdPartyNotices(buildResult.metafile)),
|
|
};
|
|
for (const name of readdirSync(join(root, 'i18n'))) {
|
|
files[`i18n/${name}`] = readFileSync(join(root, 'i18n', name));
|
|
}
|
|
|
|
const target = join(root, 'dist', `${manifest.id}-${manifest.version}.zip`);
|
|
writeFileSync(target, zipSync(files));
|
|
console.log(`wrote ${target}`);
|