From 53e12771bdf388ea8f89e2946b93438636ebf260 Mon Sep 17 00:00:00 2001 From: prototypa Date: Tue, 22 Aug 2023 18:19:53 -0400 Subject: [PATCH] Update to Astro v3 --- astro.config.mjs | 8 ++++---- package.json | 18 +++++++++--------- src/pages/homes/saas.astro | 10 +++++----- src/pages/homes/startup.astro | 2 +- src/pages/index.astro | 6 +++--- src/pages/rss.xml.ts | 11 +++++++++-- src/utils/blog.ts | 6 +++--- 7 files changed, 34 insertions(+), 27 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index ea815a9..59d202f 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -31,6 +31,10 @@ export default defineConfig({ output: 'static', + build: { + inlineStylesheets: 'auto' + }, + integrations: [ tailwind({ applyBaseStyles: false, @@ -78,10 +82,6 @@ export default defineConfig({ remarkPlugins: [readingTimeRemarkPlugin], }, - experimental:{ - assets: true - }, - vite: { resolve: { alias: { diff --git a/package.json b/package.json index 8fef1d0..5dcc786 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@onwidget/astrowind", "description": "A template to make your website using Astro + Tailwind CSS.", - "version": "0.9.9", + "version": "1.0.0-beta.0", "private": true, "scripts": { "dev": "astro dev", @@ -13,21 +13,21 @@ "lint:eslint": "eslint . --ext .js,.ts,.astro" }, "devDependencies": { - "@astrojs/mdx": "^0.19.7", - "@astrojs/partytown": "^1.2.3", - "@astrojs/rss": "^2.4.4", - "@astrojs/sitemap": "^2.0.2", - "@astrojs/tailwind": "^4.0.0", + "@astrojs/mdx": "^1.0.0-rc.2", + "@astrojs/partytown": "^2.0.0-rc.1", + "@astrojs/rss": "^3.0.0-rc.1", + "@astrojs/sitemap": "^3.0.0-rc.1", + "@astrojs/tailwind": "^5.0.0-rc.1", "@astrolib/analytics": "^0.4.2", "@astrolib/seo": "^0.6.0", "@fontsource-variable/inter": "^5.0.8", "@iconify-json/flat-color-icons": "^1.1.7", - "@iconify-json/tabler": "^1.1.88", + "@iconify-json/tabler": "^1.1.89", "@tailwindcss/typography": "^0.5.9", "@types/lodash.merge": "^4.6.7", "@typescript-eslint/eslint-plugin": "^6.4.1", "@typescript-eslint/parser": "^6.4.1", - "astro": "^2.10.12", + "astro": "^3.0.0-rc.5", "astro-compress": "^2.0.14", "astro-icon": "^1.0.0-next.2", "eslint": "^8.47.0", @@ -38,7 +38,7 @@ "lodash.merge": "^4.6.2", "mdast-util-to-string": "^4.0.0", "prettier": "^3.0.2", - "prettier-plugin-astro": "^0.11.1", + "prettier-plugin-astro": "^0.12.0", "reading-time": "^1.5.0", "svgo": "3.0.2", "tailwind-merge": "^1.14.0", diff --git a/src/pages/homes/saas.astro b/src/pages/homes/saas.astro index 7e50d1f..9d3315c 100644 --- a/src/pages/homes/saas.astro +++ b/src/pages/homes/saas.astro @@ -58,7 +58,7 @@ const metadata = { - Seamlessly blend the power of Astro 2.0 and Tailwind CSS to craft websites that resonate with your brand and + Seamlessly blend the power of Astro 3.0 and Tailwind CSS to craft websites that resonate with your brand and audience. @@ -72,7 +72,7 @@ const metadata = { columns={2} items={[ { - title: 'Integration of Astro 2.0 and Tailwind CSS', + title: 'Integration of Astro 3.0 and Tailwind CSS', description: 'Offers a powerful combination that enhances both the development process and the end-user experience. Also, allows to build dynamic and visually stunning websites with optimized performance.', icon: 'tabler:layers-union', @@ -95,7 +95,7 @@ const metadata = { }, { title: 'Fast loading times and production-ready code', - description: `Using Astro 2.0 ensures fast loading and seamless rendering, enhancing browsing. The code follows best practices, improving user experience, SEO, and reducing bounce rates.`, + description: `Using Astro 3.0 ensures fast loading and seamless rendering, enhancing browsing. The code follows best practices, improving user experience, SEO, and reducing bounce rates.`, icon: 'tabler:rocket', }, { @@ -116,7 +116,7 @@ const metadata = { { title: 'Description:', description: - 'Are you a startup with big dreams? AstroWind propels your success. Our template forges a seamless online presence, attracting investors and customers from day one. Astro 2.0 and Tailwind CSS ensure striking, responsive sites, leaving lasting impressions. Countless startups leverage AstroWind to kickstart their journey and resonate with audiences.', + 'Are you a startup with big dreams? AstroWind propels your success. Our template forges a seamless online presence, attracting investors and customers from day one. Astro 3.0 and Tailwind CSS ensure striking, responsive sites, leaving lasting impressions. Countless startups leverage AstroWind to kickstart their journey and resonate with audiences.', }, { title: 'Benefits:', @@ -146,7 +146,7 @@ const metadata = { items={[ { title: 'Description:', - description: `For SaaS businesses, user experience is key. AstroWind enhances showcasing SaaS solutions intuitively. The template's Astro 2.0 and Tailwind CSS integration guarantees user-friendly experience, mirroring your software's efficiency. Customize pages to communicate SaaS value and solutions for your audience.`, + description: `For SaaS businesses, user experience is key. AstroWind enhances showcasing SaaS solutions intuitively. The template's Astro 3.0 and Tailwind CSS integration guarantees user-friendly experience, mirroring your software's efficiency. Customize pages to communicate SaaS value and solutions for your audience.`, }, { title: 'Benefits:', diff --git a/src/pages/homes/startup.astro b/src/pages/homes/startup.astro index 825f31e..3162b0a 100644 --- a/src/pages/homes/startup.astro +++ b/src/pages/homes/startup.astro @@ -54,7 +54,7 @@ const metadata = {
diff --git a/src/pages/index.astro b/src/pages/index.astro index 19171c6..d1e32d7 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -28,12 +28,12 @@ const metadata = { > Free template for - Astro 2.0 + Tailwind CSS + Astro 3.0 + Tailwind CSS AstroWind: Production-ready. @@ -101,7 +101,7 @@ const metadata = { title="AstroWind's Blueprint: Fun Meets Functionality!" items={[ { - title: 'Built on top of Astro 2.0', + title: 'Built on top of Astro 3.0', description: 'Benefiting from the performance and developer-friendly features of this modern static site generator.', }, diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index 0fa45d6..36c9139 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -4,7 +4,7 @@ import { SITE_CONFIG, METADATA_CONFIG, APP_BLOG_CONFIG } from '~/utils/config'; import { fetchPosts } from '~/utils/blog'; import { getPermalink } from '~/utils/permalinks'; -export const get = async () => { +export const GET = async () => { if (!APP_BLOG_CONFIG.isEnabled) { return new Response(null, { status: 404, @@ -14,7 +14,7 @@ export const get = async () => { const posts = await fetchPosts(); - return rss({ + const { body = "" } = await rss({ title: `${SITE_CONFIG.name}’s Blog`, description: METADATA_CONFIG?.description || "", site: import.meta.env.SITE, @@ -27,5 +27,12 @@ export const get = async () => { })), trailingSlash: SITE_CONFIG.trailingSlash, + }) + + return new Response(body, { + status: 200, + headers: { + "Content-Type": "application/xml" + } }); }; diff --git a/src/utils/blog.ts b/src/utils/blog.ts index 24ab7dd..fdc3a43 100644 --- a/src/utils/blog.ts +++ b/src/utils/blog.ts @@ -173,7 +173,7 @@ export const getStaticPathsBlogList = async ({ paginate }) => { /** */ export const getStaticPathsBlogPost = async () => { if (!isBlogEnabled || !isBlogPostRouteEnabled) return []; - return (await fetchPosts()).map((post) => ({ + return (await fetchPosts()).flatMap((post) => ({ params: { blog: post.permalink, }, @@ -191,7 +191,7 @@ export const getStaticPathsBlogCategory = async ({ paginate }) => { typeof post.category === 'string' && categories.add(post.category.toLowerCase()); }); - return Array.from(categories).map((category: string) => + return Array.from(categories).flatMap((category: string) => paginate( posts.filter((post) => typeof post.category === 'string' && category === post.category.toLowerCase()), { @@ -213,7 +213,7 @@ export const getStaticPathsBlogTag = async ({ paginate }) => { Array.isArray(post.tags) && post.tags.map((tag) => tags.add(tag.toLowerCase())); }); - return Array.from(tags).map((tag: string) => + return Array.from(tags).flatMap((tag: string) => paginate( posts.filter((post) => Array.isArray(post.tags) && post.tags.find((elem) => elem.toLowerCase() === tag)), {