Merge pull request #97 from prototypa/astro2

Update to astro@2.0.0-beta.4
This commit is contained in:
prototypa
2023-01-23 18:41:25 -05:00
committed by GitHub
12 changed files with 12 additions and 44 deletions

View File

@ -40,7 +40,6 @@
- [Commands](#commands) - [Commands](#commands)
- [Configuration](#configuration) - [Configuration](#configuration)
- [Deploy](#deploy) - [Deploy](#deploy)
- [Roadmap](#roadmap)
- [Frequently Asked Questions](#frequently-asked-questions) - [Frequently Asked Questions](#frequently-asked-questions)
- [Related Projects](#related-projects) - [Related Projects](#related-projects)
- [Contributing](#contributing) - [Contributing](#contributing)
@ -229,24 +228,6 @@ Clone this repository on own GitHub account and deploy to Vercel:
<br> <br>
## Roadmap
### Base
- [ ] Improve blog design (More generic design that adapts to more needs).
- [ ] Create component or utilities for related posts.
- [ ] Add more _shortcodes_ or _embed_ functions to posts in Markdown: (eg Video, Tweet...).
- [ ] Add more Tailwind components useful for most scenarios (Features, Contact, Call to Actions, Content, FAQs...)
- [ ] Add commonly used example pages (Ex: About, Terms, Profile, Services...).
- [ ] Create detailed documentation with best practices and redesign tips.
### Advanced
- [ ] Create external library or place with useful Tailwind components.
- [ ] Create examples of AstroWind in CodeSanbox or a similar platform that can be easily synchronized with new updates. (Redesign, Integration with React or Svelte components, Use of Tailwind plugins, Connection to headless CMS ...).
<br>
## Frequently Asked Questions ## Frequently Asked Questions
- Why? - Why?

View File

@ -10,7 +10,6 @@ import mdx from '@astrojs/mdx';
import partytown from '@astrojs/partytown'; import partytown from '@astrojs/partytown';
import compress from 'astro-compress'; import compress from 'astro-compress';
import { remarkReadingTime } from './src/utils/frontmatter.mjs';
import { SITE } from './src/config.mjs'; import { SITE } from './src/config.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url)); const __dirname = path.dirname(fileURLToPath(import.meta.url));
@ -56,9 +55,7 @@ export default defineConfig({
}), }),
], ],
markdown: { markdown: {},
remarkPlugins: [remarkReadingTime],
},
vite: { vite: {
resolve: { resolve: {

View File

@ -16,17 +16,17 @@
"devDependencies": { "devDependencies": {
"@astrojs/image": "^1.0.0-beta.2", "@astrojs/image": "^1.0.0-beta.2",
"@astrojs/mdx": "^1.0.0-beta.2", "@astrojs/mdx": "^1.0.0-beta.2",
"@astrojs/partytown": "^1.0.3-beta.0", "@astrojs/partytown": "^1.0.3-beta.1",
"@astrojs/rss": "^2.0.0", "@astrojs/rss": "^2.0.0",
"@astrojs/sitemap": "^1.0.0", "@astrojs/sitemap": "^1.0.0",
"@astrojs/tailwind": "^3.0.0-beta.1", "@astrojs/tailwind": "^3.0.0-beta.2",
"@astrolib/analytics": "^0.3.0", "@astrolib/analytics": "^0.3.0",
"@astrolib/seo": "^0.3.0", "@astrolib/seo": "^0.3.0",
"@fontsource/inter": "^4.5.15", "@fontsource/inter": "^4.5.15",
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.5.9",
"@typescript-eslint/eslint-plugin": "^5.48.2", "@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.48.2", "@typescript-eslint/parser": "^5.48.2",
"astro": "^2.0.0-beta.3", "astro": "^2.0.0-beta.4",
"astro-compress": "1.1.28", "astro-compress": "1.1.28",
"astro-icon": "^0.8.0", "astro-icon": "^0.8.0",
"eslint": "^8.32.0", "eslint": "^8.32.0",

View File

@ -44,8 +44,7 @@ const link = !BLOG?.post?.disabled ? getPermalink(post.slug, 'post') : '';
<div class="mb-1"> <div class="mb-1">
<span class="text-sm"> <span class="text-sm">
<Icon name="tabler:clock" class="w-3.5 h-3.5 inline-block -mt-0.5 dark:text-gray-400" /> <Icon name="tabler:clock" class="w-3.5 h-3.5 inline-block -mt-0.5 dark:text-gray-400" />
<time datetime={String(post.publishDate)}>{getFormattedDate(post.publishDate)}</time> ~ <time datetime={String(post.publishDate)}>{getFormattedDate(post.publishDate)}</time>
{Math.ceil(post.readingTime)} min read
</span> </span>
</div> </div>
<h2 class="text-xl sm:text-2xl font-bold leading-tight mb-2 font-heading dark:text-slate-300"> <h2 class="text-xl sm:text-2xl font-bold leading-tight mb-2 font-heading dark:text-slate-300">

View File

@ -23,9 +23,7 @@ const { post, url } = Astro.props;
<div class="flex justify-between flex-col sm:flex-row max-w-3xl mx-auto mt-0 mb-2 px-4 sm:px-6 sm:items-center"> <div class="flex justify-between flex-col sm:flex-row max-w-3xl mx-auto mt-0 mb-2 px-4 sm:px-6 sm:items-center">
<p> <p>
<Icon name="tabler:clock" class="w-4 h-4 inline-block -mt-1 dark:text-gray-400" /> <Icon name="tabler:clock" class="w-4 h-4 inline-block -mt-1 dark:text-gray-400" />
<time datetime={String(post.publishDate)}>{getFormattedDate(post.publishDate)}</time> ~ { <time datetime={String(post.publishDate)}>{getFormattedDate(post.publishDate)}</time>
Math.ceil(post.readingTime)
} min read
</p> </p>
</div> </div>
<h1 <h1

View File

@ -7,7 +7,6 @@ const posts = defineCollection({
image: z.string().optional(), image: z.string().optional(),
canonical: z.string().url().optional(), canonical: z.string().url().optional(),
permalink: z.string().optional(),
publishDate: z.date().or(z.string()).optional(), publishDate: z.date().or(z.string()).optional(),
draft: z.boolean().optional(), draft: z.boolean().optional(),
@ -17,9 +16,6 @@ const posts = defineCollection({
tags: z.array(z.string()).optional(), tags: z.array(z.string()).optional(),
author: z.string().optional(), author: z.string().optional(),
}), }),
slug: ({ defaultSlug, data }) => {
return data.permalink || defaultSlug;
},
}); });
export const collections = { export const collections = {

View File

@ -14,7 +14,7 @@ const meta: MetaSEO = {
<Layout {meta}> <Layout {meta}>
<section class="px-4 py-16 sm:px-6 mx-auto lg:px-8 lg:py-20 max-w-4xl"> <section class="px-4 py-16 sm:px-6 mx-auto lg:px-8 lg:py-20 max-w-4xl">
<h1 class="font-bold font-heading text-3xl md:text-4xl leading-tighter tracking-tighter">{frontmatter.title}</h1> <h1 class="font-bold font-heading text-4xl md:text-5xl leading-tighter tracking-tighter">{frontmatter.title}</h1>
<div <div
class="mx-auto prose prose-lg max-w-4xl dark:prose-invert dark:prose-headings:text-slate-300 prose-md prose-headings:font-heading prose-headings:leading-tighter prose-headings:tracking-tighter prose-headings:font-bold prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-img:rounded-md prose-img:shadow-lg mt-8" class="mx-auto prose prose-lg max-w-4xl dark:prose-invert dark:prose-headings:text-slate-300 prose-md prose-headings:font-heading prose-headings:leading-tighter prose-headings:tracking-tighter prose-headings:font-bold prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-img:rounded-md prose-img:shadow-lg mt-8"
> >

View File

@ -20,7 +20,6 @@ export interface Post {
Content: unknown; Content: unknown;
content?: string; content?: string;
readingTime: number;
} }
export interface MetaSEO { export interface MetaSEO {

View File

@ -5,7 +5,7 @@ import { cleanSlug } from './permalinks';
const getNormalizedPost = async (post: CollectionEntry<'posts'>): Promise<Post> => { const getNormalizedPost = async (post: CollectionEntry<'posts'>): Promise<Post> => {
const { id, slug = '', data } = post; const { id, slug = '', data } = post;
const { Content, remarkPluginFrontmatter } = await post.render(); const { Content } = await post.render();
const { tags = [], category = 'default', author = 'Anonymous', publishDate = new Date(), ...rest } = data; const { tags = [], category = 'default', author = 'Anonymous', publishDate = new Date(), ...rest } = data;
@ -22,8 +22,6 @@ const getNormalizedPost = async (post: CollectionEntry<'posts'>): Promise<Post>
Content: Content, Content: Content,
// or 'body' in case you consume from API // or 'body' in case you consume from API
readingTime: remarkPluginFrontmatter?.readingTime,
}; };
}; };