chore: correct broken int test import paths

This commit is contained in:
Jarrod Flesch
2024-02-22 16:19:40 -05:00
parent 05b2692eb5
commit 65081d995e
16 changed files with 51 additions and 29 deletions

View File

@@ -21,12 +21,13 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0" "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}, },
"dependencies": { "dependencies": {
"@payloadcms/ui": "workspace:^",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"escape-html": "^1.0.3" "escape-html": "^1.0.3"
}, },
"devDependencies": { "devDependencies": {
"@types/escape-html": "^1.0.4",
"@payloadcms/eslint-config": "workspace:*", "@payloadcms/eslint-config": "workspace:*",
"@types/escape-html": "^1.0.4",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/react": "18.2.15", "@types/react": "18.2.15",
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",

View File

@@ -2,7 +2,7 @@
import type { TextField } from 'payload/dist/fields/config/types' import type { TextField } from 'payload/dist/fields/config/types'
import { Select, useForm } from 'payload/components/forms' import { Select, useForm } from '@payloadcms/ui'
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import type { SelectFieldOption } from '../../types' import type { SelectFieldOption } from '../../types'

View File

@@ -21,5 +21,5 @@
"src/**/mocks/*" "src/**/mocks/*"
], ],
"include": ["src/**/*"], "include": ["src/**/*"],
"references": [{ "path": "../payload" }] "references": [{ "path": "../payload" }, { "path": "../ui" }]
} }

View File

@@ -30,6 +30,7 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0" "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}, },
"dependencies": { "dependencies": {
"@payloadcms/ui": "workspace:^",
"ts-deepmerge": "^2.0.1" "ts-deepmerge": "^2.0.1"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -1,13 +1,12 @@
import type { Fields } from 'payload/dist/admin/components/forms/Form/types' import type { FormState } from '@payloadcms/ui'
import type { UIField } from 'payload/dist/fields/config/types' import type { UIField } from 'payload/types'
import { useWatchForm } from 'payload/components/forms' import { useConfig, useWatchForm } from '@payloadcms/ui'
import { useConfig } from 'payload/components/utilities' import React from 'react'
// TODO: fix this import to work in dev mode within the monorepo in a way that is backwards compatible with 1.x // TODO: fix this import to work in dev mode within the monorepo in a way that is backwards compatible with 1.x
// import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard' // import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard'
import React from 'react'
type FieldsWithDoc = Fields & { type FieldsWithDoc = FormState & {
doc: { doc: {
value: { value: {
relationTo: string relationTo: string
@@ -31,7 +30,7 @@ export const LinkToDoc: React.FC<UIField> = () => {
const { const {
routes: { routes: {
admin: adminRoute, // already includes leading slash admin: adminRoute, // already includes leading slash
} = {}, },
serverURL, serverURL,
} = config } = config

View File

@@ -20,5 +20,5 @@
"src/**/*.spec.tsx" "src/**/*.spec.tsx"
], ],
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"], "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"],
"references": [{ "path": "../payload" }] "references": [{ "path": "../payload" }, { "path": "../ui" }]
} }

View File

@@ -52,5 +52,8 @@
"dist", "dist",
"types.js", "types.js",
"types.d.ts" "types.d.ts"
] ],
"dependencies": {
"@payloadcms/ui": "workspace:^"
}
} }

View File

@@ -1,12 +1,11 @@
'use client' 'use client'
// TODO: fix this import to work in dev mode within the monorepo in a way that is backwards compatible with 1.x // TODO: fix this import to work in dev mode within the monorepo in a way that is backwards compatible with 1.x
// import TextareaInput from 'payload/dist/admin/components/forms/field-types/Textarea/Input' // import Textarea from 'payload/dist/admin/components/forms/field-types/Textarea/Input'
import type { FieldType, Options } from 'payload/dist/admin/components/forms/useField/types' import type { FieldType, Options } from '@payloadcms/ui'
import type { TextareaField } from 'payload/types' import type { TextareaField } from 'payload/types'
import { TextareaInput, useAllFormFields, useField } from 'payload/components/forms' import { Textarea, useAllFormFields, useDocumentInfo, useField, useLocale } from '@payloadcms/ui'
import { useDocumentInfo, useLocale } from 'payload/components/utilities'
import React, { useCallback } from 'react' import React, { useCallback } from 'react'
import type { PluginConfig } from '../types' import type { PluginConfig } from '../types'
@@ -108,7 +107,7 @@ export const MetaDescription: React.FC<MetaDescriptionProps> = (props) => {
position: 'relative', position: 'relative',
}} }}
> >
<TextareaInput <Textarea
name={name} name={name}
onChange={setValue} onChange={setValue}
path={name} path={name}

