chore: rename resend package (#6168)
This commit is contained in:
8
test/email-resend/.eslintrc.cjs
Normal file
8
test/email-resend/.eslintrc.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
/** @type {import('eslint').Linter.Config} */
|
||||
module.exports = {
|
||||
ignorePatterns: ['payload-types.ts'],
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.eslint.json'],
|
||||
tsconfigRootDir: __dirname,
|
||||
},
|
||||
}
|
||||
2
test/email-resend/.gitignore
vendored
Normal file
2
test/email-resend/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/media
|
||||
/media-gif
|
||||
34
test/email-resend/config.ts
Normal file
34
test/email-resend/config.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { resendAdapter } from '@payloadcms/email-resend'
|
||||
|
||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
||||
import { devUser } from '../credentials.js'
|
||||
|
||||
export default buildConfigWithDefaults({
|
||||
// ...extend config here
|
||||
collections: [],
|
||||
|
||||
// NOTE: The from address and api key should be properly set
|
||||
// See email-resend README for more information
|
||||
email: resendAdapter({
|
||||
defaultFromAddress: 'dev@payloadcms.com',
|
||||
defaultFromName: 'Payload CMS',
|
||||
apiKey: process.env.RESEND_API_KEY || '',
|
||||
}),
|
||||
onInit: async (payload) => {
|
||||
await payload.create({
|
||||
collection: 'users',
|
||||
data: {
|
||||
email: devUser.email,
|
||||
password: devUser.password,
|
||||
},
|
||||
})
|
||||
|
||||
const email = await payload.sendEmail({
|
||||
to: 'dev@payloadcms.com',
|
||||
subject: 'This was sent on init',
|
||||
text: 'This is my message body',
|
||||
})
|
||||
|
||||
payload.logger.info({ msg: 'Email sent', email })
|
||||
},
|
||||
})
|
||||
50
test/email-resend/payload-types.ts
Normal file
50
test/email-resend/payload-types.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/* tslint:disable */
|
||||
/**
|
||||
* This file was automatically generated by Payload.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
|
||||
* and re-run `payload generate:types` to regenerate this file.
|
||||
*/
|
||||
|
||||
export interface Config {
|
||||
collections: {
|
||||
posts: Post
|
||||
media: Media
|
||||
users: User
|
||||
}
|
||||
globals: {
|
||||
menu: Menu
|
||||
}
|
||||
}
|
||||
export interface Post {
|
||||
id: string
|
||||
text?: string
|
||||
associatedMedia?: string | Media
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface Media {
|
||||
id: string
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
url?: string
|
||||
filename?: string
|
||||
mimeType?: string
|
||||
filesize?: number
|
||||
width?: number
|
||||
height?: number
|
||||
}
|
||||
export interface User {
|
||||
id: string
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
email?: string
|
||||
resetPasswordToken?: string
|
||||
resetPasswordExpiration?: string
|
||||
loginAttempts?: number
|
||||
lockUntil?: string
|
||||
password?: string
|
||||
}
|
||||
export interface Menu {
|
||||
id: string
|
||||
globalText?: string
|
||||
}
|
||||
13
test/email-resend/tsconfig.eslint.json
Normal file
13
test/email-resend/tsconfig.eslint.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
// extend your base config to share compilerOptions, etc
|
||||
//"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
// ensure that nobody can accidentally use this config for a build
|
||||
"noEmit": true
|
||||
},
|
||||
"include": [
|
||||
// whatever paths you intend to lint
|
||||
"./**/*.ts",
|
||||
"./**/*.tsx"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user