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

@@ -218,6 +218,16 @@ describe('Tauri Production Configuration', () => {
expect(conf.bundle.resources).toContain('resources/starter-skills/*');
});
it('bundles LICENSE and THIRD_PARTY_NOTICES.md next to service.js, untracked (UF-059)', () => {
// `resources/*` covers the top-level files build-sidecar.mjs copies there.
const conf = JSON.parse(fs.readFileSync(path.join(TAURI_DIR, 'tauri.conf.json'), 'utf-8'));
expect(conf.bundle.resources).toContain('resources/*');
for (const name of ['LICENSE', 'THIRD_PARTY_NOTICES.md']) {
const ignored = spawnSync('git', ['check-ignore', '-q', `app/src-tauri/resources/${name}`], { cwd: ROOT });
expect(ignored.status, `${name} copy is not ignored`).toBe(0);
}
});
it('tauri.conf.json has correct window settings', () => {
const conf = JSON.parse(fs.readFileSync(path.join(TAURI_DIR, 'tauri.conf.json'), 'utf-8'));
const win = conf.app.windows[0];
@@ -479,6 +489,8 @@ describe('Tauri Production Configuration', () => {
path.join(fixtureRoot, 'scripts', 'build-sidecar.mjs'),
);
const trackedFiles = new Map<string, string>([
['LICENSE', 'MIT License\n'],
['THIRD_PARTY_NOTICES.md', '# Third-party notices\n'],
['package-lock.json', '{"lockfileVersion":3}\n'],
['package.json', '{"name":"sidecar-tsconfig-fixture","private":true}\n'],
['packages/marketplace/marketplace.db', 'fixture database'],
@@ -575,6 +587,10 @@ describe('Tauri Production Configuration', () => {
const resourcesRoot = path.join(fixtureRoot, 'app', 'src-tauri', 'resources');
expect(fs.existsSync(path.join(resourcesRoot, 'capability-packs', 'research-workflow.json'))).toBe(true);
expect(fs.existsSync(path.join(resourcesRoot, 'starter-skills', 'brainstorm.md'))).toBe(true);
// UF-059: the license and the notices ship next to service.js.
for (const name of ['LICENSE', 'THIRD_PARTY_NOTICES.md']) {
expect(fs.readFileSync(path.join(resourcesRoot, name), 'utf8')).toBe(trackedFiles.get(name));
}
fs.writeFileSync(marketplacePath, 'dirty worktree database');
const dirtyMarketplaceResult = runResult(