From 1df6a9d92de697e61715122dfd7fff182cb4deaa Mon Sep 17 00:00:00 2001
From: Cyrus Yiu
Date: Sat, 16 Mar 2024 17:17:32 -0400
Subject: [PATCH] RSS feed
---
.gitignore | 3 +-
.prettierignore | 4 ++
content/posts/Awesome-Arcades-First-Blog.md | 2 +-
package.json | 1 +
.../AwesomeArcadeList/extension.tsx | 2 +-
src/components/AwesomeArcadeList/list.tsx | 2 +-
src/components/AwesomeArcadeList/tool.tsx | 2 +-
src/components/Blog/Post/Post.tsx | 2 +-
src/components/Blog/Post/Preview.tsx | 9 +--
.../extension.tsx | 6 +-
.../OldAwesomeArcadeExtensionList/list.tsx | 2 +-
.../OldAwesomeArcadeExtensionList/tool.tsx | 4 +-
src/components/WithAppProps/appProps.ts | 16 ++++-
src/pages/blog/index.tsx | 33 ++++++++++-
src/pages/extensions.tsx | 4 +-
src/pages/index.tsx | 9 ++-
src/pages/old.tsx | 4 +-
src/pages/tools.tsx | 4 +-
.../{Utils => }/ParseListXML/helpers.ts | 2 +-
src/scripts/{Utils => }/ParseListXML/index.ts | 0
src/scripts/{Utils => }/ParseListXML/parse.ts | 4 +-
src/scripts/{Utils => }/ParseListXML/types.ts | 0
.../ParseOldExtensionsXML/index.ts | 0
.../ParseOldExtensionsXML/parse.ts | 14 ++---
src/scripts/RSS/index.ts | 58 +++++++++++++++++++
.../{Utils => }/SiteWebmanifest/index.ts | 0
.../{Utils => }/SiteWebmanifest/manifest.ts | 2 +-
tina/config.ts | 7 ++-
tina/tina-lock.json | 12 ++--
yarn.lock | 50 +++++++---------
30 files changed, 182 insertions(+), 76 deletions(-)
rename src/scripts/{Utils => }/ParseListXML/helpers.ts (97%)
rename src/scripts/{Utils => }/ParseListXML/index.ts (100%)
rename src/scripts/{Utils => }/ParseListXML/parse.ts (98%)
rename src/scripts/{Utils => }/ParseListXML/types.ts (100%)
rename src/scripts/{Utils => }/ParseOldExtensionsXML/index.ts (100%)
rename src/scripts/{Utils => }/ParseOldExtensionsXML/parse.ts (77%)
create mode 100644 src/scripts/RSS/index.ts
rename src/scripts/{Utils => }/SiteWebmanifest/index.ts (100%)
rename src/scripts/{Utils => }/SiteWebmanifest/manifest.ts (93%)
diff --git a/.gitignore b/.gitignore
index 5181727..5490eb0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,6 +39,7 @@ next-env.d.ts
/public/oldExtensions.json
/public/extensions.json
/public/tools.json
+/public/rss.xml
node_modules
-.env
\ No newline at end of file
+.env
diff --git a/.prettierignore b/.prettierignore
index 2f1a02b..5490eb0 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -39,3 +39,7 @@ next-env.d.ts
/public/oldExtensions.json
/public/extensions.json
/public/tools.json
+/public/rss.xml
+
+node_modules
+.env
diff --git a/content/posts/Awesome-Arcades-First-Blog.md b/content/posts/Awesome-Arcades-First-Blog.md
index 1fb0f64..ee38f9b 100644
--- a/content/posts/Awesome-Arcades-First-Blog.md
+++ b/content/posts/Awesome-Arcades-First-Blog.md
@@ -1,7 +1,7 @@
---
title: Awesome Arcade's First Blog!
author: content/authors/UnsignedArduino.md
-description: "*The last time I started a blog, I forgot about it after two posts. Hopefully, that doesn't happen this time! \U0001F92A*\n"
+description: "The last time I started a blog, I forgot about it after two posts. Hopefully, that doesn't happen this time! \U0001F92A"
tags:
- Experiences
- Tips and tricks
diff --git a/package.json b/package.json
index 32e58bd..11ff20e 100644
--- a/package.json
+++ b/package.json
@@ -63,6 +63,7 @@
"bootstrap-icons": "^1.11.3",
"dompurify": "^3.0.8",
"fast-xml-parser": "^4.3.4",
+ "feed": "^4.2.2",
"isomorphic-dompurify": "^2.3.0",
"midifile-ts": "^1.5.1",
"next": "14.1.0",
diff --git a/src/components/AwesomeArcadeList/extension.tsx b/src/components/AwesomeArcadeList/extension.tsx
index 126406c..f3e9225 100644
--- a/src/components/AwesomeArcadeList/extension.tsx
+++ b/src/components/AwesomeArcadeList/extension.tsx
@@ -1,4 +1,4 @@
-import { Extension, ExtensionRef, URLLink } from "@/scripts/Utils/ParseListXML";
+import { Extension, ExtensionRef, URLLink } from "../../scripts/ParseListXML";
import React from "react";
import "tippy.js/dist/tippy.css";
import { copyTextToClipboard } from "@/scripts/Utils/Clipboard";
diff --git a/src/components/AwesomeArcadeList/list.tsx b/src/components/AwesomeArcadeList/list.tsx
index 6ad4fd3..5f0a23f 100644
--- a/src/components/AwesomeArcadeList/list.tsx
+++ b/src/components/AwesomeArcadeList/list.tsx
@@ -3,7 +3,7 @@ import getElement from "@/scripts/Utils/Element";
import { forceOutboundLinksToNewPage } from "@/scripts/Utils/PageUtils";
import { AwesomeArcadeExtensionGroup } from "@/components/AwesomeArcadeList/extension";
import { AwesomeArcadeToolGroup } from "@/components/AwesomeArcadeList/tool";
-import { Extension, Tool } from "@/scripts/Utils/ParseListXML";
+import { Extension, Tool } from "../../scripts/ParseListXML";
export function AwesomeArcadeExtensionsList({
list,
diff --git a/src/components/AwesomeArcadeList/tool.tsx b/src/components/AwesomeArcadeList/tool.tsx
index 9096da6..3eb2904 100644
--- a/src/components/AwesomeArcadeList/tool.tsx
+++ b/src/components/AwesomeArcadeList/tool.tsx
@@ -1,4 +1,4 @@
-import { Tool, ToolRef, URLLink } from "@/scripts/Utils/ParseListXML";
+import { Tool, ToolRef, URLLink } from "../../scripts/ParseListXML";
import React from "react";
import Link from "next/link";
import { smoothScrollHash } from "@/components/Linkable/Header";
diff --git a/src/components/Blog/Post/Post.tsx b/src/components/Blog/Post/Post.tsx
index 4e68830..ad8a0b5 100644
--- a/src/components/Blog/Post/Post.tsx
+++ b/src/components/Blog/Post/Post.tsx
@@ -22,7 +22,7 @@ export default function BlogPost({
) : null}
-
+
{data.post.description}
diff --git a/src/components/Blog/Post/Preview.tsx b/src/components/Blog/Post/Preview.tsx
index 3e139b4..3aff0b0 100644
--- a/src/components/Blog/Post/Preview.tsx
+++ b/src/components/Blog/Post/Preview.tsx
@@ -1,9 +1,6 @@
import { Authors } from "../../../../tina/__generated__/types";
import React from "react";
-import {
- RichTextSectionRenderer,
- ShortAuthorRenderer,
-} from "@/components/Blog/Elements";
+import { ShortAuthorRenderer } from "@/components/Blog/Elements";
import { formatDateAndTime } from "@/scripts/Utils/DateAndTime/Format";
import Link from "next/link";
@@ -35,9 +32,7 @@ export default function BlogPostPreviewRenderer({
)}
-
-
-
+
{preview.description}
View post
diff --git a/src/components/OldAwesomeArcadeExtensionList/extension.tsx b/src/components/OldAwesomeArcadeExtensionList/extension.tsx
index 03d5403..3c94194 100644
--- a/src/components/OldAwesomeArcadeExtensionList/extension.tsx
+++ b/src/components/OldAwesomeArcadeExtensionList/extension.tsx
@@ -2,7 +2,7 @@ import {
Extension,
ExtensionRef,
URLLink,
-} from "@/scripts/Utils/ParseOldExtensionsXML";
+} from "../../scripts/ParseOldExtensionsXML";
import React from "react";
import "tippy.js/dist/tippy.css";
import { copyTextToClipboard } from "@/scripts/Utils/Clipboard";
@@ -109,14 +109,14 @@ export function AwesomeArcadeExtension({
setTooltip("Copied!");
} else {
setTooltip(
- "Failed to copy - did you give us clipboard permission?"
+ "Failed to copy - did you give us clipboard permission?",
);
}
tipRef.current.setContent(tooltip);
window.document.documentElement.dispatchEvent(
new CustomEvent("clickrepo", {
detail: ext.repo,
- })
+ }),
);
AnalyticEvents.sendAwesomeClick(ext.repo);
}}
diff --git a/src/components/OldAwesomeArcadeExtensionList/list.tsx b/src/components/OldAwesomeArcadeExtensionList/list.tsx
index 6eb214c..fe6e584 100644
--- a/src/components/OldAwesomeArcadeExtensionList/list.tsx
+++ b/src/components/OldAwesomeArcadeExtensionList/list.tsx
@@ -1,4 +1,4 @@
-import { ExtensionList } from "@/scripts/Utils/ParseOldExtensionsXML";
+import { ExtensionList } from "../../scripts/ParseOldExtensionsXML";
import React from "react";
import getElement from "@/scripts/Utils/Element";
import { forceOutboundLinksToNewPage } from "@/scripts/Utils/PageUtils";
diff --git a/src/components/OldAwesomeArcadeExtensionList/tool.tsx b/src/components/OldAwesomeArcadeExtensionList/tool.tsx
index 7839610..b714a2e 100644
--- a/src/components/OldAwesomeArcadeExtensionList/tool.tsx
+++ b/src/components/OldAwesomeArcadeExtensionList/tool.tsx
@@ -1,4 +1,4 @@
-import { Tool, ToolRef, URLLink } from "@/scripts/Utils/ParseOldExtensionsXML";
+import { Tool, ToolRef, URLLink } from "../../scripts/ParseOldExtensionsXML";
import React from "react";
import Link from "next/link";
import { smoothScrollHash } from "@/components/OldAwesomeArcadeExtensionList/linkableHeader";
@@ -57,7 +57,7 @@ export function AwesomeArcadeTool({
window.document.documentElement.dispatchEvent(
new CustomEvent("clicktool", {
detail: tool.repo,
- })
+ }),
);
AnalyticEvents.sendAwesomeClick(tool.repo);
};
diff --git a/src/components/WithAppProps/appProps.ts b/src/components/WithAppProps/appProps.ts
index 6decc25..1f43296 100644
--- a/src/components/WithAppProps/appProps.ts
+++ b/src/components/WithAppProps/appProps.ts
@@ -1,4 +1,4 @@
-import { parseExtensionXML, parseToolXML } from "@/scripts/Utils/ParseListXML";
+import { parseExtensionXML, parseToolXML } from "../../scripts/ParseListXML";
import { promises as fs } from "fs";
import path from "path";
@@ -12,6 +12,20 @@ export function getEnvironment(): Environment {
: "production";
}
+export function getBaseURL(): string {
+ switch (getEnvironment()) {
+ case "production": {
+ return "https://awesome-arcade.vercel.app";
+ }
+ case "preview": {
+ return "https://awesome-arcade-beta.vercel.app";
+ }
+ case "development": {
+ return "http://localhost:3000";
+ }
+ }
+}
+
export function getBranch(): "main" | "staging" {
return getEnvironment() === "production" ? "main" : "staging";
}
diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx
index a043466..0d2ba1a 100644
--- a/src/pages/blog/index.tsx
+++ b/src/pages/blog/index.tsx
@@ -7,6 +7,8 @@ import BlogPostPreviewRenderer, {
BlogPostPreview,
} from "@/components/Blog/Post/Preview";
import Link from "next/link";
+import { promises as fs } from "fs";
+import generateRSSFeed from "@/scripts/RSS";
type BlogProps = {
blogPostPreviews: BlogPostPreview[];
@@ -31,7 +33,31 @@ export default function BlogPage(props: BlogProps) {
MakeCode Arcade.
- Find all blog posts here.
+ I hope you find these posts useful and interesting. If you have any
+ questions, suggestions, or feedback, feel free to reach out to me on{" "}
+
+ GitHub Discussions
+ {" "}
+ or the{" "}
+
+ MakeCode forums
+
+ .
+