Skip to content

Commit

Permalink
Add .js to imports in the sitemap package (#3661)
Browse files Browse the repository at this point in the history
* Add .js to imports in the sitemap package

* Adds a smoke test

* Adds a changeset
  • Loading branch information
matthewp authored Jun 21, 2022
1 parent 195f88b commit 2ff11df
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-walls-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/sitemap': patch
---

Fixes the last build
3 changes: 2 additions & 1 deletion packages/integrations/sitemap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/sitemap/src/config-defaults.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { SitemapOptions } from './index';
import type { SitemapOptions } from './index.js';

export const SITEMAP_CONFIG_DEFAULTS: SitemapOptions & any = {
entryLimit: 45000,
Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/sitemap/src/generate-sitemap.ts
Original file line number Diff line number Diff line change
@@ -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}\/?$/;

Expand Down
6 changes: 3 additions & 3 deletions packages/integrations/sitemap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/sitemap/src/schema.ts
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/sitemap/src/validate-options.ts
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
3 changes: 3 additions & 0 deletions packages/integrations/sitemap/test/smoke.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import '../dist/index.js';

// Just a smoke test, this would fail if there's a problem.

0 comments on commit 2ff11df

Please sign in to comment.