Skip to content

Commit 6dadbbd

Browse files
authored
Merge pull request #2 from pheralb/next
Prepare new version 🚀
2 parents 7ee038f + d040fb8 commit 6dadbbd

170 files changed

Lines changed: 4196 additions & 1212 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Check
2+
3+
on:
4+
push:
5+
branches: [main, next]
6+
pull_request:
7+
branches: [main, next]
8+
9+
jobs:
10+
lint_registry:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v6
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v6
18+
with:
19+
node-version: "22"
20+
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Get pnpm store directory
25+
shell: bash
26+
run: |
27+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
28+
29+
- name: Setup pnpm cache
30+
uses: actions/cache@v5
31+
with:
32+
path: ${{ env.STORE_PATH }}
33+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pnpm-store-
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Check Website Eslint
41+
run: |
42+
pnpm run website:lint
43+
44+
- name: Check Registry
45+
run: |
46+
pnpm run website:registry
47+
48+
build:
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- uses: actions/checkout@v6
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v6
56+
with:
57+
node-version: "22"
58+
59+
- name: Install pnpm
60+
uses: pnpm/action-setup@v4
61+
62+
- name: Get pnpm store directory
63+
shell: bash
64+
run: |
65+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
66+
67+
- name: Setup pnpm cache
68+
uses: actions/cache@v5
69+
with:
70+
path: ${{ env.STORE_PATH }}
71+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
72+
restore-keys: |
73+
${{ runner.os }}-pnpm-store-
74+
75+
- name: Install dependencies
76+
run: pnpm install --frozen-lockfile
77+
78+
- name: Build Content Collections
79+
run: |
80+
pnpm run website:build-cc
81+
82+
- name: Build Website
83+
run: |
84+
pnpm run website:build

.gitignore

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
31
# dependencies
4-
/node_modules
2+
node_modules
53
/.pnp
64
.pnp.*
75
.yarn/*
@@ -14,8 +12,11 @@
1412
/coverage
1513

1614
# next.js
17-
/.next/
18-
/out/
15+
.next
16+
out
17+
18+
# turbo
19+
.turbo
1920

2021
# production
2122
/build
@@ -30,7 +31,7 @@ yarn-debug.log*
3031
yarn-error.log*
3132
.pnpm-debug.log*
3233

33-
# env files (can opt-in for committing if needed)
34+
# env files
3435
.env*
3536

3637
# vercel

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Ignore artifacts:
2+
build
3+
dist
4+
.content-collections
5+
coverage
6+
pnpm-workspace.yaml
7+
node_modules

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2-
31
## Getting Started
42

53
First, run the development server:
Lines changed: 68 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import rehypeAutolinkHeadings from "rehype-autolink-headings";
1717

1818
import { highlight } from "./src/utils/shiki";
1919
import { rehypeShikiOptions } from "./src/mdx/plugins/rehypeShiki";
20-
import { getTableOfContents } from "./src/mdx/plugins/generateToC";
2120
import { rehypeComponent } from "./src/mdx/plugins/rehypeComponent";
2221
import { rehypeReactDoc } from "./src/mdx/plugins/rehypeReactDoc";
2322
import { HEADING_LINK_ANCHOR } from "./src/components/ui/headings";
@@ -26,22 +25,29 @@ import { HEADING_LINK_ANCHOR } from "./src/components/ui/headings";
2625
const docSchema = z.object({
2726
title: z.string(),
2827
description: z.string(),
29-
category: z.string(),
28+
category: z.string().array(),
3029
content: z.string(),
3130
});
3231

3332
type DocSchema = z.infer<typeof docSchema>;
3433
type DocsDocument = Document & DocSchema;
3534

35+
interface DocTransformParams {
36+
folder: string;
37+
subFolder?: string;
38+
document: DocsDocument;
39+
context: Context;
40+
}
41+
3642
// Transform:
37-
const docTransform = async (
38-
folder: string,
39-
document: DocsDocument,
40-
context: Context,
41-
) => {
43+
const docTransform = async ({
44+
folder,
45+
subFolder,
46+
document,
47+
context,
48+
}: DocTransformParams) => {
4249
const highlighter = await highlight();
43-
const tableOfContents = getTableOfContents(document.content);
44-
const mdx = await compileMDX(context, document, {
50+
const code = await compileMDX(context, document, {
4551
remarkPlugins: [remarkGfm],
4652
rehypePlugins: [
4753
rehypeComponent,
@@ -62,18 +68,24 @@ const docTransform = async (
6268
return {
6369
...document,
6470
folder,
65-
tableOfContents,
66-
mdx,
71+
subFolder,
72+
mdx: code,
6773
};
6874
};
6975

7076
// Collections:
7177
const generalDocs = defineCollection({
7278
name: "general",
7379
directory: "src/docs",
74-
include: "**/*.mdx",
80+
include: "*.mdx",
7581
schema: docSchema,
76-
transform: (document, context) => docTransform("general", document, context),
82+
transform: (document, context) =>
83+
docTransform({ folder: "general", document, context }),
84+
onSuccess: (docs) => {
85+
console.log(
86+
`|- (content-collections) ✅ generalDocs Collection - Successfully processed ${docs.length} documents.`,
87+
);
88+
},
7789
});
7890

