feat(licenses): ship LICENSE and the third-party notices with every installer

build-sidecar.mjs copies LICENSE and THIRD_PARTY_NOTICES.md from the
repository root next to service.js in app/src-tauri/resources, and fails
when either is missing. The resources/* glob of tauri.conf.json bundles
them into every desktop installer, and build-server-archive.mjs refuses a
payload without them, so the server archive carries them too. The copies
are ignored by git. Tests cover the copy, the archive and the ignore rule.
This commit is contained in:
shumeiko.it
2026-11-04 10:24:35 +01:00
parent 0acaa1cf29
commit 9ac6b9f0d4
6 changed files with 112 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ const marketplaceDbRelative = 'packages/marketplace/marketplace.db';
const marketplaceDb = path.join(root, 'packages', 'marketplace', 'marketplace.db');
const marketplaceResource = path.join(resourcesDir, 'marketplace.db');
const provenancePrefix = '// Waggle-Sidecar-Provenance: ';
const LEGAL_FILES = ['LICENSE', 'THIRD_PARTY_NOTICES.md'];
const buildScriptRelative = 'scripts/build-sidecar.mjs';
const entryPointRelative = 'packages/server/src/local/service.ts';
@@ -312,6 +313,16 @@ try {
for (const file of files) fs.copyFileSync(path.join(source, file), path.join(target, file));
console.log(`[build-sidecar] Copied ${files.length} ${name} files`);
}
// The license and the third-party notices travel with every installer and
// with the server archive, which packs this folder (build-server-archive.mjs).
// The sidecar serves them to the UI from here (routes/legal.ts).
for (const name of LEGAL_FILES) {
const source = path.join(root, name);
if (!fs.existsSync(source)) throw new Error(`Required ${name} is missing at the repository root`);
fs.copyFileSync(source, path.join(resourcesDir, name));
}
console.log(`[build-sidecar] Copied ${LEGAL_FILES.join(' and ')}`);
} catch (err) {
console.error('[build-sidecar] Build failed:', err.message);
process.exit(1);