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"
},
"dependencies": {
"@payloadcms/ui": "workspace:^",
"deepmerge": "^4.2.2",
"escape-html": "^1.0.3"
},
"devDependencies": {
"@types/escape-html": "^1.0.4",
"@payloadcms/eslint-config": "workspace:*",
"@types/escape-html": "^1.0.4",
"@types/express": "^4.17.21",
"@types/react": "18.2.15",
"copyfiles": "^2.4.1",

View File

@@ -2,7 +2,7 @@
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 type { SelectFieldOption } from '../../types'

View File

@@ -21,5 +21,5 @@
"src/**/mocks/*"
],
"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"
},
"dependencies": {
"@payloadcms/ui": "workspace:^",
"ts-deepmerge": "^2.0.1"
},
"devDependencies": {

View File

@@ -1,13 +1,12 @@
import type { Fields } from 'payload/dist/admin/components/forms/Form/types'
import type { UIField } from 'payload/dist/fields/config/types'
import type { FormState } from '@payloadcms/ui'
import type { UIField } from 'payload/types'
import { useWatchForm } from 'payload/components/forms'
import { useConfig } from 'payload/components/utilities'
import { useConfig, useWatchForm } from '@payloadcms/ui'
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
// import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard'
import React from 'react'
type FieldsWithDoc = Fields & {
type FieldsWithDoc = FormState & {
doc: {
value: {
relationTo: string
@@ -31,7 +30,7 @@ export const LinkToDoc: React.FC<UIField> = () => {
const {
routes: {
admin: adminRoute, // already includes leading slash
} = {},
},
serverURL,
} = config

View File

@@ -20,5 +20,5 @@
"src/**/*.spec.tsx"
],
"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",
"types.js",
"types.d.ts"
]
],
"dependencies": {
"@payloadcms/ui": "workspace:^"
}
}

View File

@@ -1,12 +1,11 @@
'use client'
// 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 type { FieldType, Options } from 'payload/dist/admin/components/forms/useField/types'
// import Textarea from 'payload/dist/admin/components/forms/field-types/Textarea/Input'
import type { FieldType, Options } from '@payloadcms/ui'
import type { TextareaField } from 'payload/types'
import { TextareaInput, useAllFormFields, useField } from 'payload/components/forms'
import { useDocumentInfo, useLocale } from 'payload/components/utilities'
import { Textarea, useAllFormFields, useDocumentInfo, useField, useLocale } from '@payloadcms/ui'
import React, { useCallback } from 'react'
import type { PluginConfig } from '../types'
@@ -108,7 +107,7 @@ export const MetaDescription: React.FC<MetaDescriptionProps> = (props) => {
position: 'relative',
}}
>
<TextareaInput
<Textarea
name={name}
onChange={setValue}
path={name}

View File

@@ -20,5 +20,5 @@
"src/**/*.spec.tsx"
],
"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"
},
"dependencies": {
"@payloadcms/ui": "workspace:^",
"lodash.get": "^4.4.2",
"stripe": "^10.2.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"@types/lodash.get": "^4.4.7",
"@types/uuid": "^9.0.0",
"@payloadcms/eslint-config": "workspace:*",
"@types/express": "^4.17.9",
"@types/lodash.get": "^4.4.7",
"@types/react": "18.0.21",
"@types/uuid": "^9.0.0",
"payload": "workspace:*",
"prettier": "^2.7.1",
"react": "^18.0.0",

View File

@@ -1,6 +1,6 @@
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
// import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard'
import React from 'react'

View File

@@ -20,5 +20,5 @@
"src/**/*.spec.tsx"
],
"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 SelectInput } from '../forms/fields/Select'
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 { useFormSubmitted } from '../forms/Form/context'
export { default as SectionTitle } from '../forms/fields/Blocks/SectionTitle'
export { createNestedFieldPath } from '../forms/Form/createNestedFieldPath'
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 type { BuildFormStateArgs } from '../forms/utilities/buildStateFromSchema'
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:
dependencies:
'@payloadcms/ui':
specifier: workspace:^
version: link:../ui
deepmerge:
specifier: ^4.2.2
version: 4.3.1
@@ -982,6 +985,9 @@ importers:
packages/plugin-search:
dependencies:
'@payloadcms/ui':
specifier: workspace:^
version: link:../ui
ts-deepmerge:
specifier: ^2.0.1
version: 2.0.7
@@ -1058,6 +1064,10 @@ importers:
version: 5.90.2(@swc/core@1.4.1)
packages/plugin-seo:
dependencies:
'@payloadcms/ui':
specifier: workspace:^
version: link:../ui
devDependencies:
'@payloadcms/eslint-config':
specifier: workspace:*
@@ -1077,6 +1087,9 @@ importers:
packages/plugin-stripe:
dependencies:
'@payloadcms/ui':
specifier: workspace:^
version: link:../ui
lodash.get:
specifier: ^4.4.2
version: 4.4.2

View File

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

View File

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