mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-10 02:43:24 +00:00
Update README, switch to SQLite, and adjust ESLint/perfectionist rules
- Simplified and clarified README structure and content. - Replaced `mongooseAdapter` with `sqliteAdapter` for database configuration. - Disabled all `perfectionist` ESLint rules for consistency. - Updated `billingPlugin` import path in dev config.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { mongooseAdapter } from '@payloadcms/db-mongodb'
|
||||
import { sqliteAdapter } from '@payloadcms/db-sqlite'
|
||||
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
||||
import { MongoMemoryReplSet } from 'mongodb-memory-server'
|
||||
import path from 'path'
|
||||
import { buildConfig } from 'payload'
|
||||
import { billingPlugin } from '../src/index.js'
|
||||
import { billingPlugin } from '../dist/index.js'
|
||||
import sharp from 'sharp'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
@@ -17,18 +16,7 @@ if (!process.env.ROOT_DIR) {
|
||||
process.env.ROOT_DIR = dirname
|
||||
}
|
||||
|
||||
const buildConfigWithMemoryDB = async () => {
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
const memoryDB = await MongoMemoryReplSet.create({
|
||||
replSet: {
|
||||
count: 3,
|
||||
dbName: 'payloadmemory',
|
||||
},
|
||||
})
|
||||
|
||||
process.env.DATABASE_URI = `${memoryDB.getUri()}&retryWrites=true`
|
||||
}
|
||||
|
||||
const buildConfigWithSQLite = () => {
|
||||
return buildConfig({
|
||||
admin: {
|
||||
importMap: {
|
||||
@@ -48,9 +36,10 @@ const buildConfigWithMemoryDB = async () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
db: mongooseAdapter({
|
||||
ensureIndexes: true,
|
||||
url: process.env.DATABASE_URI || '',
|
||||
db: sqliteAdapter({
|
||||
client: {
|
||||
url: `file:${path.resolve(dirname, 'payload.sqlite')}`,
|
||||
},
|
||||
}),
|
||||
editor: lexicalEditor(),
|
||||
email: testEmailAdapter,
|
||||
@@ -81,4 +70,4 @@ const buildConfigWithMemoryDB = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
export default buildConfigWithMemoryDB()
|
||||
export default buildConfigWithSQLite()
|
||||
|
||||
Reference in New Issue
Block a user