From 9532d56b5027bd6fab6fa23501d31f84cd88c570 Mon Sep 17 00:00:00 2001 From: natemoo-re Date: Mon, 20 Jun 2022 19:31:39 +0000 Subject: [PATCH] [ci] format --- .../sitemap/src/generate-sitemap.ts | 2 +- packages/integrations/sitemap/src/index.ts | 7 ++- packages/integrations/sitemap/src/schema.ts | 60 +++++++++---------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/packages/integrations/sitemap/src/generate-sitemap.ts b/packages/integrations/sitemap/src/generate-sitemap.ts index 0a5318c31..653d2d5a5 100644 --- a/packages/integrations/sitemap/src/generate-sitemap.ts +++ b/packages/integrations/sitemap/src/generate-sitemap.ts @@ -1,4 +1,4 @@ -import type { SitemapOptions, SitemapItem } from './index'; +import type { SitemapItem, SitemapOptions } from './index'; import { parseUrl } from './utils/parse-url'; const STATUS_CODE_PAGE_REGEXP = /\/[0-9]{3}\/?$/; diff --git a/packages/integrations/sitemap/src/index.ts b/packages/integrations/sitemap/src/index.ts index d0888d302..0f1a8d730 100644 --- a/packages/integrations/sitemap/src/index.ts +++ b/packages/integrations/sitemap/src/index.ts @@ -1,5 +1,10 @@ import type { AstroConfig, AstroIntegration } from 'astro'; -import { LinkItem as LinkItemBase, simpleSitemapAndIndex, SitemapItemLoose, EnumChangefreq } from 'sitemap'; +import { + EnumChangefreq, + LinkItem as LinkItemBase, + simpleSitemapAndIndex, + SitemapItemLoose, +} from 'sitemap'; import { fileURLToPath } from 'url'; import { ZodError } from 'zod'; diff --git a/packages/integrations/sitemap/src/schema.ts b/packages/integrations/sitemap/src/schema.ts index 3175a2e28..9f8ab7795 100644 --- a/packages/integrations/sitemap/src/schema.ts +++ b/packages/integrations/sitemap/src/schema.ts @@ -1,39 +1,39 @@ -import { z } from 'zod'; import { EnumChangefreq as ChangeFreq } from 'sitemap'; +import { z } from 'zod'; import { SITEMAP_CONFIG_DEFAULTS } from './config-defaults'; const localeKeySchema = z.string().min(1); export const SitemapOptionsSchema = z - .object({ - filter: z.function().args(z.string()).returns(z.boolean()).optional(), - customPages: z.string().url().array().optional(), - canonicalURL: z.string().url().optional(), + .object({ + filter: z.function().args(z.string()).returns(z.boolean()).optional(), + customPages: z.string().url().array().optional(), + canonicalURL: z.string().url().optional(), - i18n: z - .object({ - defaultLocale: localeKeySchema, - locales: z.record( - localeKeySchema, - z - .string() - .min(2) - .regex(/^[a-zA-Z\-]+$/gm, { - message: 'Only English alphabet symbols and hyphen allowed', - }), - ), - }) - .refine((val) => !val || val.locales[val.defaultLocale], { - message: '`defaultLocale` must exist in `locales` keys', - }) - .optional(), + i18n: z + .object({ + defaultLocale: localeKeySchema, + locales: z.record( + localeKeySchema, + z + .string() + .min(2) + .regex(/^[a-zA-Z\-]+$/gm, { + message: 'Only English alphabet symbols and hyphen allowed', + }) + ), + }) + .refine((val) => !val || val.locales[val.defaultLocale], { + message: '`defaultLocale` must exist in `locales` keys', + }) + .optional(), - entryLimit: z.number().nonnegative().optional().default(SITEMAP_CONFIG_DEFAULTS.entryLimit), - serialize: z.function().args(z.any()).returns(z.any()).optional(), + entryLimit: z.number().nonnegative().optional().default(SITEMAP_CONFIG_DEFAULTS.entryLimit), + serialize: z.function().args(z.any()).returns(z.any()).optional(), - changefreq: z.nativeEnum(ChangeFreq).optional(), - lastmod: z.date().optional(), - priority: z.number().min(0).max(1).optional(), - }) - .strict() - .default(SITEMAP_CONFIG_DEFAULTS); + changefreq: z.nativeEnum(ChangeFreq).optional(), + lastmod: z.date().optional(), + priority: z.number().min(0).max(1).optional(), + }) + .strict() + .default(SITEMAP_CONFIG_DEFAULTS);