7991
const gstartedDocs = defineCollection({
@@ -82,26 +94,62 @@ const gstartedDocs = defineCollection({
8294
include: "**/*.mdx",
8395
schema: docSchema,
8496
transform: (document, context) =>
85-
docTransform("getting-started", document, context),
97+
docTransform({ folder: "getting-started", document, context }),
98+
onSuccess: (docs) => {
99+
console.log(
100+
`|- (content-collections) ✅ getting-started Collection - Successfully processed ${docs.length} documents.`,
101+
);
102+
},
86103
});
87104

88-
const componentsDocs = defineCollection({
89-
name: "components",
90-
directory: "src/docs/components",
105+
const reactDocs = defineCollection({
106+
name: "react",
107+
directory: "src/docs/react",
91108
include: "**/*.mdx",
92109
schema: docSchema,
93110
transform: (document, context) =>
94-
docTransform("components", document, context),
111+
docTransform({ folder: "react", document, context }),
112+
onSuccess: (docs) => {
113+
console.log(
114+
`|- (content-collections) ✅ react Collection - Successfully processed ${docs.length} documents.`,
115+
);
116+
},
95117
});
96118

97119
const shikiDocs = defineCollection({
98120
name: "shiki",
99121
directory: "src/docs/shiki",
100122
include: "**/*.mdx",
101123
schema: docSchema,
102-
transform: (document, context) => docTransform("shiki", document, context),
124+
transform: (document, context) =>
125+
docTransform({ folder: "shiki", document, context }),
126+
onSuccess: (docs) => {
127+
console.log(
128+
`|- (content-collections) ✅ shiki Collection - Successfully processed ${docs.length} documents.`,
129+
);
130+
},
131+
});
132+
133+
const sugarHighDocs = defineCollection({
134+
name: "shigh",
135+
directory: "src/docs/sugar-high",
136+
include: "**/*.mdx",
137+
schema: docSchema,
138+
transform: (document, context) =>
139+
docTransform({ folder: "sugar-high", document, context }),
140+
onSuccess: (docs) => {
141+
console.log(
142+
`|- (content-collections) ✅ sugar-high Collection - Successfully processed ${docs.length} documents.`,
143+
);
144+
},
103145
});
104146

105147
export default defineConfig({
106-
collections: [generalDocs, gstartedDocs, componentsDocs, shikiDocs],
148+
collections: [
149+
generalDocs,
150+
gstartedDocs,
151+
reactDocs,
152+
shikiDocs,
153+
sugarHighDocs,
154+
],
107155
});

apps/website/eslint.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig } from "eslint/config";
2+
3+
// Plugins:
4+
import { nextConfig } from "@pheralb/cb-eslint/nextjs";
5+
6+
const eslintConfig = defineConfig(nextConfig);
7+
8+
export default eslintConfig;

next.config.ts renamed to apps/website/next.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ import type { NextConfig } from "next";
22
import { withContentCollections } from "@content-collections/next";
33

44
const nextConfig: NextConfig = {
5+
async rewrites() {
6+
return [
7+
{
8+
source: "/docs/:folder/:slug*.mdx",
9+
destination: "/api/docs/:folder/:slug*",
10+
},
11+
];
12+
},
513
async redirects() {
614
return [
715
{

apps/website/package.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"name": "@pheralb/cb-website",
3+
"version": "1.0.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev",
7+
"build": "next build",
8+
"build:prod": "pnpm build:registry && pnpm build",
9+
"build:registry": "tsx ./src/components/registry/check-registry.ts && tsx ./src/components/registry/build-registry.ts",
10+
"build:cc": "content-collections build",
11+
"start": "next start",
12+
"check:lint": "eslint ./src",
13+
"fix:lint": "eslint ./src --fix",
14+
"check:registry": "tsx ./src/components/registry/check-registry.ts"
15+
},
16+
"dependencies": {
17+
"@react-symbols/icons": "1.3.0",
18+
"class-variance-authority": "0.7.1",
19+
"clsx": "2.1.1",
20+
"cmdk": "1.1.1",
21+
"lucide-react": "0.562.0",
22+
"motion": "12.23.26",
23+
"next": "16.1.1",
24+
"next-themes": "0.4.6",
25+
"radix-ui": "1.4.3",
26+
"react": "19.2.3",
27+
"react-dom": "19.2.3",
28+
"shadcn": "3.6.2",
29+
"tailwind-merge": "3.4.0",
30+
"zod": "4.2.1",
31+
"zustand": "5.0.9"
32+
},
33+
"devDependencies": {
34+
"@content-collections/cli": "0.1.8",
35+
"@content-collections/core": "0.13.0",
36+
"@content-collections/mdx": "0.2.2",
37+
"@content-collections/next": "0.2.10",
38+
"@pheralb/cb-eslint": "workspace:*",
39+
"@shikijs/langs": "3.20.0",
40+
"@shikijs/rehype": "3.20.0",
41+
"@shikijs/themes": "3.20.0",
42+
"@shikijs/transformers": "3.20.0",
43+
"@tailwindcss/postcss": "4.1.18",
44+
"@tailwindcss/typography": "0.5.19",
45+
"@types/mdx": "2.0.13",
46+
"@types/node": "20.19.27",
47+
"@types/react": "19.2.7",
48+
"@types/react-dom": "19.2.3",
49+
"chalk": "5.6.2",
50+
"eslint": "9.39.2",
51+
"github-slugger": "2.0.0",
52+
"react-docgen-typescript": "2.4.0",
53+
"rehype-autolink-headings": "7.1.0",
54+
"rehype-slug": "6.0.0",
55+
"remark-gfm": "4.0.1",
56+
"shiki": "3.20.0",
57+
"sugar-high": "0.9.5",
58+
"tailwindcss": "4.1.18",
59+
"tsx": "4.21.0",
60+
"tw-animate-css": "1.4.0",
61+
"typescript": "5.9.3",
62+
"unist-builder": "4.0.0",
63+
"unist-util-visit": "5.0.0"
64+
}
65+
}

0 commit comments

Comments
 (0)