Skip to content

Commit

Permalink
fix: update dependencies for prettier, tailwindcss, and knip (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
RPDeshaies authored Dec 10, 2024
1 parent 7345a27 commit 6cd40f0
Show file tree
Hide file tree
Showing 30 changed files with 147 additions and 113 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@RPDeshaies
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches:
- "**"

jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v4
# Use Bun
- name: Use Bun
uses: oven-sh/setup-bun@v2
# with:
# bun-version: 1.1.38
# Install
- name: Install
run: bun install
# Build
- name: Build
run: bun run build
42 changes: 21 additions & 21 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import mdx from "@astrojs/mdx";
import netlify from "@astrojs/netlify";
import react from "@astrojs/react";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import { defineConfig } from "astro/config";
import { constants } from "./src/domains/utils/constants";

import netlify from "@astrojs/netlify";

import partytown from "@astrojs/partytown";

// https://astro.build/config
Expand All @@ -29,27 +28,28 @@ export default defineConfig({
forward: ["dataLayer.push"],
},
}),
// starlight({
// title: "Keeper Documentation",
// disable404Route: true,
// logo: {
// src: "./public/keeper/name.svg",
// replacesTitle: true,
// },
// sidebar: [
// {
// label: "Documentation",
// autogenerate: {
// directory: "docs",
//
// starlight({
// title: "Keeper Documentation",
// disable404Route: true,
// logo: {
// src: "./public/keeper/name.svg",
// replacesTitle: true,
// },
// sidebar: [
// {
// label: "Documentation",
// autogenerate: {
// directory: "docs",
// },
// },
// ],
// customCss: ["./src/styles/docs.css"],
// social: {
// discord: "https://farirpgs.com/discord",
// github: "https://github.com/farirpgs/keeper",
// },
// ],
// customCss: ["./src/styles/docs.css"],
// social: {
// discord: "https://farirpgs.com/discord",
// github: "https://github.com/farirpgs/keeper",
// },
// }),
// }),
],
experimental: {
contentIntellisense: true,
Expand Down
Binary file modified bun.lockb
Binary file not shown.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@astrojs/mdx": "4.0.1",
"@astrojs/netlify": "6.0.0",
"@astrojs/partytown": "^2.1.2",
"@astrojs/starlight": "^0.29.2",
"@astrojs/react": "4.0.0",
"@astrojs/sitemap": "^3.2.1",
"@astrojs/tailwind": "5.1.3",
Expand All @@ -41,20 +42,20 @@
"github-slugger": "^2.0.0",
"lodash": "^4.17.21",
"lucide-react": "^0.454.0",
"prettier": "^3.4.1",
"prettier": "^3.4.2",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-tailwindcss": "^0.6.9",
"prompts": "^2.4.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rehype-slug": "^6.0.0",
"remark-gfm": "^4.0.0",
"tailwindcss": "^3.4.15",
"tailwindcss": "^3.4.16",
"typescript": "^5.7.2",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/node": "^22.10.1",
"knip": "^5.38.2"
"knip": "^5.39.1"
}
}
2 changes: 1 addition & 1 deletion src/components/server/Footer/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const links: Record<string, Record<string, string>> = {
Discord: "https://farirpgs.com/discord",
Bluesky: "https://farirpgs.com/bluesky",
Threads: "https://farirpgs.com/threads",
GitHub: "https://github.com/farirpgs",
GitHub: "https://github.com/farirpgs/keeper",
},
Miscellaneous: {
Contact: "https://farirpgs.com/contact",
Expand Down
42 changes: 23 additions & 19 deletions src/components/server/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,24 @@ export function Header(props: { theme?: ThemeType }) {
<Box className="hidden sm:inline-block">
<DiceRoller theme={props.theme} />
</Box>
<Tooltip content="Documentation">
<Button
radius="full"
size="3"
variant="ghost"
className="m-0 hidden md:inline-block"
style={{
fontFamily,
}}
asChild
>
<a href={AppUrl.docs()} aria-label="Documentation">
<ReaderIcon className="h-[24px] w-[24px]" />
</a>
</Button>
</Tooltip>
{false && (
<Tooltip content="Documentation">
<Button
radius="full"
size="3"
variant="ghost"
className="m-0 hidden md:inline-block"
style={{
fontFamily,
}}
asChild
>
<a href={AppUrl.docs()} aria-label="Documentation">
<ReaderIcon className="h-[24px] w-[24px]" />
</a>
</Button>
</Tooltip>
)}
<Tooltip content="Search">
<Button
radius="full"
Expand Down Expand Up @@ -212,9 +214,11 @@ export function Header(props: { theme?: ThemeType }) {
<Link href={AppUrl.dice()} color="gray">
Dice Roller
</Link>
<Link href={AppUrl.docs()} color="gray">
Documentation
</Link>
{false && (
<Link href={AppUrl.docs()} color="gray">
Documentation
</Link>
)}
<Link href={AppUrl.search({})} color="gray">
Search
</Link>
Expand Down
3 changes: 2 additions & 1 deletion src/content.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { glob } from "astro/loaders";
import { defineCollection, reference, z } from "astro:content";

import { Colors } from "./domains/colors/colors";

const themeSchema = z
Expand Down Expand Up @@ -71,7 +72,7 @@ export const collections = {
weight: z.number().optional().default(0),
license: z.string().optional(),
_optimizedImageSrc: z.string().optional(),
_slugWithoutLocale: z.string().optional(),
_idWithoutLocale: z.string().optional(),
_locale: z.string().optional(),
}),
}),
Expand Down
26 changes: 13 additions & 13 deletions src/domains/app-url/AppUrl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@ export const AppUrl = {
patreon() {
return "https://www.patreon.com/bePatron?u=43408921";
},
creator(props: { slug: CollectionEntry<"creators">["id"] }) {
return `/creators/${props.slug}/`;
creator(props: { id: CollectionEntry<"creators">["id"] }) {
return `/creators/${props.id}/`;
},
game(props: { slug: CollectionEntry<"games">["id"] }) {
return `/games/${props.slug}/`;
game(props: { id: CollectionEntry<"games">["id"] }) {
return `/games/${props.id}/`;
},
resource(props: { slug: CollectionEntry<"resources">["id"] }) {
return `/resources/${props.slug}/`;
resource(props: { id: CollectionEntry<"resources">["id"] }) {
return `/resources/${props.id}/`;
},
resourcePage(props: {
slug: CollectionEntry<"resources">["id"];
id: CollectionEntry<"resources">["id"];
page: string;
}) {
const [creatorSegment, resourceSegment, languageSegment] =
props.slug.split("/");
props.id.split("/");

const pageSegment = props.page ? `${props.page}/` : "";
if (languageSegment) {
return `/resources/${creatorSegment}/${resourceSegment}.${languageSegment}/${pageSegment}`;
}
return `/resources/${props.slug}/${pageSegment}`;
return `/resources/${props.id}/${pageSegment}`;
},
asset(props: { slug: CollectionEntry<"assets">["id"] }) {
return `/games/${props.slug}/`;
asset(props: { id: CollectionEntry<"assets">["id"] }) {
return `/games/${props.id}/`;
},
search(props: { query?: string; type?: SearchType }) {
const searchParams = new URLSearchParams();
Expand All @@ -56,9 +56,9 @@ export const AppUrl = {
return `/search/?${searchParams.toString()}`;
},
githubResource(props: {
slug: CollectionEntry<"resources">["id"];
id: CollectionEntry<"resources">["id"];
page: string;
}) {
return `https://github.com/farirpgs/keeper/tree/main/src/content/resources/${props.slug}/index.mdx#${props.page}/`;
return `https://github.com/farirpgs/keeper/tree/main/src/content/resources/${props.id}/index.mdx#${props.page}/`;
},
};
30 changes: 15 additions & 15 deletions src/domains/dl/DLAstro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export const DLAstro = {
return { creators };
},
async getCreator(props: {
slug: CollectionEntry<"creators">["id"];
id: CollectionEntry<"creators">["id"];
includeGames?: boolean;
includeResources?: boolean;
}) {
const creator = await getEntry("creators", props.slug);
const creator = await getEntry("creators", props.id);

let games: Array<CollectionEntry<"games">> = [];
let resources: Array<CollectionEntry<"resources">> = [];
Expand Down Expand Up @@ -41,10 +41,10 @@ export const DLAstro = {
return { games };
},
async getGame(props: {
slug: CollectionEntry<"games">["id"];
id: CollectionEntry<"games">["id"];
includeCreator?: boolean;
}) {
const game = await getEntry("games", props.slug);
const game = await getEntry("games", props.id);

if (props.includeCreator) {
const creator = await getEntry("creators", game.data.creator.id);
Expand Down Expand Up @@ -78,9 +78,9 @@ export const DLAstro = {
},
// ASSET
async getAssetWithGameAndCreator(props: {
slug: CollectionEntry<"assets">["id"];
id: CollectionEntry<"assets">["id"];
}) {
const asset = await getEntry("assets", props.slug);
const asset = await getEntry("assets", props.id);

const game = await getEntry(asset.data.game);
const creator = await getEntry(game.data.creator);
Expand All @@ -90,30 +90,30 @@ export const DLAstro = {
creator: creator!,
};
},
async getAssetsForGame(props: { slug: CollectionEntry<"games">["id"] }) {
async getAssetsForGame(props: { id: CollectionEntry<"games">["id"] }) {
const assets = await getCollection("assets", ({ data }) => {
return data.game.id === props.slug;
return data.game.id === props.id;
});

return { assets };
},
// RESOURCE
async getResource(props: {
slug: CollectionEntry<"resources">["id"];
id: CollectionEntry<"resources">["id"];
includeCreator?: boolean;
}) {
const [creatorSlug, resourceSlug, locale] = props.slug.split("/");
const slugWithoutLocale = [creatorSlug, resourceSlug].join("/");
const [creatorId, resourceId, locale] = props.id.split("/");
const idWithoutLocale = [creatorId, resourceId].join("/");
const currentLocale = locale || "en";
const resource = await getEntry("resources", props.slug);
const resource = await getEntry("resources", props.id);
const translations = await getCollection("resources", (element) => {
return element.id.startsWith(slugWithoutLocale);
return element.id.startsWith(idWithoutLocale);
});

const locales = translations
.map((element) => {
const language = element.id
.replace(slugWithoutLocale, "")
.replace(idWithoutLocale, "")
.replace("/", "");
return language || "en";
})
Expand All @@ -129,7 +129,7 @@ export const DLAstro = {
});

resource.data._locale = currentLocale;
resource.data._slugWithoutLocale = slugWithoutLocale;
resource.data._idWithoutLocale = idWithoutLocale;

if (props.includeCreator) {
const creator = await getEntry("creators", resource.data.creator.id);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/getGameWithCreator/[...path]/data.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const GET: APIRoute = async ({ params, request }) => {
.parse(params) as Params;

const game = await DLAstro.getGame({
slug: parsedParams.path,
id: parsedParams.path,
includeCreator: true,
});

Expand Down
2 changes: 1 addition & 1 deletion src/pages/creators/[creatorSlug]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const props = Astro.props as Props;
const params = Astro.params as Params;
const { creator, games, resources } = await DLAstro.getCreator({
slug: params.creatorSlug,
id: params.creatorSlug,
includeGames: true,
includeResources: true,
});
Expand Down
6 changes: 3 additions & 3 deletions src/pages/games/[creatorSlug]/[gameSlug]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ export type Props = InferGetStaticPropsType<typeof getStaticPaths>;
const props = Astro.props as Props;
const params = Astro.params as Params;
const { creator } = await DLAstro.getCreator({ slug: params.creatorSlug });
const { creator } = await DLAstro.getCreator({ id: params.creatorSlug });
const { game } = await DLAstro.getGame({
slug: (params.creatorSlug +
id: (params.creatorSlug +
"/" +
params.gameSlug) as CollectionEntry<"games">["id"],
});
const { assets } = await DLAstro.getAssetsForGame({
slug: (params.creatorSlug +
id: (params.creatorSlug +
"/" +
params.gameSlug) as CollectionEntry<"games">["id"],
});
Expand Down
2 changes: 1 addition & 1 deletion src/pages/og/creators/[creatorSlug]/image.png.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const GET: APIRoute = async (ctx) => {
const params = ctx.params as Params;

const { creator } = await DLAstro.getCreator({
slug: params.creatorSlug,
id: params.creatorSlug,
});

return await renderOgImage({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const GET: APIRoute = async (ctx) => {
const params = ctx.params as Params;

const { asset, game, creator } = await DLAstro.getAssetWithGameAndCreator({
slug: `${params.creatorSlug}/${params.gameSlug}/${params.assetSlug}` as any,
id: `${params.creatorSlug}/${params.gameSlug}/${params.assetSlug}` as any,
});

const backgroundImage = await getImage({
Expand Down
Loading

0 comments on commit 6cd40f0

Please sign in to comment.