Refactor tu use astrowind:config virtual import

This commit is contained in:
prototypa
2024-03-29 00:49:47 -04:00
parent f6d5e6cb39
commit 6b14879507
22 changed files with 28 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
---
import { SITE } from '~/utils/config';
import { SITE } from 'astrowind:config';
---
<span class="self-center ml-2 rtl:ml-0 rtl:mr-2 text-2xl md:text-xl font-bold text-gray-900 whitespace-nowrap dark:text-white">

View File

@@ -1,5 +1,5 @@
---
import { APP_BLOG } from '~/utils/config';
import { APP_BLOG } from 'astrowind:config';
import type { Post } from '~/types';
import Image from '~/components/common/Image.astro';

View File

@@ -4,7 +4,7 @@ import { Icon } from 'astro-icon/components';
import Image from '~/components/common/Image.astro';
import PostTags from '~/components/blog/Tags.astro';
import { APP_BLOG } from '~/utils/config';
import { APP_BLOG } from 'astrowind:config';
import type { Post } from '~/types';
import { getPermalink } from '~/utils/permalinks';

View File

@@ -1,5 +1,5 @@
---
import { APP_BLOG } from "~/utils/config";
import { APP_BLOG } from "astrowind:config";
import { fetchPosts, getRelatedPosts } from "~/utils/blog";
import BlogHighlightedPosts from "../widgets/BlogHighlightedPosts.astro";

View File

@@ -1,7 +1,7 @@
---
import { getPermalink } from '~/utils/permalinks';
import { APP_BLOG } from '~/utils/config';
import { APP_BLOG } from 'astrowind:config';
import type { Post } from '~/types';
export interface Props {

View File

@@ -1,7 +1,7 @@
---
import { Icon } from 'astro-icon/components';
import { getBlogPermalink } from '~/utils/permalinks';
import { I18N } from '~/utils/config';
import { I18N } from 'astrowind:config';
import Button from '~/components/ui/Button.astro';
const { textDirection } = I18N;

View File

@@ -1,6 +1,6 @@
---
import { GoogleAnalytics } from '@astrolib/analytics';
import { ANALYTICS } from '~/utils/config';
import { ANALYTICS } from 'astrowind:config';
---
{

View File

@@ -1,5 +1,5 @@
---
import { UI } from "~/utils/config";
import { UI } from "astrowind:config";
// TODO: This code is temporary
---

View File

@@ -1,5 +1,5 @@
---
import { UI } from '~/utils/config';
import { UI } from 'astrowind:config';
---
<script is:inline define:vars={{ defaultTheme: UI.theme }}>

View File

@@ -4,7 +4,7 @@ import { AstroSeo } from '@astrolib/seo';
import type { Props as AstroSeoProps } from '@astrolib/seo';
import { SITE, METADATA, I18N } from '~/utils/config';
import { SITE, METADATA, I18N } from 'astrowind:config';
import type { MetaData } from '~/types';
import { getCanonical } from '~/utils/permalinks';

View File

@@ -1,5 +1,5 @@
---
import { SITE } from "~/utils/config";
import { SITE } from "astrowind:config";
---
{SITE.googleSiteVerificationId && <meta name="google-site-verification" content={SITE.googleSiteVerificationId} />}

View File

@@ -1,7 +1,7 @@
---
import { Icon } from 'astro-icon/components';
import { UI } from '~/utils/config';
import { UI } from 'astrowind:config';
export interface Props {
label?: string;

View File

@@ -1,5 +1,5 @@
---
import { APP_BLOG } from "~/utils/config";
import { APP_BLOG } from "astrowind:config";
import Grid from "~/components/blog/Grid.astro";

View File

@@ -1,5 +1,5 @@
---
import { APP_BLOG } from "~/utils/config";
import { APP_BLOG } from "astrowind:config";
import Grid from "~/components/blog/Grid.astro";

View File

@@ -1,6 +1,6 @@
---
import { Icon } from 'astro-icon/components';
import { SITE } from '~/utils/config';
import { SITE } from 'astrowind:config';
import { getHomePermalink } from '~/utils/permalinks';
interface Link {

View File

@@ -32,4 +32,4 @@ const { metadata } = Astro.props;
</slot>
</Fragment>
<slot />
</PageLayout>
</PageLayout>

View File

@@ -1,7 +1,7 @@
---
import '~/assets/styles/tailwind.css';
import { I18N } from '~/utils/config';
import { I18N } from 'astrowind:config';
import CommonMeta from '~/components/common/CommonMeta.astro';
import Favicons from '~/components/Favicons.astro';

View File

@@ -28,4 +28,4 @@ const { metadata } = Astro.props;
<slot name="footer">
<Footer {...footerData} />
</slot>
</Layout>
</Layout>

View File

@@ -1,6 +1,6 @@
import { getRssString } from '@astrojs/rss';
import { SITE, METADATA, APP_BLOG } from '~/utils/config';
import { SITE, METADATA, APP_BLOG } from 'astrowind:config';
import { fetchPosts } from '~/utils/blog';
import { getPermalink } from '~/utils/permalinks';

View File

@@ -2,7 +2,7 @@ import type { PaginateFunction } from 'astro';
import { getCollection } from 'astro:content';
import type { CollectionEntry } from 'astro:content';
import type { Post } from '~/types';
import { APP_BLOG } from '~/utils/config';
import { APP_BLOG } from 'astrowind:config';
import { cleanSlug, trimSlash, BLOG_BASE, POST_PERMALINK_PATTERN, CATEGORY_BASE, TAG_BASE } from './permalinks';
const generatePermalink = async ({

View File

@@ -1,6 +1,6 @@
import slugify from 'limax';
import { SITE, APP_BLOG } from '~/utils/config';
import { SITE, APP_BLOG } from 'astrowind:config';
import { trim } from '~/utils/utils';

View File

@@ -1,13 +1,11 @@
import { I18N } from '~/utils/config';
import { I18N } from 'astrowind:config';
const formatter: Intl.DateTimeFormat =
I18N?.dateFormatter ||
new Intl.DateTimeFormat('en', {
year: 'numeric',
month: 'short',
day: 'numeric',
timeZone: 'UTC',
});
export const formatter: Intl.DateTimeFormat = new Intl.DateTimeFormat(I18N?.language, {
year: 'numeric',
month: 'short',
day: 'numeric',
timeZone: 'UTC',
});
export const getFormattedDate = (date: Date): string => (date ? formatter.format(date) : '');