From 5aad1e7fb3ff7a5831120cba42a94783feb64116 Mon Sep 17 00:00:00 2001 From: Adam Matthiesen Date: Thu, 25 Jan 2024 09:48:29 -0800 Subject: [PATCH] cleanup --- packages/astro-ghostcms/index.ts | 2 +- packages/astro-ghostcms/src/api/invariant.ts | 5 +++++ packages/astro-ghostcms/src/schemas/robots.ts | 13 +++++++------ packages/astro-ghostcms/src/schemas/sitemap.ts | 8 ++++---- pnpm-lock.yaml | 18 ++++-------------- 5 files changed, 21 insertions(+), 25 deletions(-) diff --git a/packages/astro-ghostcms/index.ts b/packages/astro-ghostcms/index.ts index c6fd1faa..98a9bf8c 100644 --- a/packages/astro-ghostcms/index.ts +++ b/packages/astro-ghostcms/index.ts @@ -53,7 +53,7 @@ const ENV = loadEnv(IC.MODE, process.cwd(), IC.PREFIXES); /** Astro-GhostCMS Integration * @ For more information and to see the docs check - * @ https://astro-ghostcms.xyz + * @see https://astro-ghostcms.xyz */ export default function GhostCMS(options: UserConfig): AstroIntegration { return { diff --git a/packages/astro-ghostcms/src/api/invariant.ts b/packages/astro-ghostcms/src/api/invariant.ts index de083c99..fcafba2e 100644 --- a/packages/astro-ghostcms/src/api/invariant.ts +++ b/packages/astro-ghostcms/src/api/invariant.ts @@ -4,6 +4,11 @@ const prefix: string = 'Invariant failed'; // Throw an error if the condition fails // Strip out error messages for production // > Not providing an inline default argument for message as the result is smaller +/** Throw an error if the condition is false + * @example + * import { invariant } from '@matthiesenxyz/astro-ghostcms/api'; + * invariant(var, "var is false but its not supposed to be!") + */ export function invariant( // biome-ignore lint/suspicious/noExplicitAny: we know what we are doing condition: any, diff --git a/packages/astro-ghostcms/src/schemas/robots.ts b/packages/astro-ghostcms/src/schemas/robots.ts index 56b099b2..26b8d254 100644 --- a/packages/astro-ghostcms/src/schemas/robots.ts +++ b/packages/astro-ghostcms/src/schemas/robots.ts @@ -18,17 +18,18 @@ const RobotsPolicySchema = z.object({ }) export const RobotsTxtSchema = z.object({ - /** EXAMPLE1 host: true - automatically resolve using the site option from Astro config - * EXAMPLE2 host: 'example.com' + /** @example host: true + * // Automatically resolve using the site option from Astro config + * @example host: 'example.com' */ host: z.string().optional(), - /** EXAMPLE1 sitemap: "https://example.com/sitemap-0.xml" - * EXAMPLE2 sitemap: ['https://example.com/sitemap-0.xml','https://example.com/sitemap-1.xml'] - * EXAMPLE3 sitemap: false - If you want to get the robots.txt file without the Sitemap: ... entry, set the sitemap parameter to false. + /** @example sitemap: "https://example.com/sitemap-0.xml" + * @example sitemap: ['https://example.com/sitemap-0.xml','https://example.com/sitemap-1.xml'] + * @example sitemap: false - If you want to get the robots.txt file without the Sitemap: ... entry, set the sitemap parameter to false. */ sitemap: z.string().optional(), /** astrojs/sitemap and astro-sitemap integrations have the sitemap-index.xml as their primary output. That is why the default value of sitemapBaseFileName is set to sitemap-index. - * EXAMPLE sitemapBaseFileName: 'custom-sitemap' + * @example sitemapBaseFileName: 'custom-sitemap' */ sitemapBaseFileName: z.string().optional(), /** SET POLICY RULES */ diff --git a/packages/astro-ghostcms/src/schemas/sitemap.ts b/packages/astro-ghostcms/src/schemas/sitemap.ts index d39b3ffa..34501f73 100644 --- a/packages/astro-ghostcms/src/schemas/sitemap.ts +++ b/packages/astro-ghostcms/src/schemas/sitemap.ts @@ -1,12 +1,12 @@ import { z } from "astro/zod"; export const SitemapSchema = z.object({ - /** EXAMPLE: ['https://example-1.com', 'https://example-2.com] - * REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap/#custompages + /** @example ['https://example-1.com', 'https://example-2.com] + * @see https://docs.astro.build/en/guides/integrations-guide/sitemap/#custompages */ customPages: z.string().array().optional(), - /** EXAMPLE: 10000 - * REFERENCE https://docs.astro.build/en/guides/integrations-guide/sitemap/#entrylimit + /** @example 10000 + * @see https://docs.astro.build/en/guides/integrations-guide/sitemap/#entrylimit */ entryLimit: z.number().optional() }) \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 64fff3b9..d8334255 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,10 +18,10 @@ importers: demo: dependencies: '@matthiesenxyz/astro-ghostcms': - specifier: 3.1.2 + specifier: 3.1.3 version: link:../packages/astro-ghostcms '@matthiesenxyz/astro-ghostcms-theme-default': - specifier: 0.1.2 + specifier: 0.1.3 version: link:../packages/astro-ghostcms-theme-default astro: specifier: ^4.2.4 @@ -43,7 +43,7 @@ importers: specifier: ^3.0.5 version: 3.0.5 '@matthiesenxyz/astro-ghostcms-theme-default': - specifier: ^0.1.1 + specifier: ^0.1.3 version: link:../astro-ghostcms-theme-default '@ts-ghost/core-api': specifier: ^5.1.2 @@ -54,9 +54,6 @@ importers: astro-robots-txt: specifier: ^1.0.0 version: 1.0.0 - tiny-invariant: - specifier: ^1.3.1 - version: 1.3.1 vite: specifier: ^5.0.12 version: 5.0.12(@types/node@20.11.6) @@ -119,7 +116,7 @@ importers: packages/astro-ghostcms-theme-default: dependencies: '@matthiesenxyz/astro-ghostcms': - specifier: ^3.1.2 + specifier: ^3.1.3 version: link:../astro-ghostcms astro: specifier: ^4.2.1 @@ -127,9 +124,6 @@ importers: astro-font: specifier: ^0.0.77 version: 0.0.77 - tiny-invariant: - specifier: ^1.3.1 - version: 1.3.1 devDependencies: '@astrojs/check': specifier: ^0.4.1 @@ -6818,10 +6812,6 @@ packages: any-promise: 1.3.0 dev: true - /tiny-invariant@1.3.1: - resolution: {integrity: sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==} - dev: false - /tinybench@2.6.0: resolution: {integrity: sha512-N8hW3PG/3aOoZAN5V/NSAEDz0ZixDSSt5b/a05iqtpgfLWMSVuCo7w0k2vVvEjdrIoeGqZzweX2WlyioNIHchA==} dev: true