chore(plugin-seo): prettier, lint, adjust package.json

This commit is contained in:
Alessio Gravili
2024-03-04 14:40:45 -05:00
parent 995ae21075
commit ece796432a
13 changed files with 106 additions and 130 deletions

View File

@@ -35,7 +35,6 @@
}, },
"devDependencies": { "devDependencies": {
"@payloadcms/eslint-config": "workspace:*", "@payloadcms/eslint-config": "workspace:*",
"@types/express": "4.17.17",
"@types/react": "18.2.15", "@types/react": "18.2.15",
"payload": "workspace:*", "payload": "workspace:*",
"@payloadcms/translations": "workspace:*", "@payloadcms/translations": "workspace:*",

View File

@@ -35,7 +35,7 @@ export const MetaDescription: React.FC<MetaDescriptionProps> = (props) => {
path, path,
} as Options) } as Options)
const { setValue, showError, value, errorMessage } = field const { errorMessage, setValue, showError, value } = field
const regenerateDescription = useCallback(async () => { const regenerateDescription = useCallback(async () => {
const { generateDescription } = pluginConfig const { generateDescription } = pluginConfig
@@ -70,8 +70,8 @@ export const MetaDescription: React.FC<MetaDescriptionProps> = (props) => {
{required && ( {required && (
<span <span
style={{ style={{
marginLeft: '5px',
color: 'var(--theme-error-500)', color: 'var(--theme-error-500)',
marginLeft: '5px',
}} }}
> >
* *
@@ -121,15 +121,15 @@ export const MetaDescription: React.FC<MetaDescriptionProps> = (props) => {
}} }}
> >
<Textarea <Textarea
errorMessage={errorMessage}
name={name} name={name}
onChange={setValue} onChange={setValue}
path={name} path={name}
required={required}
showError={showError} showError={showError}
style={{ style={{
marginBottom: 0, marginBottom: 0,
}} }}
required={required}
errorMessage={errorMessage}
value={value} value={value}
/> />
</div> </div>

View File

@@ -29,7 +29,7 @@ export const MetaImage: React.FC<MetaImageProps> = (props) => {
const [fields] = useAllFormFields() const [fields] = useAllFormFields()
const docInfo = useDocumentInfo() const docInfo = useDocumentInfo()
const { setValue, showError, value, errorMessage } = field const { errorMessage, setValue, showError, value } = field
const regenerateImage = useCallback(async () => { const regenerateImage = useCallback(async () => {
const { generateImage } = pluginConfig const { generateImage } = pluginConfig
@@ -72,8 +72,8 @@ export const MetaImage: React.FC<MetaImageProps> = (props) => {
{required && ( {required && (
<span <span
style={{ style={{
marginLeft: '5px',
color: 'var(--theme-error-500)', color: 'var(--theme-error-500)',
marginLeft: '5px',
}} }}
> >
* *
@@ -120,10 +120,9 @@ export const MetaImage: React.FC<MetaImageProps> = (props) => {
<UploadInput <UploadInput
api={api} api={api}
collection={collection} collection={collection}
errorMessage={errorMessage}
fieldTypes={fieldTypes} fieldTypes={fieldTypes}
filterOptions={{}} filterOptions={{}}
errorMessage={errorMessage}
required={required}
label={undefined} label={undefined}
name={name} name={name}
onChange={(incomingImage) => { onChange={(incomingImage) => {
@@ -136,6 +135,7 @@ export const MetaImage: React.FC<MetaImageProps> = (props) => {
}} }}
path={name} path={name}
relationTo={relationTo} relationTo={relationTo}
required={required}
serverURL={serverURL} serverURL={serverURL}
showError={showError} showError={showError}
style={{ style={{

View File

@@ -39,7 +39,7 @@ export const MetaTitle: React.FC<MetaTitleProps> = (props) => {
const [fields] = useAllFormFields() const [fields] = useAllFormFields()
const docInfo = useDocumentInfo() const docInfo = useDocumentInfo()
const { setValue, showError, value, errorMessage } = field const { errorMessage, setValue, showError, value } = field
const regenerateTitle = useCallback(async () => { const regenerateTitle = useCallback(async () => {
const { generateTitle } = pluginConfig const { generateTitle } = pluginConfig
@@ -74,8 +74,8 @@ export const MetaTitle: React.FC<MetaTitleProps> = (props) => {
{required && ( {required && (
<span <span
style={{ style={{
marginLeft: '5px',
color: 'var(--theme-error-500)', color: 'var(--theme-error-500)',
marginLeft: '5px',
}} }}
> >
* *
@@ -126,15 +126,15 @@ export const MetaTitle: React.FC<MetaTitleProps> = (props) => {
}} }}
> >
<TextInput <TextInput
errorMessage={errorMessage}
name={name} name={name}
onChange={setValue} onChange={setValue}
path={name} path={name}
required={required}
showError={showError} showError={showError}
style={{ style={{
marginBottom: 0, marginBottom: 0,
}} }}
errorMessage={errorMessage}
required={required}
value={value} value={value}
/> />
</div> </div>

View File

@@ -1,22 +1,22 @@
{ {
"$schema": "./translation-schema.json", "$schema": "./translation-schema.json",
"plugin-seo": { "plugin-seo": {
"autoGenerate": "Auto-generate",
"imageAutoGenerationTip": "Auto-generation will retrieve the selected hero image.",
"bestPractices": "best practices",
"lengthTipTitle": "This should be between {{minLength}} and {{maxLength}} characters. For help in writing quality meta titles, see ",
"lengthTipDescription": "This should be between {{minLength}} and {{maxLength}} characters. For help in writing quality meta descriptions, see ",
"good": "Good",
"tooLong": "Too long",
"tooShort": "Too short",
"almostThere": "Almost there", "almostThere": "Almost there",
"autoGenerate": "Auto-generate",
"bestPractices": "best practices",
"characterCount": "{{current}}/{{minLength}}-{{maxLength}} chars, ", "characterCount": "{{current}}/{{minLength}}-{{maxLength}} chars, ",
"charactersToGo": "{{characters}} to go",
"charactersLeftOver": "{{characters}} left over", "charactersLeftOver": "{{characters}} left over",
"charactersToGo": "{{characters}} to go",
"charactersTooMany": "{{characters}} too many", "charactersTooMany": "{{characters}} too many",
"noImage": "No image",
"checksPassing": "{{current}}/{{max}} checks are passing", "checksPassing": "{{current}}/{{max}} checks are passing",
"good": "Good",
"imageAutoGenerationTip": "Auto-generation will retrieve the selected hero image.",
"lengthTipDescription": "This should be between {{minLength}} and {{maxLength}} characters. For help in writing quality meta descriptions, see ",
"lengthTipTitle": "This should be between {{minLength}} and {{maxLength}} characters. For help in writing quality meta titles, see ",
"noImage": "No image",
"preview": "Preview", "preview": "Preview",
"previewDescription": "Exact result listings may vary based on content and search relevancy." "previewDescription": "Exact result listings may vary based on content and search relevancy.",
"tooLong": "Too long",
"tooShort": "Too short"
} }
} }

View File

@@ -1,22 +1,22 @@
{ {
"$schema": "./translation-schema.json", "$schema": "./translation-schema.json",
"plugin-seo": { "plugin-seo": {
"autoGenerate": "Autogénerar",
"imageAutoGenerationTip": "La autogeneración recuperará la imagen de héroe seleccionada.",
"bestPractices": "mejores prácticas",
"lengthTipTitle": "Debe tener entre {{minLength}} y {{maxLength}} caracteres. Para obtener ayuda sobre cómo escribir metatítulos de calidad, consulte ",
"lengthTipDescription": "Esto debe estar entre {{minLength}} y {{maxLength}} caracteres. Para obtener ayuda sobre cómo escribir meta descripciones de calidad, consulte ",
"good": "Bien",
"tooLong": "Demasiado largo",
"tooShort": "Demasiado corto",
"almostThere": "Ya casi está", "almostThere": "Ya casi está",
"autoGenerate": "Autogénerar",
"bestPractices": "mejores prácticas",
"characterCount": "{{current}}/{{minLength}}-{{maxLength}} letras, ", "characterCount": "{{current}}/{{minLength}}-{{maxLength}} letras, ",
"charactersToGo": "{{characters}} letras sobrantes",
"charactersLeftOver": "{{characters}} letras sobrantes", "charactersLeftOver": "{{characters}} letras sobrantes",
"charactersToGo": "{{characters}} letras sobrantes",
"charactersTooMany": "{{characters}} letras demasiados", "charactersTooMany": "{{characters}} letras demasiados",
"noImage": "Sin imagen",
"checksPassing": "{{current}}/{{max}} las comprobaciones están pasando", "checksPassing": "{{current}}/{{max}} las comprobaciones están pasando",
"good": "Bien",
"imageAutoGenerationTip": "La autogeneración recuperará la imagen de héroe seleccionada.",
"lengthTipDescription": "Esto debe estar entre {{minLength}} y {{maxLength}} caracteres. Para obtener ayuda sobre cómo escribir meta descripciones de calidad, consulte ",
"lengthTipTitle": "Debe tener entre {{minLength}} y {{maxLength}} caracteres. Para obtener ayuda sobre cómo escribir metatítulos de calidad, consulte ",
"noImage": "Sin imagen",
"preview": "Vista previa", "preview": "Vista previa",
"previewDescription": "Las listas de resultados pueden variar segun la relevancia de buesqueda y el contenido." "previewDescription": "Las listas de resultados pueden variar segun la relevancia de buesqueda y el contenido.",
"tooLong": "Demasiado largo",
"tooShort": "Demasiado corto"
} }
} }

View File

@@ -1,22 +1,22 @@
{ {
"$schema": "./translation-schema.json", "$schema": "./translation-schema.json",
"plugin-seo": { "plugin-seo": {
"autoGenerate": "تولید خودکار",
"imageAutoGenerationTip": "این قابلیت، تصویر فعلی بارگذاری شده در مجموعه محتوای شما را بازیابی می‌کند",
"bestPractices": "آموزش بیشتر",
"lengthTipTitle": "این باید بین {{minLength}} و {{maxLength}} کلمه باشد. برای کمک در نوشتن عناوین متا با کیفیت، مراجعه کنید به ",
"lengthTipDescription": "این باید بین {{minLength}} و {{maxLength}} کلمه باشد. برای کمک در نوشتن توضیحات متا با کیفیت، مراجعه کنید به ",
"good": "خوب",
"tooLong": "خیلی طولانی",
"tooShort": "خیلی کوتاه",
"almostThere": "چیزیی باقی نمونده", "almostThere": "چیزیی باقی نمونده",
"autoGenerate": "تولید خودکار",
"bestPractices": "آموزش بیشتر",
"characterCount": "{{current}}/{{minLength}}-{{maxLength}} کلمه، ", "characterCount": "{{current}}/{{minLength}}-{{maxLength}} کلمه، ",
"charactersToGo": "{{characters}} باقی مانده",
"charactersLeftOver": "{{characters}} باقی مانده", "charactersLeftOver": "{{characters}} باقی مانده",
"charactersToGo": "{{characters}} باقی مانده",
"charactersTooMany": "{{characters}} بیش از حد", "charactersTooMany": "{{characters}} بیش از حد",
"noImage": "بدون تصویر",
"checksPassing": "{{current}}/{{max}} بررسی‌ها با موفقیت انجام شده است", "checksPassing": "{{current}}/{{max}} بررسی‌ها با موفقیت انجام شده است",
"good": "خوب",
"imageAutoGenerationTip": "این قابلیت، تصویر فعلی بارگذاری شده در مجموعه محتوای شما را بازیابی می‌کند",
"lengthTipDescription": "این باید بین {{minLength}} و {{maxLength}} کلمه باشد. برای کمک در نوشتن توضیحات متا با کیفیت، مراجعه کنید به ",
"lengthTipTitle": "این باید بین {{minLength}} و {{maxLength}} کلمه باشد. برای کمک در نوشتن عناوین متا با کیفیت، مراجعه کنید به ",
"noImage": "بدون تصویر",
"preview": "پیش‌نمایش", "preview": "پیش‌نمایش",
"previewDescription": "فهرست نتایج ممکن است بر اساس محتوا و متناسب با کلمه کلیدی جستجو شده باشند" "previewDescription": "فهرست نتایج ممکن است بر اساس محتوا و متناسب با کلمه کلیدی جستجو شده باشند",
"tooLong": "خیلی طولانی",
"tooShort": "خیلی کوتاه"
} }
} }

View File

@@ -1,22 +1,22 @@
{ {
"$schema": "./translation-schema.json", "$schema": "./translation-schema.json",
"plugin-seo": { "plugin-seo": {
"autoGenerate": "Auto-générer",
"imageAutoGenerationTip": "L'auto-génération récupérera l'image principale sélectionnée.",
"bestPractices": "bonnes pratiques",
"lengthTipTitle": "Ceci devrait contenir entre {{minLength}} et {{maxLength}} caractères. Pour obtenir de l'aide pour rédiger des titres meta de qualité, consultez les ",
"lengthTipDescription": "Ceci devrait contenir entre {{minLength}} et {{maxLength}} caractères. Pour obtenir de l'aide pour rédiger des descriptions meta de qualité, consultez les ",
"good": "Bien",
"tooLong": "Trop long",
"tooShort": "Trop court",
"almostThere": "On y est presque", "almostThere": "On y est presque",
"autoGenerate": "Auto-générer",
"bestPractices": "bonnes pratiques",
"characterCount": "{{current}}/{{minLength}}-{{maxLength}} caractères, ", "characterCount": "{{current}}/{{minLength}}-{{maxLength}} caractères, ",
"charactersToGo": "{{characters}} à ajouter",
"charactersLeftOver": "{{characters}} restants", "charactersLeftOver": "{{characters}} restants",
"charactersToGo": "{{characters}} à ajouter",
"charactersTooMany": "{{characters}} en trop", "charactersTooMany": "{{characters}} en trop",
"noImage": "Pas d'image",
"checksPassing": "{{current}}/{{max}} vérifications réussies", "checksPassing": "{{current}}/{{max}} vérifications réussies",
"good": "Bien",
"imageAutoGenerationTip": "L'auto-génération récupérera l'image principale sélectionnée.",
"lengthTipDescription": "Ceci devrait contenir entre {{minLength}} et {{maxLength}} caractères. Pour obtenir de l'aide pour rédiger des descriptions meta de qualité, consultez les ",
"lengthTipTitle": "Ceci devrait contenir entre {{minLength}} et {{maxLength}} caractères. Pour obtenir de l'aide pour rédiger des titres meta de qualité, consultez les ",
"noImage": "Pas d'image",
"preview": "Aperçu", "preview": "Aperçu",
"previewDescription": "Les résultats exacts peuvent varier en fonction du contenu et de la pertinence de la recherche." "previewDescription": "Les résultats exacts peuvent varier en fonction du contenu et de la pertinence de la recherche.",
"tooLong": "Trop long",
"tooShort": "Trop court"
} }
} }

View File

@@ -1,22 +1,22 @@
{ {
"$schema": "./translation-schema.json", "$schema": "./translation-schema.json",
"plugin-seo": { "plugin-seo": {
"autoGenerate": "Wygeneruj automatycznie",
"imageAutoGenerationTip": "Automatyczne generowanie pobierze wybrany główny obraz.",
"bestPractices": "najlepsze praktyki",
"lengthTipTitle": "Długość powinna wynosić od {{minLength}} do {{maxLength}} znaków. Po porady dotyczące pisania wysokiej jakości meta tytułów zobacz ",
"lengthTipDescription": "Długość powinna wynosić od {{minLength}} do {{maxLength}} znaków. Po porady dotyczące pisania wysokiej jakości meta opisów zobacz ",
"good": "Dobrze",
"tooLong": "Zbyt długie",
"tooShort": "Zbyt krótkie",
"almostThere": "Prawie gotowe", "almostThere": "Prawie gotowe",
"autoGenerate": "Wygeneruj automatycznie",
"bestPractices": "najlepsze praktyki",
"characterCount": "{{current}}/{{minLength}}-{{maxLength}} znaków, ", "characterCount": "{{current}}/{{minLength}}-{{maxLength}} znaków, ",
"charactersToGo": "pozostało {{characters}} znaków",
"charactersLeftOver": "zostało {{characters}} znaków", "charactersLeftOver": "zostało {{characters}} znaków",
"charactersToGo": "pozostało {{characters}} znaków",
"charactersTooMany": "{{characters}} znaków za dużo", "charactersTooMany": "{{characters}} znaków za dużo",
"noImage": "Brak obrazu",
"checksPassing": "{{current}}/{{max}} testów zakończonych pomyślnie", "checksPassing": "{{current}}/{{max}} testów zakończonych pomyślnie",
"good": "Dobrze",
"imageAutoGenerationTip": "Automatyczne generowanie pobierze wybrany główny obraz.",
"lengthTipDescription": "Długość powinna wynosić od {{minLength}} do {{maxLength}} znaków. Po porady dotyczące pisania wysokiej jakości meta opisów zobacz ",
"lengthTipTitle": "Długość powinna wynosić od {{minLength}} do {{maxLength}} znaków. Po porady dotyczące pisania wysokiej jakości meta tytułów zobacz ",
"noImage": "Brak obrazu",
"preview": "Podgląd", "preview": "Podgląd",
"previewDescription": "Dokładne wyniki listowania mogą się różnić w zależności od treści i zgodności z kryteriami wyszukiwania." "previewDescription": "Dokładne wyniki listowania mogą się różnić w zależności od treści i zgodności z kryteriami wyszukiwania.",
"tooLong": "Zbyt długie",
"tooShort": "Zbyt krótkie"
} }
} }

View File

@@ -1,4 +1,5 @@
{ {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#", "$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
@@ -6,51 +7,46 @@
"type": "string" "type": "string"
}, },
"plugin-seo": { "plugin-seo": {
"type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"autoGenerate": { "almostThere": {
"type": "string" "type": "string"
}, },
"imageAutoGenerationTip": { "autoGenerate": {
"type": "string" "type": "string"
}, },
"bestPractices": { "bestPractices": {
"type": "string" "type": "string"
}, },
"lengthTipTitle": {
"type": "string"
},
"lengthTipDescription": {
"type": "string"
},
"good": {
"type": "string"
},
"tooLong": {
"type": "string"
},
"tooShort": {
"type": "string"
},
"almostThere": {
"type": "string"
},
"characterCount": { "characterCount": {
"type": "string" "type": "string"
}, },
"charactersToGo": {
"type": "string"
},
"charactersLeftOver": { "charactersLeftOver": {
"type": "string" "type": "string"
}, },
"charactersToGo": {
"type": "string"
},
"charactersTooMany": { "charactersTooMany": {
"type": "string" "type": "string"
}, },
"noImage": { "checksPassing": {
"type": "string" "type": "string"
}, },
"checksPassing": { "good": {
"type": "string"
},
"imageAutoGenerationTip": {
"type": "string"
},
"lengthTipDescription": {
"type": "string"
},
"lengthTipTitle": {
"type": "string"
},
"noImage": {
"type": "string" "type": "string"
}, },
"preview": { "preview": {
@@ -58,6 +54,12 @@
}, },
"previewDescription": { "previewDescription": {
"type": "string" "type": "string"
},
"tooLong": {
"type": "string"
},
"tooShort": {
"type": "string"
} }
}, },
"required": [ "required": [
@@ -78,10 +80,8 @@
"checksPassing", "checksPassing",
"preview", "preview",
"previewDescription" "previewDescription"
], ]
"type": "object"
} }
}, },
"required": ["plugin-seo"], "required": ["plugin-seo"]
"type": "object"
} }

3
pnpm-lock.yaml generated
View File

@@ -1073,9 +1073,6 @@ importers:
'@payloadcms/ui': '@payloadcms/ui':
specifier: workspace:* specifier: workspace:*
version: link:../ui version: link:../ui
'@types/express':
specifier: 4.17.17
version: 4.17.17
'@types/react': '@types/react':
specifier: 18.2.15 specifier: 18.2.15
version: 18.2.15 version: 18.2.15

View File

@@ -1,5 +1,3 @@
import path from 'path'
import seoPlugin from '../../packages/plugin-seo/src' import seoPlugin from '../../packages/plugin-seo/src'
import { buildConfigWithDefaults } from '../buildConfigWithDefaults' import { buildConfigWithDefaults } from '../buildConfigWithDefaults'
import { devUser } from '../credentials' import { devUser } from '../credentials'
@@ -8,8 +6,6 @@ import { Pages } from './collections/Pages'
import { Users } from './collections/Users' import { Users } from './collections/Users'
import { seed } from './seed' import { seed } from './seed'
const mockModulePath = path.resolve(__dirname, './mocks/mockFSModule.js')
export default buildConfigWithDefaults({ export default buildConfigWithDefaults({
collections: [Users, Pages, Media], collections: [Users, Pages, Media],
localization: { localization: {
@@ -17,18 +13,6 @@ export default buildConfigWithDefaults({
fallback: true, fallback: true,
locales: ['en', 'es', 'de'], locales: ['en', 'es', 'de'],
}, },
admin: {
webpack: (config) => ({
...config,
resolve: {
...config.resolve,
alias: {
...config?.resolve?.alias,
fs: mockModulePath,
},
},
}),
},
i18n: { i18n: {
resources: { resources: {
es: { es: {

View File

@@ -1,4 +0,0 @@
export default {
readdirSync: () => {},
rmSync: () => {},
}