View File

@@ -20,5 +20,5 @@
"src/**/*.spec.tsx" "src/**/*.spec.tsx"
], ],
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"], "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"],
"references": [{ "path": "../payload" }] "references": [{ "path": "../payload" }, { "path": "../ui" }]
} }

View File

@@ -31,16 +31,17 @@
"payload": "^1.1.8 || ^2.0.0" "payload": "^1.1.8 || ^2.0.0"
}, },
"dependencies": { "dependencies": {
"@payloadcms/ui": "workspace:^",
"lodash.get": "^4.4.2", "lodash.get": "^4.4.2",
"stripe": "^10.2.0", "stripe": "^10.2.0",
"uuid": "^9.0.0" "uuid": "^9.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash.get": "^4.4.7",
"@types/uuid": "^9.0.0",
"@payloadcms/eslint-config": "workspace:*", "@payloadcms/eslint-config": "workspace:*",
"@types/express": "^4.17.9", "@types/express": "^4.17.9",
"@types/lodash.get": "^4.4.7",
"@types/react": "18.0.21", "@types/react": "18.0.21",
"@types/uuid": "^9.0.0",
"payload": "workspace:*", "payload": "workspace:*",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"react": "^18.0.0", "react": "^18.0.0",

View File

@@ -1,6 +1,6 @@
import type { UIField } from 'payload/dist/fields/config/types' import type { UIField } from 'payload/dist/fields/config/types'
import { useFormFields } from 'payload/components/forms' import { useFormFields } from '@payloadcms/ui/forms'
// TODO: fix this import to work in dev mode within the monorepo in a way that is backwards compatible with 1.x // TODO: fix this import to work in dev mode within the monorepo in a way that is backwards compatible with 1.x
// import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard' // import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard'
import React from 'react' import React from 'react'

View File

@@ -20,5 +20,5 @@
"src/**/*.spec.tsx" "src/**/*.spec.tsx"
], ],
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"], "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"],
"references": [{ "path": "../payload" }] "references": [{ "path": "../payload" }, { "path": "../ui" }]
} }

View File

@@ -19,9 +19,15 @@ export { default as CheckboxInput } from '../forms/fields/Checkbox'
export { default as Select } from '../forms/fields/Select' export { default as Select } from '../forms/fields/Select'
export { default as SelectInput } from '../forms/fields/Select' export { default as SelectInput } from '../forms/fields/Select'
export { default as Number } from '../forms/fields/Number' export { default as Number } from '../forms/fields/Number'
export { useAllFormFields } from '../forms/Form/context' export { default as Textarea } from '../forms/fields/Textarea'
export {
useAllFormFields,
useWatchForm,
useFormSubmitted,
useFormFields,
useForm,
} from '../forms/Form/context'
export { default as reduceFieldsToValues } from '../forms/Form/reduceFieldsToValues' export { default as reduceFieldsToValues } from '../forms/Form/reduceFieldsToValues'
export { useFormSubmitted } from '../forms/Form/context'
export { default as SectionTitle } from '../forms/fields/Blocks/SectionTitle' export { default as SectionTitle } from '../forms/fields/Blocks/SectionTitle'
export { createNestedFieldPath } from '../forms/Form/createNestedFieldPath' export { createNestedFieldPath } from '../forms/Form/createNestedFieldPath'
export { default as buildInitialState } from '../forms/Form' export { default as buildInitialState } from '../forms/Form'
@@ -30,3 +36,4 @@ export { default as useField } from '../forms/useField'
export { default as Error } from '../forms/Error' export { default as Error } from '../forms/Error'
export type { BuildFormStateArgs } from '../forms/utilities/buildStateFromSchema' export type { BuildFormStateArgs } from '../forms/utilities/buildStateFromSchema'
export { FieldPathProvider } from '../forms/FieldPathProvider' export { FieldPathProvider } from '../forms/FieldPathProvider'
export type { Options, FieldType } from '../forms/useField/types'

