19 lines
555 B
JavaScript
19 lines
555 B
JavaScript
import { readFileSync, writeFileSync } from 'node:fs'
|
|
import { DatabaseSync } from 'node:sqlite'
|
|
import { getProfile } from '../server/game-api.mjs'
|
|
|
|
const database = new DatabaseSync(':memory:')
|
|
|
|
try {
|
|
database.exec(readFileSync('db/schema.sql', 'utf8'))
|
|
database.exec(readFileSync('db/seed.sql', 'utf8'))
|
|
const profile = getProfile(database, 1)
|
|
writeFileSync(
|
|
'src/offline-starter-profile.json',
|
|
`${JSON.stringify(profile, null, 2)}\n`,
|
|
)
|
|
console.log('Offline starter profile exported from SQLite.')
|
|
} finally {
|
|
database.close()
|
|
}
|