feat: properly export types

This commit is contained in:
Elliot DeNolf
2022-11-26 08:05:09 -05:00
parent a0d479ead8
commit 3e5da25a24
6 changed files with 25 additions and 13 deletions

View File

@@ -130,7 +130,7 @@ import {
GenerateTitle,
GenerateDescription
GenerateURL
} from '@payloadcms/plugin-seo/dist/types';
} from '@payloadcms/plugin-seo/types';
```
## Development

View File

@@ -1,12 +1,12 @@
import { buildConfig } from 'payload/config';
import path from 'path';
// import seo from '../../dist';
import seo from '../../src';
import Users from './collections/Users';
import Pages from './collections/Pages';
import Media from './collections/Media';
import HomePage from './globals/Settings';
import Posts from './collections/Posts';
import seo from '../../src'
import Users from './collections/Users'
import Pages from './collections/Pages'
import Media from './collections/Media'
import HomePage from './globals/Settings'
import Posts from './collections/Posts'
export default buildConfig({
serverURL: 'http://localhost:3000',

View File

@@ -31,6 +31,8 @@
"typescript": "^4.5.5"
},
"files": [
"dist"
"dist",
"*.js",
"*.d.ts"
]
}

View File

@@ -1,4 +1,12 @@
import { Field } from "payload/dist/fields/config/types";
import { Field } from 'payload/dist/fields/config/types';
export type GenerateTitle = <T = any>(args: { doc: T; locale?: string }) => string | Promise<string>
export type GenerateDescription = <T = any>(args: {
doc: T
locale?: string
}) => string | Promise<string>
export type GenerateImage = <T = any>(args: { doc: T; locale?: string }) => string | Promise<string>
export type GenerateURL = <T = any>(args: { doc: T; locale?: string }) => string | Promise<string>
export type PluginConfig = {
collections?: string[]
@@ -6,10 +14,10 @@ export type PluginConfig = {
uploadsCollection?: string
fields?: Partial<Field>[]
tabbedUI?: boolean
generateTitle?: <T = any>(args: { doc: T, locale?: string }) => string | Promise<string>
generateDescription?: <T = any>(args: { doc: T, locale?: string }) => string | Promise<string>
generateImage?: <T = any>(args: { doc: T, locale?: string }) => string | Promise<string>
generateURL?: <T = any>(args: { doc: T, locale?: string }) => string | Promise<string>
generateTitle?: GenerateTitle
generateDescription?: GenerateDescription
generateImage?: GenerateImage
generateURL?: GenerateURL
}
export type Meta = {

1
packages/plugin-seo/types.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/types';

View File

@@ -0,0 +1 @@
module.exports = require('./dist/types');