13
pnpm-lock.yaml generated
View File

@@ -915,6 +915,9 @@ importers:
packages/plugin-form-builder: packages/plugin-form-builder:
dependencies: dependencies:
'@payloadcms/ui':
specifier: workspace:^
version: link:../ui
deepmerge: deepmerge:
specifier: ^4.2.2 specifier: ^4.2.2
version: 4.3.1 version: 4.3.1
@@ -982,6 +985,9 @@ importers:
packages/plugin-search: packages/plugin-search:
dependencies: dependencies:
'@payloadcms/ui':
specifier: workspace:^
version: link:../ui
ts-deepmerge: ts-deepmerge:
specifier: ^2.0.1 specifier: ^2.0.1
version: 2.0.7 version: 2.0.7
@@ -1058,6 +1064,10 @@ importers:
version: 5.90.2(@swc/core@1.4.1) version: 5.90.2(@swc/core@1.4.1)
packages/plugin-seo: packages/plugin-seo:
dependencies:
'@payloadcms/ui':
specifier: workspace:^
version: link:../ui
devDependencies: devDependencies:
'@payloadcms/eslint-config': '@payloadcms/eslint-config':
specifier: workspace:* specifier: workspace:*
@@ -1077,6 +1087,9 @@ importers:
packages/plugin-stripe: packages/plugin-stripe:
dependencies: dependencies:
'@payloadcms/ui':
specifier: workspace:^
version: link:../ui
lodash.get: lodash.get:
specifier: ^4.4.2 specifier: ^4.4.2
version: 4.4.2 version: 4.4.2

View File

@@ -13,7 +13,7 @@ export const endpoints: Config['endpoints'] = [
{ {
path: `/${applicationEndpoint}`, path: `/${applicationEndpoint}`,
method: 'get', method: 'get',
handler: ({ req }) => { handler: () => {
return Response.json({ message: 'Hello, world!' }) return Response.json({ message: 'Hello, world!' })
}, },
}, },
@@ -21,13 +21,12 @@ export const endpoints: Config['endpoints'] = [
path: `/${applicationEndpoint}/i18n`, path: `/${applicationEndpoint}/i18n`,
method: 'get', method: 'get',
handler: ({ req }) => { handler: ({ req }) => {
return Response.json({ message: req.t('general:backToDashboard') }) return Response.json({ message: req.t('general:updatedSuccessfully') })
}, },
}, },
{ {
path: `/${rootEndpoint}`, path: `/${rootEndpoint}`,
method: 'get', method: 'get',
root: true,
handler: () => { handler: () => {
return Response.json({ message: 'Hello, world!' }) return Response.json({ message: 'Hello, world!' })
}, },
@@ -35,7 +34,6 @@ export const endpoints: Config['endpoints'] = [
{ {
path: `/${rootEndpoint}`, path: `/${rootEndpoint}`,
method: 'post', method: 'post',
root: true,
handler: ({ req }) => { handler: ({ req }) => {
return Response.json(req.body) return Response.json(req.body)
}, },

View File

@@ -88,7 +88,7 @@ describe('Endpoints', () => {
const data = await response.json() const data = await response.json()
expect(response.status).toBe(200) expect(response.status).toBe(200)
expect(data.message).toStrictEqual('Back to Dashboard') expect(data.message).toStrictEqual('Updated successfully.')
}) })
}) })