Skip to content

Commit

Permalink
Merge branch 'main' into feat/content-types-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored Feb 5, 2024
2 parents 0560675 + 5eb0597 commit e337600
Show file tree
Hide file tree
Showing 78 changed files with 623 additions and 387 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-spoons-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/rss": patch
---

Allows `enclosure' to have a length of 0
2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.3.0"
"astro": "^4.3.2"
}
}
2 changes: 1 addition & 1 deletion examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@astrojs/mdx": "^2.1.1",
"@astrojs/rss": "^4.0.4",
"@astrojs/sitemap": "^3.0.5",
"astro": "^4.3.0"
"astro": "^4.3.2"
}
}
2 changes: 1 addition & 1 deletion examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^4.3.0"
"astro": "^4.3.2"
},
"peerDependencies": {
"astro": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-alpine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@astrojs/alpinejs": "^0.4.0",
"@types/alpinejs": "^3.13.5",
"alpinejs": "^3.13.3",
"astro": "^4.3.0"
"astro": "^4.3.2"
}
}
4 changes: 2 additions & 2 deletions examples/framework-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/lit": "^4.0.1",
"@webcomponents/template-shadowroot": "^0.2.1",
"astro": "^4.3.0",
"lit": "^2.8.0"
"astro": "^4.3.2",
"lit": "^3.1.2"
}
}
2 changes: 1 addition & 1 deletion examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@astrojs/solid-js": "^4.0.1",
"@astrojs/svelte": "^5.0.3",
"@astrojs/vue": "^4.0.8",
"astro": "^4.3.0",
"astro": "^4.3.2",
"preact": "^10.19.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.1.0",
"@preact/signals": "^1.2.1",
"astro": "^4.3.0",
"astro": "^4.3.2",
"preact": "^10.19.2"
}
}
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/react": "^3.0.9",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"astro": "^4.3.0",
"astro": "^4.3.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/solid-js": "^4.0.1",
"astro": "^4.3.0",
"astro": "^4.3.2",
"solid-js": "^1.8.5"
}
}
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/svelte": "^5.0.3",
"astro": "^4.3.0",
"astro": "^4.3.2",
"svelte": "^4.2.5"
}
}
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/vue": "^4.0.8",
"astro": "^4.3.0",
"astro": "^4.3.2",
"vue": "^3.3.8"
}
}
2 changes: 1 addition & 1 deletion examples/hackernews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/node": "^8.2.0",
"astro": "^4.3.0"
"astro": "^4.3.2"
}
}
2 changes: 1 addition & 1 deletion examples/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^4.3.0"
"astro": "^4.3.2"
},
"peerDependencies": {
"astro": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@astrojs/node": "^8.2.0",
"astro": "^4.3.0",
"astro": "^4.3.2",
"html-minifier": "^4.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.3.0"
"astro": "^4.3.2"
}
}
2 changes: 1 addition & 1 deletion examples/non-html-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.3.0"
"astro": "^4.3.2"
}
}
2 changes: 1 addition & 1 deletion examples/portfolio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.3.0"
"astro": "^4.3.2"
}
}
2 changes: 1 addition & 1 deletion examples/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@astrojs/node": "^8.2.0",
"@astrojs/svelte": "^5.0.3",
"astro": "^4.3.0",
"astro": "^4.3.2",
"svelte": "^4.2.5"
}
}
2 changes: 1 addition & 1 deletion examples/starlog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.3.0",
"astro": "^4.3.2",
"sass": "^1.69.5",
"sharp": "^0.32.6"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/view-transitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"devDependencies": {
"@astrojs/tailwind": "^5.1.0",
"@astrojs/node": "^8.2.0",
"astro": "^4.3.0"
"astro": "^4.3.2"
}
}
4 changes: 1 addition & 3 deletions examples/view-transitions/src/components/Nav.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<nav class="nav border-b border-gray-800 sticky top-0 z-30 bg-gray-900">
<div
class="container mx-auto px-4 flex flex-col md:flex-row items-center justify-between px-4 py-6"
>
<div class="container mx-auto flex flex-col md:flex-row items-center justify-between px-4 py-6">
<ul class="flex flex-col md:flex-row items-center">
<li>
<a href="/" class="flex items-center font-bold text-xl">
Expand Down
2 changes: 1 addition & 1 deletion examples/with-markdoc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/markdoc": "^0.8.3",
"astro": "^4.3.0"
"astro": "^4.3.2"
}
}
2 changes: 1 addition & 1 deletion examples/with-markdown-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/markdown-remark": "^4.2.1",
"astro": "^4.3.0",
"astro": "^4.3.2",
"hast-util-select": "^6.0.2",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-markdown-shiki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.3.0"
"astro": "^4.3.2"
}
}
2 changes: 1 addition & 1 deletion examples/with-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/mdx": "^2.1.1",
"@astrojs/preact": "^3.1.0",
"astro": "^4.3.0",
"astro": "^4.3.2",
"preact": "^10.19.2"
}
}
2 changes: 1 addition & 1 deletion examples/with-nanostores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.1.0",
"@nanostores/preact": "^0.5.0",
"astro": "^4.3.0",
"astro": "^4.3.2",
"nanostores": "^0.9.5",
"preact": "^10.19.2"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/mdx": "^2.1.1",
"@astrojs/tailwind": "^5.1.0",
"@types/canvas-confetti": "^1.6.3",
"astro": "^4.3.0",
"astro": "^4.3.2",
"autoprefixer": "^10.4.15",
"canvas-confetti": "^1.9.1",
"postcss": "^8.4.28",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^4.3.0",
"astro": "^4.3.2",
"vitest": "^1.2.1"
}
}
11 changes: 3 additions & 8 deletions packages/astro-rss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,13 @@
"build": "astro-scripts build \"src/**/*.ts\" && tsc",
"build:ci": "astro-scripts build \"src/**/*.ts\"",
"dev": "astro-scripts dev \"src/**/*.ts\"",
"test": "mocha --exit --timeout 20000"
"test": "astro-scripts test \"test/**/*.test.js\""
},
"devDependencies": {
"@types/chai": "^4.3.10",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.4",
"@types/xml2js": "^0.4.14",
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"chai-xml": "^0.4.1",
"mocha": "^10.2.0"
"xml2js": "0.6.2"
},
"dependencies": {
"fast-xml-parser": "^4.2.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-rss/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const rssSchema = z.object({
enclosure: z
.object({
url: z.string(),
length: z.number().positive().int().finite(),
length: z.number().nonnegative().int().finite(),
type: z.string(),
})
.optional(),
Expand Down
25 changes: 14 additions & 11 deletions packages/astro-rss/test/pagesGlobToRssItems.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import chai from 'chai';
import chaiPromises from 'chai-as-promised';
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';

import { phpFeedItem, web1FeedItem } from './test-utils.js';
import { pagesGlobToRssItems } from '../dist/index.js';

chai.use(chaiPromises);

describe('pagesGlobToRssItems', () => {
it('should generate on valid result', async () => {
const globResult = {
Expand Down Expand Up @@ -33,8 +32,7 @@ describe('pagesGlobToRssItems', () => {
};

const items = await pagesGlobToRssItems(globResult);

chai.expect(items.sort((a, b) => a.pubDate - b.pubDate)).to.deep.equal([
const expected = [
{
title: phpFeedItem.title,
link: phpFeedItem.link,
Expand All @@ -47,7 +45,12 @@ describe('pagesGlobToRssItems', () => {
pubDate: new Date(web1FeedItem.pubDate),
description: web1FeedItem.description,
},
]);
];

assert.deepStrictEqual(
items.sort((a, b) => a.pubDate - b.pubDate),
expected
);
});

it('should fail on missing "url"', () => {
Expand All @@ -63,7 +66,7 @@ describe('pagesGlobToRssItems', () => {
})
),
};
return chai.expect(pagesGlobToRssItems(globResult)).to.be.rejected;
return assert.rejects(pagesGlobToRssItems(globResult));
});

it('should fail on missing "title" key and "description"', () => {
Expand All @@ -80,7 +83,7 @@ describe('pagesGlobToRssItems', () => {
})
),
};
return chai.expect(pagesGlobToRssItems(globResult)).to.be.rejected;
return assert.rejects(pagesGlobToRssItems(globResult));
});

it('should not fail on missing "title" key if "description" is present', () => {
Expand All @@ -97,7 +100,7 @@ describe('pagesGlobToRssItems', () => {
})
),
};
return chai.expect(pagesGlobToRssItems(globResult)).to.not.be.rejected;
return assert.doesNotReject(pagesGlobToRssItems(globResult));
});

it('should not fail on missing "description" key if "title" is present', () => {
Expand All @@ -114,6 +117,6 @@ describe('pagesGlobToRssItems', () => {
})
),
};
return chai.expect(pagesGlobToRssItems(globResult)).to.not.be.rejected;
return assert.doesNotReject(pagesGlobToRssItems(globResult));
});
});
Loading

0 comments on commit e337600

Please sign in to comment.