diff --git a/.astro/icon.d.ts b/.astro/icon.d.ts new file mode 100644 index 0000000..90f12b8 --- /dev/null +++ b/.astro/icon.d.ts @@ -0,0 +1,10 @@ +// Automatically generated by astro-icon +// 001a1ccebb4bfa874cce071296b7167baf197ac1b43baf1f725af5a705835151 + +declare module 'virtual:astro-icon' { + export type Icon = + | "calendar" + | "clock" + | "pen" + | "person"; +} \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..200629f --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,11 @@ +module.exports = { + root: true, + extends: [ + 'eslint:recommended', + 'prettier', + 'plugin:prettier/recommended', + 'plugin:astro/recommended', + ], + plugins: ['prettier'], + overrides: [], +}; diff --git a/.prettierrc.json b/.prettierrc.json index 36f8f25..cfa2231 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,5 +1,5 @@ { - "plugins": ["./node_modules/prettier-plugin-astro"], + "plugins": ["prettier-plugin-astro"], "trailingComma": "es5", "tabWidth": 2, "useTabs": true, diff --git a/astro.config.mjs b/astro.config.mjs index f2362ae..04a4d68 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,5 +1,6 @@ import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify'; +import icon from 'astro-icon'; // https://astro.build/config import mdx from '@astrojs/mdx'; @@ -8,5 +9,10 @@ import mdx from '@astrojs/mdx'; export default defineConfig({ output: 'server', adapter: netlify(), - integrations: [mdx()], + integrations: [ + mdx(), + icon({ + iconDir: 'src/styles/svg/icons', + }), + ], }); diff --git a/bun.lockb b/bun.lockb index 399e324..61cc8d9 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/newPost.ts b/newPost.ts deleted file mode 100644 index ac80db7..0000000 --- a/newPost.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Tag } from 'src/types'; - -const renderFile = ( - title: string, - date: string, - tags: string[], - md: string -) => ` ---- -title: ${title} -pubDate: ${date} -tags: ['${tags.join("', '")}'] ---- - -${md} -`; - -const newPost = () => { - const tagArr = Object.values(Tag); - - console.log(tagArr); -}; - -newPost(); diff --git a/package.json b/package.json index ce86909..4ac8b78 100644 --- a/package.json +++ b/package.json @@ -9,13 +9,14 @@ "build": "astro build", "preview": "astro preview", "astro": "astro", - "new-post": "bun ./newPost.ts" + "lint": "eslint --ext .js --ext .ts --ext .astro" }, "dependencies": { "@astrojs/mdx": "2.1.0", "@astrojs/netlify": "5.0.0", "@astrojs/rss": "4.0.4", "astro": "4.2.6", + "astro-icon": "^1.1.0", "date-fns": "^3.3.1", "date-fns-tz": "^1.3.7", "markdown-it": "^13.0.1", @@ -23,8 +24,16 @@ "sharp": "^0.33.2" }, "devDependencies": { + "bun-types": "latest", + "eslint": "^8.57.0", + "eslint-plugin-astro": "^0.31.4", + "eslint-plugin-prettier": "^5.1.3", "inquirer": "^9.2.15", "prettier": "^2.8.1", "prettier-plugin-astro": "^0.7.0" + }, + "module": "index.ts", + "peerDependencies": { + "typescript": "^5.0.0" } } diff --git a/src/components/BlogHeader.astro b/src/components/BlogHeader.astro index 5010d9e..a40dce8 100644 --- a/src/components/BlogHeader.astro +++ b/src/components/BlogHeader.astro @@ -1,5 +1,6 @@ --- -import FormattedDate from '@components/FormattedDate.astro'; +import { format, add } from 'date-fns'; +import { Icon } from 'astro-icon/components'; interface Props { title: String; @@ -15,18 +16,12 @@ const { title, date, slug } = Astro.props; {slug ? {title} : title}

- 🗓️ + + {format(add(new Date(date), { hours: 6 }), 'MMM do, y')}

diff --git a/src/components/Footer.astro b/src/components/Footer.astro index e1373a9..b169767 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,5 +1,7 @@ --- const year = new Date().getFullYear(); + +interface Props {} ---