Fix seed script paths outside the image; document full local dev flow

This commit is contained in:
2026-09-03 09:57:30 +05:30
parent 7b070fde81
commit c03b9c582b
2 changed files with 41 additions and 5 deletions
+11 -2
View File
@@ -10,7 +10,7 @@
*
* Required env: PB_SUPERUSER_EMAIL, PB_SUPERUSER_PASSWORD. Optional: PB_URL.
*/
import { readFileSync } from 'node:fs'
import { existsSync, readFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
@@ -24,7 +24,16 @@ if (!EMAIL || !PASSWORD) {
process.exit(0)
}
const content = JSON.parse(readFileSync(join(here, 'content.json'), 'utf8'))
// Inside the image content.json sits next to this script; in the repo it lives
// with the frontend sources.
const contentPath = [join(here, 'content.json'), join(here, '../app/src/data/content.json')].find(
(path) => existsSync(path),
)
if (!contentPath) {
console.error('[seed] content.json not found — nothing to seed')
process.exit(1)
}
const content = JSON.parse(readFileSync(contentPath, 'utf8'))
async function auth() {
const res = await fetch(`${PB_URL}/api/collections/_superusers/auth-with-password`, {