This repository has been archived by the owner on Sep 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,192 additions
and
175 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@acme/content", | ||
"version": "0.1.0", | ||
"private": true, | ||
"devDependencies": { | ||
"@acme/eslint-config": "workspace:*", | ||
"@acme/prettier-config": "workspace:*", | ||
"eslint": "8.56.0", | ||
"prettier": "3.1.1" | ||
}, | ||
"eslintConfig": { | ||
"root": true, | ||
"extends": [ | ||
"@acme/eslint-config/base" | ||
] | ||
}, | ||
"prettier": "@acme/prettier-config" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import path from "path" | ||
import React from "react" | ||
import { notFound } from "next/navigation" | ||
|
||
import { getProjectRoot } from "@acme/helpers" | ||
import { | ||
components, | ||
getAllDocuments, | ||
getDocument, | ||
Markdoc, | ||
parseContent, | ||
} from "@acme/markdoc-base" | ||
|
||
interface DocPageProps { | ||
params: { | ||
slug: string[] | ||
} | ||
} | ||
|
||
async function getContentPath() { | ||
const projectDirectory = await getProjectRoot() | ||
if (!projectDirectory) throw "Unable to determine the project root directory." | ||
|
||
return path.join(projectDirectory, "apps/content") | ||
} | ||
export async function generateStaticParams(): Promise< | ||
DocPageProps["params"][] | ||
> { | ||
const contentPath = await getContentPath() | ||
const documents = await getAllDocuments(path.resolve(contentPath)) | ||
|
||
return documents.map((ele) => ({ slug: ele.slug })) | ||
} | ||
|
||
export default async function DocsPage({ params }: DocPageProps) { | ||
const contentPath = await getContentPath() | ||
|
||
const parsedParams = `/${params.slug.join("/")}` | ||
|
||
const document = await getDocument(contentPath, parsedParams) | ||
|
||
if (!document) notFound() | ||
|
||
const pageContent = await parseContent(document.docPath) | ||
|
||
if (!pageContent) notFound() | ||
|
||
return ( | ||
<main className=""> | ||
{Markdoc.renderers.react(pageContent.content, React, { components })} | ||
</main> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
import path from "path" | ||
import React from "react" | ||
import { notFound } from "next/navigation" | ||
|
||
import { components, Markdoc, parseContent } from "@acme/markdoc-base" | ||
|
||
export default async function HomePage() { | ||
const filePath = path.join(path.resolve(), "./src/content/test.md") | ||
|
||
const pageContent = await parseContent(filePath) | ||
|
||
if (!pageContent) notFound() | ||
|
||
return ( | ||
<main className=""> | ||
{Markdoc.renderers.react(pageContent.content, React, { components })} | ||
</main> | ||
) | ||
export default function HomePage() { | ||
return <main className="">Homepage</main> | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { cn } from "./src/cn" | ||
export * from "./src/cn" | ||
export * from "./src/root-dir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { packageDirectory } from "pkg-dir" | ||
|
||
export const getProjectRoot = async () => { | ||
return await packageDirectory() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.