Fix seed script paths outside the image; document full local dev flow
This commit is contained in:
+11
-2
@@ -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`, {
|
||||
|
||||
Reference in New Issue
Block a user