Something went wrong. Try again.
Synapse is a study workspace. Organize courses read and annotate the material, train with generated exercises and watch your progress forked from denishovart.com/synapse
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637// Builds the web client's first-launch example pack from the same demo// workspace the server seed uses (seed-content.ts), in the file-pack format// the web app exports and imports (apps/web/src/lib/sync/filePack.ts).// Run with: npm run make:example-pack.import fs from 'node:fs';import path from 'node:path';import { zipSync } from 'fflate';import { buildSeedContent } from './seed-content';
const TARGET = path.resolve(__dirname, '..', '..', '..', 'web', 'web-client', 'example-pack.zip');
async function main(): Promise<void> { const content = await buildSeedContent(); const files: Record<string, Uint8Array> = {};
const docs = new Map<string, Uint8Array>([ ['workspace', content.workspace.export({ mode: 'snapshot' })], ['attempts', content.attempts.export({ mode: 'snapshot' })], ]); for (const [docId, doc] of content.annDocs) docs.set(docId, doc.export({ mode: 'snapshot' })); for (const [docId, bytes] of docs) files[`docs/${encodeURIComponent(docId)}.snapshot`] = bytes;
for (const blob of content.blobs) files[`blobs/${blob.hash}`] = new Uint8Array(blob.bytes);
const manifest = { version: 1, docs: [...docs.keys()], blobs: content.blobs.map((b) => b.hash), }; files['manifest.json'] = new TextEncoder().encode(JSON.stringify(manifest));
fs.writeFileSync(TARGET, zipSync(files)); console.log(`✅ wrote ${TARGET} (${docs.size} docs, ${content.blobs.length} blobs)`);}
void main();