mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-11-23 00:27:30 +00:00
12 lines
441 B
JavaScript
12 lines
441 B
JavaScript
|
const fs = require("fs").promises
|
||
|
const pj = require("path").join
|
||
|
const db = require("../src/lib/db")
|
||
|
|
||
|
;(async () => {
|
||
|
const users = db.prepare("SELECT * FROM Users").all()
|
||
|
const targetDir = process.argv.slice(2).includes("--publish") ? "../src/site/html" : ".."
|
||
|
const target = pj(__dirname, targetDir, "users_export.json")
|
||
|
fs.writeFile(target, JSON.stringify(users), {encoding: "utf8"})
|
||
|
console.log(`Users exported to ${target}`)
|
||
|
})()
|