chore: initializes payload before build

This commit is contained in:
James
2023-10-05 10:34:56 -04:00
parent f989e02a85
commit 9da6506622
7 changed files with 37 additions and 2 deletions

0
docs/admin/bundlers.mdx Normal file
View File

View File

19
docs/database/mongodb.mdx Normal file
View File

@@ -0,0 +1,19 @@
---
title: MongoDB
label: MongoDB
order: 20
desc: Payload has supported MongoDB natively since alpha. The flexible nature of MongoDB lends itself well to Payload's powerful fields.
keywords: MongoDB, documentation, typescript, Content Management System, cms, headless, javascript, node, react, express
---
##### `mongoURL`
**Required**. This is a fully qualified MongoDB connection string that points to your MongoDB database. If you don't have MongoDB installed locally, you can [follow these steps for Mac OSX](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/) and [these steps](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/) for Windows 10. If you want to use a local database and you know you have MongoDB installed locally, a typical connection string will look like this:
`mongodb://127.0.0.1/payload`
In contrast to running MongoDB locally, a popular option is to sign up for a free [MongoDB Atlas account](https://www.mongodb.com/cloud/atlas), which is a fully hosted and cloud-based installation of MongoDB that you don't need to ever worry about.
##### `mongoOptions`
Customize MongoDB connection options. Payload will connect to your MongoDB database using default options which you can override and extend to include all the [options](https://mongoosejs.com/docs/connections.html#options) available to mongoose.

View File

@@ -0,0 +1,7 @@
---
title: Postgres
label: Postgres
order: 30
desc: Payload supports Postgres through an officially supported Drizzle database adapter.
keywords: Postgres, documentation, typescript, Content Management System, cms, headless, javascript, node, react, express
---

View File

@@ -62,8 +62,9 @@ export const getViteConfig = async (payloadConfig: SanitizedConfig): Promise<Inl
__dirname: '"/"', __dirname: '"/"',
'module.hot': 'undefined', 'module.hot': 'undefined',
'process.argv': '[]', 'process.argv': '[]',
'process.cwd': '() => ""', 'process.cwd': 'function () { return "/" }',
'process.env': '{}', 'process.env': '{}',
'process?.cwd': 'function () { return "/" }',
} }
Object.entries(process.env).forEach(([key, val]) => { Object.entries(process.env).forEach(([key, val]) => {

View File

@@ -1,8 +1,16 @@
import payload from '..'
import loadConfig from '../config/load' import loadConfig from '../config/load'
export const build = async (): Promise<void> => { export const build = async (): Promise<void> => {
const config = await loadConfig() // Will throw its own error if it fails const config = await loadConfig() // Will throw its own error if it fails
await payload.init({
disableDBConnect: true,
disableOnInit: true,
local: true,
secret: '--unused--',
})
await config.admin.bundler.build(config) await config.admin.bundler.build(config)
} }

View File

@@ -13,8 +13,8 @@ export async function generateGraphQLSchema(): Promise<void> {
config.db = null config.db = null
await payload.init({ await payload.init({
disableOnInit: true,
disableDBConnect: true, disableDBConnect: true,
disableOnInit: true,
local: true, local: true,
secret: '--unused--', secret: '--unused--',
}) })