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"> <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 type { Post } from '~/types';
import Image from '~/components/common/Image.astro'; 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 Image from '~/components/common/Image.astro';
import PostTags from '~/components/blog/Tags.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 type { Post } from '~/types';
import { getPermalink } from '~/utils/permalinks'; 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 { fetchPosts, getRelatedPosts } from "~/utils/blog";
import BlogHighlightedPosts from "../widgets/BlogHighlightedPosts.astro"; import BlogHighlightedPosts from "../widgets/BlogHighlightedPosts.astro";

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
--- ---
import { GoogleAnalytics } from '@astrolib/analytics'; 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 // 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 }}> <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 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 type { MetaData } from '~/types';
import { getCanonical } from '~/utils/permalinks'; 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} />} {SITE.googleSiteVerificationId && <meta name="google-site-verification" content={SITE.googleSiteVerificationId} />}

View File

@@ -1,7 +1,7 @@
--- ---
import { Icon } from 'astro-icon/components'; import { Icon } from 'astro-icon/components';
import { UI } from '~/utils/config'; import { UI } from 'astrowind:config';
export interface Props { export interface Props {
label?: string; 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"; 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"; import Grid from "~/components/blog/Grid.astro";

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
import { getRssString } from '@astrojs/rss'; 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 { fetchPosts } from '~/utils/blog';
import { getPermalink } from '~/utils/permalinks'; import { getPermalink } from '~/utils/permalinks';

View File

@@ -2,7 +2,7 @@ import type { PaginateFunction } from 'astro';
import { getCollection } from 'astro:content'; import { getCollection } from 'astro:content';
import type { CollectionEntry } from 'astro:content'; import type { CollectionEntry } from 'astro:content';
import type { Post } from '~/types'; 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'; import { cleanSlug, trimSlash, BLOG_BASE, POST_PERMALINK_PATTERN, CATEGORY_BASE, TAG_BASE } from './permalinks';
const generatePermalink = async ({ const generatePermalink = async ({

View File

@@ -1,6 +1,6 @@
import slugify from 'limax'; import slugify from 'limax';
import { SITE, APP_BLOG } from '~/utils/config'; import { SITE, APP_BLOG } from 'astrowind:config';
import { trim } from '~/utils/utils'; 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 = export const formatter: Intl.DateTimeFormat = new Intl.DateTimeFormat(I18N?.language, {
I18N?.dateFormatter ||
new Intl.DateTimeFormat('en', {
year: 'numeric', year: 'numeric',
month: 'short', month: 'short',
day: 'numeric', day: 'numeric',
timeZone: 'UTC', timeZone: 'UTC',
}); });
export const getFormattedDate = (date: Date): string => (date ? formatter.format(date) : ''); export const getFormattedDate = (date: Date): string => (date ? formatter.format(date) : '');