From f6242e05638cb1a1a2529373be0c4d073c44c0cc Mon Sep 17 00:00:00 2001 From: Julia Miocene Date: Sun, 20 Oct 2024 23:31:26 +0200 Subject: [PATCH] Remove unused tags --- .astro/astro/content.d.ts | 272 ++++++++++++++++++++++++++++++++++++ .github/workflows/astro.yml | 90 ++++++++++++ .gitignore | 1 + CNAME | 1 + deply.yml | 39 ------ src/pages/tags/[tag].astro | 59 -------- src/pages/tags/index.astro | 23 --- 7 files changed, 364 insertions(+), 121 deletions(-) create mode 100644 .github/workflows/astro.yml create mode 100644 CNAME delete mode 100644 deply.yml delete mode 100644 src/pages/tags/[tag].astro delete mode 100644 src/pages/tags/index.astro diff --git a/.astro/astro/content.d.ts b/.astro/astro/content.d.ts index e69de29..649c7b7 100644 --- a/.astro/astro/content.d.ts +++ b/.astro/astro/content.d.ts @@ -0,0 +1,272 @@ +declare module 'astro:content' { + interface Render { + '.mdx': Promise<{ + Content: import('astro').MarkdownInstance<{}>['Content']; + headings: import('astro').MarkdownHeading[]; + remarkPluginFrontmatter: Record; + }>; + } +} + +declare module 'astro:content' { + interface RenderResult { + Content: import('astro/runtime/server/index.js').AstroComponentFactory; + headings: import('astro').MarkdownHeading[]; + remarkPluginFrontmatter: Record; + } + interface Render { + '.md': Promise; + } + + export interface RenderedContent { + html: string; + metadata?: { + imagePaths: Array; + [key: string]: unknown; + }; + } +} + +declare module 'astro:content' { + type Flatten = T extends { [K: string]: infer U } ? U : never; + + export type CollectionKey = keyof AnyEntryMap; + export type CollectionEntry = Flatten; + + export type ContentCollectionKey = keyof ContentEntryMap; + export type DataCollectionKey = keyof DataEntryMap; + + type AllValuesOf = T extends any ? T[keyof T] : never; + type ValidContentEntrySlug = AllValuesOf< + ContentEntryMap[C] + >['slug']; + + /** @deprecated Use `getEntry` instead. */ + export function getEntryBySlug< + C extends keyof ContentEntryMap, + E extends ValidContentEntrySlug | (string & {}), + >( + collection: C, + // Note that this has to accept a regular string too, for SSR + entrySlug: E, + ): E extends ValidContentEntrySlug + ? Promise> + : Promise | undefined>; + + /** @deprecated Use `getEntry` instead. */ + export function getDataEntryById( + collection: C, + entryId: E, + ): Promise>; + + export function getCollection>( + collection: C, + filter?: (entry: CollectionEntry) => entry is E, + ): Promise; + export function getCollection( + collection: C, + filter?: (entry: CollectionEntry) => unknown, + ): Promise[]>; + + export function getEntry< + C extends keyof ContentEntryMap, + E extends ValidContentEntrySlug | (string & {}), + >(entry: { + collection: C; + slug: E; + }): E extends ValidContentEntrySlug + ? Promise> + : Promise | undefined>; + export function getEntry< + C extends keyof DataEntryMap, + E extends keyof DataEntryMap[C] | (string & {}), + >(entry: { + collection: C; + id: E; + }): E extends keyof DataEntryMap[C] + ? Promise + : Promise | undefined>; + export function getEntry< + C extends keyof ContentEntryMap, + E extends ValidContentEntrySlug | (string & {}), + >( + collection: C, + slug: E, + ): E extends ValidContentEntrySlug + ? Promise> + : Promise | undefined>; + export function getEntry< + C extends keyof DataEntryMap, + E extends keyof DataEntryMap[C] | (string & {}), + >( + collection: C, + id: E, + ): E extends keyof DataEntryMap[C] + ? Promise + : Promise | undefined>; + + /** Resolve an array of entry references from the same collection */ + export function getEntries( + entries: { + collection: C; + slug: ValidContentEntrySlug; + }[], + ): Promise[]>; + export function getEntries( + entries: { + collection: C; + id: keyof DataEntryMap[C]; + }[], + ): Promise[]>; + + export function render( + entry: AnyEntryMap[C][string], + ): Promise; + + export function reference( + collection: C, + ): import('astro/zod').ZodEffects< + import('astro/zod').ZodString, + C extends keyof ContentEntryMap + ? { + collection: C; + slug: ValidContentEntrySlug; + } + : { + collection: C; + id: keyof DataEntryMap[C]; + } + >; + // Allow generic `string` to avoid excessive type errors in the config + // if `dev` is not running to update as you edit. + // Invalid collection names will be caught at build time. + export function reference( + collection: C, + ): import('astro/zod').ZodEffects; + + type ReturnTypeOrOriginal = T extends (...args: any[]) => infer R ? R : T; + type InferEntrySchema = import('astro/zod').infer< + ReturnTypeOrOriginal['schema']> + >; + + type ContentEntryMap = { + "demos": { +"3d-in-css-is-not-real/3d-in-css-is-not-real.md": { + id: "3d-in-css-is-not-real/3d-in-css-is-not-real.md"; + slug: "3d-in-css-is-not-real/3d-in-css-is-not-real"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"3d-pencil/3d-pencil.md": { + id: "3d-pencil/3d-pencil.md"; + slug: "3d-pencil/3d-pencil"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"3d-rainbow-tube/3d-rainbow-tube.md": { + id: "3d-rainbow-tube/3d-rainbow-tube.md"; + slug: "3d-rainbow-tube/3d-rainbow-tube"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"css-noodle/css-noodle.md": { + id: "css-noodle/css-noodle.md"; + slug: "css-noodle/css-noodle"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"lemons/lemons.md": { + id: "lemons/lemons.md"; + slug: "lemons/lemons"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"mosquito/mosquito.md": { + id: "mosquito/mosquito.md"; + slug: "mosquito/mosquito"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"plastic-css-icons/plastic-css-icons.md": { + id: "plastic-css-icons/plastic-css-icons.md"; + slug: "plastic-css-icons/plastic-css-icons"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"pure-css-fancy-loader/pure-css-fancy-loader.md": { + id: "pure-css-fancy-loader/pure-css-fancy-loader.md"; + slug: "pure-css-fancy-loader/pure-css-fancy-loader"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"shapes-1/shapes-1.md": { + id: "shapes-1/shapes-1.md"; + slug: "shapes-1/shapes-1"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"shapes-2/shapes-2.md": { + id: "shapes-2/shapes-2.md"; + slug: "shapes-2/shapes-2"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"shapes-3/shapes-3.md": { + id: "shapes-3/shapes-3.md"; + slug: "shapes-3/shapes-3"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"shapes-4/shapes-4.md": { + id: "shapes-4/shapes-4.md"; + slug: "shapes-4/shapes-4"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +"the-last-of-us/the-last-of-us.md": { + id: "the-last-of-us/the-last-of-us.md"; + slug: "the-last-of-us/the-last-of-us"; + body: string; + collection: "demos"; + data: InferEntrySchema<"demos"> +} & { render(): Render[".md"] }; +}; +"posts": { +"3d-cube-with-css/3d-cube-with-css.md": { + id: "3d-cube-with-css/3d-cube-with-css.md"; + slug: "3d-cube-with-css/3d-cube-with-css"; + body: string; + collection: "posts"; + data: InferEntrySchema<"posts"> +} & { render(): Render[".md"] }; +"shapes/shapes.md": { + id: "shapes/shapes.md"; + slug: "shapes/shapes"; + body: string; + collection: "posts"; + data: InferEntrySchema<"posts"> +} & { render(): Render[".md"] }; +}; + + }; + + type DataEntryMap = { + + }; + + type AnyEntryMap = ContentEntryMap & DataEntryMap; + + export type ContentConfig = typeof import("../../src/content/config.js"); +} diff --git a/.github/workflows/astro.yml b/.github/workflows/astro.yml new file mode 100644 index 0000000..54d4be4 --- /dev/null +++ b/.github/workflows/astro.yml @@ -0,0 +1,90 @@ +# Sample workflow for building and deploying an Astro site to GitHub Pages +# +# To get started with Astro see: https://docs.astro.build/en/getting-started/ +# +name: Deploy Astro site to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +env: + BUILD_PATH: "." # default value when not using subfolders + # BUILD_PATH: subfolder + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Detect package manager + id: detect-package-manager + run: | + if [ -f "${{ github.workspace }}/yarn.lock" ]; then + echo "manager=yarn" >> $GITHUB_OUTPUT + echo "command=install" >> $GITHUB_OUTPUT + echo "runner=yarn" >> $GITHUB_OUTPUT + echo "lockfile=yarn.lock" >> $GITHUB_OUTPUT + exit 0 + elif [ -f "${{ github.workspace }}/package.json" ]; then + echo "manager=npm" >> $GITHUB_OUTPUT + echo "command=ci" >> $GITHUB_OUTPUT + echo "runner=npx --no-install" >> $GITHUB_OUTPUT + echo "lockfile=package-lock.json" >> $GITHUB_OUTPUT + exit 0 + else + echo "Unable to determine package manager" + exit 1 + fi + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: ${{ steps.detect-package-manager.outputs.manager }} + cache-dependency-path: ${{ env.BUILD_PATH }}/${{ steps.detect-package-manager.outputs.lockfile }} + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Install dependencies + run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} + working-directory: ${{ env.BUILD_PATH }} + - name: Build with Astro + run: | + ${{ steps.detect-package-manager.outputs.runner }} astro build \ + --site "${{ steps.pages.outputs.origin }}" \ + --base "${{ steps.pages.outputs.base_path }}" + working-directory: ${{ env.BUILD_PATH }} + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ${{ env.BUILD_PATH }}/dist + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + runs-on: ubuntu-latest + name: Deploy + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index 9daa824..a44058c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store node_modules +dist \ No newline at end of file diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..1fb8b84 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +miocene.io \ No newline at end of file diff --git a/deply.yml b/deply.yml deleted file mode 100644 index 979b6df..0000000 --- a/deply.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Deploy to GitHub Pages - -on: - # Trigger the workflow every time you push to the `main` branch - # Using a different branch name? Replace `main` with your branch’s name - push: - branches: [ main ] - # Allows you to run this workflow manually from the Actions tab on GitHub. - workflow_dispatch: - -# Allow this job to clone the repo and create a page deployment -permissions: - contents: read - pages: write - id-token: write - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout your repository using git - uses: actions/checkout@v4 - - name: Install, build, and upload your site - uses: withastro/action@v3 - # with: - # path: . # The root location of your Astro project inside the repository. (optional) - # node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional) - # package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional) - - deploy: - needs: build - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/src/pages/tags/[tag].astro b/src/pages/tags/[tag].astro deleted file mode 100644 index e54144e..0000000 --- a/src/pages/tags/[tag].astro +++ /dev/null @@ -1,59 +0,0 @@ ---- -import BaseLayout from "@/layouts/BaseLayout.astro"; -import Card from "@/components/Card.astro"; -import { getCollection } from "astro:content"; - -export async function getStaticPaths() { - const allPosts = await getCollection("posts"); - const uniqueTags = [ - ...new Set(allPosts.map((post) => post.data.tags).flat()), - ]; - - return uniqueTags.map((tag) => { - // Filter posts by tag - const filteredPosts = allPosts.filter((post) => - post.data.tags.includes(tag) - ); - // Sort filtered posts by date in descending order - const sortedPosts = filteredPosts.sort( - (a, b) => new Date(b.data.pubDate) - new Date(a.data.pubDate) - ); - - return { - params: { tag }, - props: { posts: sortedPosts }, - }; - }); -} - -const { tag } = Astro.params; -const { posts } = Astro.props; ---- - - -
-
- -
    - { - posts.map((post) => ( - - )) - } -
-
-
-
diff --git a/src/pages/tags/index.astro b/src/pages/tags/index.astro deleted file mode 100644 index 5a17ffa..0000000 --- a/src/pages/tags/index.astro +++ /dev/null @@ -1,23 +0,0 @@ ---- -import { getCollection } from "astro:content"; -import BaseLayout from "@/layouts/BaseLayout.astro"; -const allPosts = await getCollection("posts"); -const tags = [...new Set(allPosts.map((post) => post.data.tags).flat())]; -const sortedTags = tags.sort((a, b) => a.localeCompare(b)); // Sort tags alphabetically - -const pageTitle = "Tag Index"; ---- - - -
-
-
    - {sortedTags.map((tag) => ( -
  1. - {tag} -
  2. - ))} -
-
-
-