diff --git a/package.json b/package.json index 21b2817..4f94843 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "build": "cross-env NODE_OPTIONS=--no-deprecation next build", "payload": "cross-env NODE_OPTIONS=--no-deprecation payload", "start": "cross-env NODE_OPTIONS=--no-deprecation next start", - "lint": "cross-env NODE_OPTIONS=--no-deprecation next lint" + "lint": "cross-env NODE_OPTIONS=--no-deprecation next lint", + "standalone-script": "tsx ./src/scripts/standalone-script.ts" }, "engines": { "node": ">=18.19.0" diff --git a/src/scripts/standalone-script.ts b/src/scripts/standalone-script.ts new file mode 100644 index 0000000..fbf4a34 --- /dev/null +++ b/src/scripts/standalone-script.ts @@ -0,0 +1,17 @@ +import { getPayload } from 'payload' +import { importConfig } from 'payload/node' +import 'dotenv/config' + +async function run() { + const awaitedConfig = await importConfig('../../payload.config.ts') + const payload = await getPayload({ config: awaitedConfig }) + + const pages = await payload.find({ + collection: 'pages', + }) + + console.log(pages) + process.exit(0) +} + +run().catch(console.error)