From 2ff11df438a6a901e72d1f1979c79deb0ad199f2 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Tue, 21 Jun 2022 11:29:18 -0400 Subject: [PATCH] Add .js to imports in the sitemap package (#3661) * Add .js to imports in the sitemap package * Adds a smoke test * Adds a changeset --- .changeset/gold-walls-pretend.md | 5 +++++ packages/integrations/sitemap/package.json | 3 ++- packages/integrations/sitemap/src/config-defaults.ts | 2 +- packages/integrations/sitemap/src/generate-sitemap.ts | 4 ++-- packages/integrations/sitemap/src/index.ts | 6 +++--- packages/integrations/sitemap/src/schema.ts | 2 +- packages/integrations/sitemap/src/validate-options.ts | 4 ++-- packages/integrations/sitemap/test/smoke.test.js | 3 +++ 8 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 .changeset/gold-walls-pretend.md create mode 100644 packages/integrations/sitemap/test/smoke.test.js diff --git a/.changeset/gold-walls-pretend.md b/.changeset/gold-walls-pretend.md new file mode 100644 index 0000000000..effefbc010 --- /dev/null +++ b/.changeset/gold-walls-pretend.md @@ -0,0 +1,5 @@ +--- +'@astrojs/sitemap': patch +--- + +Fixes the last build diff --git a/packages/integrations/sitemap/package.json b/packages/integrations/sitemap/package.json index 3fd3bd7530..da21fd9746 100644 --- a/packages/integrations/sitemap/package.json +++ b/packages/integrations/sitemap/package.json @@ -28,7 +28,8 @@ "scripts": { "build": "astro-scripts build \"src/**/*.ts\" && tsc", "build:ci": "astro-scripts build \"src/**/*.ts\"", - "dev": "astro-scripts dev \"src/**/*.ts\"" + "dev": "astro-scripts dev \"src/**/*.ts\"", + "test": "mocha --timeout 20000" }, "dependencies": { "sitemap": "^7.1.1", diff --git a/packages/integrations/sitemap/src/config-defaults.ts b/packages/integrations/sitemap/src/config-defaults.ts index 22288fc119..fbcd6263d2 100644 --- a/packages/integrations/sitemap/src/config-defaults.ts +++ b/packages/integrations/sitemap/src/config-defaults.ts @@ -1,4 +1,4 @@ -import type { SitemapOptions } from './index'; +import type { SitemapOptions } from './index.js'; export const SITEMAP_CONFIG_DEFAULTS: SitemapOptions & any = { entryLimit: 45000, diff --git a/packages/integrations/sitemap/src/generate-sitemap.ts b/packages/integrations/sitemap/src/generate-sitemap.ts index 653d2d5a5c..c115048224 100644 --- a/packages/integrations/sitemap/src/generate-sitemap.ts +++ b/packages/integrations/sitemap/src/generate-sitemap.ts @@ -1,5 +1,5 @@ -import type { SitemapItem, SitemapOptions } from './index'; -import { parseUrl } from './utils/parse-url'; +import type { SitemapItem, SitemapOptions } from './index.js'; +import { parseUrl } from './utils/parse-url.js'; 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 0f1a8d7306..b9df1b0fc1 100644 --- a/packages/integrations/sitemap/src/index.ts +++ b/packages/integrations/sitemap/src/index.ts @@ -8,9 +8,9 @@ import { import { fileURLToPath } from 'url'; import { ZodError } from 'zod'; -import { generateSitemap } from './generate-sitemap'; -import { Logger } from './utils/logger'; -import { validateOptions } from './validate-options'; +import { generateSitemap } from './generate-sitemap.js'; +import { Logger } from './utils/logger.js'; +import { validateOptions } from './validate-options.js'; export type ChangeFreq = EnumChangefreq; export type SitemapItem = Pick< diff --git a/packages/integrations/sitemap/src/schema.ts b/packages/integrations/sitemap/src/schema.ts index 9f8ab77954..a7682e881a 100644 --- a/packages/integrations/sitemap/src/schema.ts +++ b/packages/integrations/sitemap/src/schema.ts @@ -1,6 +1,6 @@ import { EnumChangefreq as ChangeFreq } from 'sitemap'; import { z } from 'zod'; -import { SITEMAP_CONFIG_DEFAULTS } from './config-defaults'; +import { SITEMAP_CONFIG_DEFAULTS } from './config-defaults.js'; const localeKeySchema = z.string().min(1); diff --git a/packages/integrations/sitemap/src/validate-options.ts b/packages/integrations/sitemap/src/validate-options.ts index f89582d827..e4b458003e 100644 --- a/packages/integrations/sitemap/src/validate-options.ts +++ b/packages/integrations/sitemap/src/validate-options.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; -import type { SitemapOptions } from './index'; -import { SitemapOptionsSchema } from './schema'; +import type { SitemapOptions } from './index.js'; +import { SitemapOptionsSchema } from './schema.js'; // @internal export const validateOptions = (site: string | undefined, opts: SitemapOptions) => { diff --git a/packages/integrations/sitemap/test/smoke.test.js b/packages/integrations/sitemap/test/smoke.test.js new file mode 100644 index 0000000000..d24c191ec1 --- /dev/null +++ b/packages/integrations/sitemap/test/smoke.test.js @@ -0,0 +1,3 @@ +import '../dist/index.js'; + +// Just a smoke test, this would fail if there's a problem.