35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
|
|
/**
|
||
|
|
* Spielt docs/starter/starter-structure.json in die V2-Dev-DB ein (voller Wipe).
|
||
|
|
* Usage: npm run bootstrap -- --yes
|
||
|
|
* Ohne --yes / CONFIRM=1: Abbruch (Schutz vor versehentlichem Löschen).
|
||
|
|
* Produktiv-Ports/DB-Namen werden blockiert.
|
||
|
|
*/
|
||
|
|
const args = new Set(process.argv.slice(2))
|
||
|
|
const confirmed = args.has('--yes') || args.has('-y') || process.env.CONFIRM === '1'
|
||
|
|
|
||
|
|
if (!confirmed) {
|
||
|
|
console.error('[bootstrap] Abbruch: würde die V2-Dev-DB komplett ersetzen.')
|
||
|
|
console.error('[bootstrap] Zum Bestätigen: npm run bootstrap -- --yes')
|
||
|
|
console.error('[bootstrap] Quelle: docs/starter/starter-structure.json')
|
||
|
|
process.exit(1)
|
||
|
|
}
|
||
|
|
|
||
|
|
const {
|
||
|
|
readStarterPackage,
|
||
|
|
importStarterPackage,
|
||
|
|
summarizeStarter,
|
||
|
|
STARTER_FILE,
|
||
|
|
} = await import('../db/starterPackage')
|
||
|
|
|
||
|
|
const pkg = readStarterPackage()
|
||
|
|
const counts = summarizeStarter(pkg)
|
||
|
|
const { structureRows } = importStarterPackage(pkg)
|
||
|
|
|
||
|
|
console.log(`[bootstrap] Starter eingespielt (${structureRows} Struktur-Zeilen).`)
|
||
|
|
console.log(`[bootstrap] Quelle: ${STARTER_FILE} (${pkg.exportedAt})`)
|
||
|
|
for (const [table, n] of Object.entries(counts)) {
|
||
|
|
if (n > 0) console.log(` ${table}: ${n}`)
|
||
|
|
}
|
||
|
|
console.log('[bootstrap] Keine Personen-/Meeting-Daten. API-Key lokal unter Config → KI setzen.')
|
||
|
|
console.log('[bootstrap] Start: npm run dev:all → http://localhost:5174')
|