Skip to content

Commit

Permalink
Merge branch 'dev' into prefixing
Browse files Browse the repository at this point in the history
  • Loading branch information
malangcat committed Feb 13, 2025
2 parents 0cd6a96 + a77ff10 commit c8120cb
Show file tree
Hide file tree
Showing 58 changed files with 1,127 additions and 32,307 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
bun-version: latest

- name: Install dependencies
run: bun install --immutable
run: bun install --frozen-lockfile

- name: Build
run: bun build-only-package
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/docs-deploy-alpha-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
branches:
- "**"
- "!main"
- "!dev" # V3 deployment; remove this when V3 is stable
paths:
- "docs/**"
- "packages/recipe/**"
Expand Down Expand Up @@ -33,13 +34,13 @@ jobs:
path: |
docs/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lockb') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lockb') }}-
${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock') }}-
- name: Install Dependencies
run: bun install --immutable
run: bun install --frozen-lockfile

- name: Build Packages
run: bun build-only-package && bun rootage:build
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/docs-deploy-production-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,19 @@ jobs:
with:
bun-version: latest

- name: Restore cache
uses: actions/cache@v4
with:
path: |
docs/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock') }}-
- name: Install Dependencies
run: bun install --immutable
run: bun install --frozen-lockfile

- name: Build Packages
run: bun build-only-package && bun rootage:build
Expand All @@ -43,4 +54,4 @@ jobs:
run: |
CLOUDFLARE_ACCOUNT_ID=${{ secrets.CF_ACCOUNT_ID }} \
CLOUDFLARE_API_TOKEN=${{ secrets.CF_API_TOKEN }} \
bun wrangler pages deploy ./docs/out --project-name=seed-design-v3 --branch=main
bun wrangler pages deploy ./docs/out --project-name=seed-design-v3 --branch=${{ github.ref_name }}
4 changes: 2 additions & 2 deletions .github/workflows/docs-deploy-qa-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
bun-version: latest

- name: Install Dependencies
run: bun install --immutable
run: bun install --frozen-lockfile

- name: Build Packages
run: bun build-only-package
Expand All @@ -42,4 +42,4 @@ jobs:
run: |
CLOUDFLARE_ACCOUNT_ID=${{ secrets.CF_ACCOUNT_ID }} \
CLOUDFLARE_API_TOKEN=${{ secrets.CF_API_TOKEN }} \
bun wrangler pages deploy ./examples/stackflow-spa/dist --project-name=seed-design-qa --branch=main
bun wrangler pages deploy ./examples/stackflow-spa/dist --project-name=seed-design-qa --branch=${{ github.ref_name }}
3 changes: 2 additions & 1 deletion .github/workflows/docs-deploy-storybook-alpha-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
branches:
- "**"
- "!main"
- "!dev" # V3 deployment; remove this when V3 is stable

paths:
- "docs/**"
Expand All @@ -29,7 +30,7 @@ jobs:
bun-version: latest

- name: Install Dependencies
run: bun install --immutable
run: bun install --frozen-lockfile

- name: Build Packages
run: bun build-only-package
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs-deploy-storybook-production-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
bun-version: latest

- name: Install Dependencies
run: bun install --immutable
run: bun install --frozen-lockfile

- name: Build Packages
run: bun build-only-package
Expand All @@ -42,4 +42,4 @@ jobs:
run: |
CLOUDFLARE_ACCOUNT_ID=${{ secrets.CF_ACCOUNT_ID }} \
CLOUDFLARE_API_TOKEN=${{ secrets.CF_API_TOKEN }} \
bun wrangler pages deploy ./docs/storybook-static --project-name=seed-design-v3-storybook --branch=main
bun wrangler pages deploy ./docs/storybook-static --project-name=seed-design-v3-storybook --branch=${{ github.ref_name }}
2 changes: 1 addition & 1 deletion .github/workflows/react-headless-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
bun-version: latest

- name: Install dependencies
run: bun install --immutable
run: bun install --frozen-lockfile

- name: Build headless common dependencies
run: bun --filter @seed-design/dom-utils build && bun --filter @seed-design/react-primitive build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
bun-version: latest

- name: Install Dependencies
run: bun install --immutable
run: bun install --frozen-lockfile

- name: 릴리즈 Pull Request를 만들거나 패키지를 배포해요
id: changesets
Expand Down
5 changes: 3 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"enabled": false
},
"formatter": {
"ignore": ["package.json", "**/archive/**/*", "**/.next/**/*"],
"ignore": ["package.json", "**/archive/**/*", "**/.next/**/*", "__testfixtures__"],
"enabled": true,
"indentStyle": "space",
"lineEnding": "lf",
Expand All @@ -29,7 +29,8 @@
".source",
".vscode",
"out",
"bin"
"bin",
"__testfixtures__"
],
"rules": {
"recommended": true,
Expand Down
2 changes: 1 addition & 1 deletion bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"clsx": "^2.1.1",
"fumadocs-core": "^14.4.2",
"fumadocs-docgen": "^1.3.2",
"fumadocs-mdx": "^11.1.1",
"fumadocs-mdx": "^11.5.3",
"fumadocs-typescript": "^3.0.2",
"fumadocs-ui": "^14.4.2",
"next": "^14.2.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { mdxComponents } from "@/components/mdx/mdx-components";
import { client } from "@/sanity/lib/client";
import { GUIDELINE_QUERY } from "@/sanity/lib/queries";
import { PortableContent } from "@/sanity/lib/sanity-content";
import { PortableText } from "@portabletext/react";
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/page";
import type { Metadata } from "next";
import { notFound } from "next/navigation";
Expand All @@ -12,28 +13,32 @@ function getPath(slug: string[]) {
return slug.join("/");
}

function styleToLevel(style: unknown) {
if (typeof style !== "string") return;
return Number.parseInt(style.split("h")[1]);
}

export default async function Page({
params,
}: {
params: { slug?: string[] };
}) {
const page = source.getPage(params.slug);
const fullPath = ["design", ...(params.slug ?? [])];
const page = source.getPage(fullPath);
if (!page) notFound();

const MDX = page.data.body;
const path = getPath(params.slug ?? []);
const guideline = params.slug?.includes("design")
? await client.fetch(GUIDELINE_QUERY, { path })
: null;

const guideline = await client.fetch(GUIDELINE_QUERY, { path: `design/${path}` });
const guidelineToc =
guideline?.toc?.map((item: PortableTextBlock) => {
return {
depth: item.level ?? 0,
depth: item.level ?? styleToLevel(item.style) ?? 0,
title: (
<PortableContent
content={{
...item,
<PortableText
value={{
...(item as PortableTextBlock),
style: undefined,
}}
/>
Expand All @@ -51,19 +56,29 @@ export default async function Page({
<DocsTitle>{page.data.title}</DocsTitle>
<DocsDescription>{page.data.description}</DocsDescription>
<DocsBody>
{guideline && <PortableContent content={guideline.content} />}
{guideline && (
<div className="mb-8">
<PortableContent content={guideline.content} />
</div>
)}
<MDX components={mdxComponents} />
</DocsBody>
</DocsPage>
);
}

export async function generateStaticParams() {
return source.generateParams();
return source
.generateParams()
.filter((params) => params.slug?.[0] === "design")
.map((params) => ({
slug: params.slug?.slice(1),
}));
}

export function generateMetadata({ params }: { params: { slug?: string[] } }) {
const page = source.getPage(params.slug);
const fullPath = ["design", ...(params.slug ?? [])];
const page = source.getPage(fullPath);
if (!page) notFound();

return {
Expand Down
47 changes: 47 additions & 0 deletions docs/app/docs/react/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { source } from "@/app/source";
import { mdxComponents } from "@/components/mdx/mdx-components";
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/page";
import type { Metadata } from "next";
import { notFound } from "next/navigation";

export default async function Page({
params,
}: {
params: { slug?: string[] };
}) {
const fullPath = ["react", ...(params.slug ?? [])];
const page = source.getPage(fullPath);
if (!page) notFound();

const MDX = page.data.body;

return (
<DocsPage toc={page.data.toc} full={page.data.full} lastUpdate={page.data.lastModified}>
<DocsTitle>{page.data.title}</DocsTitle>
<DocsDescription>{page.data.description}</DocsDescription>
<DocsBody>
<MDX components={mdxComponents} />
</DocsBody>
</DocsPage>
);
}

export async function generateStaticParams() {
return source
.generateParams()
.filter((params) => params.slug?.[0] === "react")
.map((params) => ({
slug: params.slug?.slice(1),
}));
}

export function generateMetadata({ params }: { params: { slug?: string[] } }) {
const fullPath = ["react", ...(params.slug ?? [])];
const page = source.getPage(fullPath);
if (!page) notFound();

return {
title: page.data.title,
description: page.data.description,
} satisfies Metadata;
}
Loading

0 comments on commit c8120cb

Please sign in to comment.