Skip to content

Commit

Permalink
feat: Add 'with/mdx-docs-nextra' to list of plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
codinsonn committed Apr 21, 2024
1 parent 07a7166 commit 3a61e77
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 15 deletions.
17 changes: 17 additions & 0 deletions apps/docs/docs.theme.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useRouter } from 'next/router'

/* --- Styles ---------------------------------------------------------------------------------- */

Expand All @@ -19,6 +20,7 @@ export default {
logo: <span><strong>FullProduct.dev</strong> ⚡️ Universal Base Starter</span>,
project: {
link: 'https://github.com/Aetherspace/universal-app-router',
title: 'Universal Base Starter - FullProduct.dev',
},
footer: {
text: <span>Need a <strong>Full-Product</strong> / Universal App Setup? 🚀 Check out <a href="https://codinsonn.dev" target="_blank" style={{ ...styles.tagLink, fontWeight: 'bold' }}>FullProduct.dev</a> by <a href="https://codinsonn.dev" target="_blank" style={styles.tagLink}>Thorr ⚡️ codinsonn</a></span>
Expand All @@ -29,4 +31,19 @@ export default {
defaultMenuCollapseLevel: 2,
toggleButton: true,
},
useNextSeoProps() {
const { asPath } = useRouter()
if (asPath === '/') {
return {
title: 'FullProduct.dev ⚡️ Universal Base Starter',
}
} else if (asPath.includes('plugins')) {
return {
titleTemplate: 'FullProduct.dev ⚡️ %s Plugin - Universal Base Starter Docs',
}
}
return {
titleTemplate: 'FullProduct.dev | %s - Universal Base Starter Docs',
}
}
}
29 changes: 14 additions & 15 deletions apps/docs/pages/plugins/[[...pluginBranchSlug]].mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ export async function getStaticProps({ params }) {
const branchName = branchNamePath?.replace(/\.mdx?/, '')?.replace?.('plugins/', '')
let pageMarkdown = '# 404 | Plugin Not Found\n\nThe page may not exist, or a remote MDX rate limit may have triggered'
try {
if (branchName) {
const githubApiBranchPRsUrl = `https://api.github.com/repos/Aetherspace/universal-app-router/pulls?head=Aetherspace:with/${branchName}`
const response = await fetch(githubApiBranchPRsUrl)
const branchPRs = await response.json()
const branchPR = branchPRs[0]
const branchPRMarkdown = branchPR.body
const branchPRTitle = branchPR.title
pageMarkdown = branchPRMarkdown.split('\n').reduce((acc, line) => {
let newLine = line
if (line.includes('<img ') && line.includes('">')) newLine = newLine.replace('">', '" />')
return acc + newLine + '\n'
}, `# \`${branchPRTitle}\`\n\n`)
}
if (branchName) {
const githubApiBranchPRsUrl = `https://api.github.com/repos/Aetherspace/universal-app-router/pulls?head=Aetherspace:with/${branchName}`
const response = await fetch(githubApiBranchPRsUrl)
const branchPRs = await response.json()
const branchPR = branchPRs[0]
const branchPRMarkdown = branchPR.body
const branchPRTitle = branchPR.title?.replace?.('plugin: ', '')
pageMarkdown = branchPRMarkdown.split('\n').reduce((acc, line) => {
let newLine = line
if (line.includes('<img ') && line.includes('">')) newLine = newLine.replace('">', '" />')
return acc + newLine + '\n'
}, `# ${branchPRTitle} \n\n \`\`\`zsch\ngit merge with/${branchName}\n\`\`\`\n\n`)
}
} catch (error) {
if (!error) console.error(error)
}
Expand All @@ -31,8 +31,7 @@ export async function getStaticProps({ params }) {
props: {
...dynamicMeta,
...dynamicMDX,
},
revalidate: false,
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions apps/docs/pages/plugins/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@
"react-query": {
"title": "@tanstack/react-query",
"route": "/plugins/react-query"
},
"mdx-docs-nextra": {
"title": "MDX Docs (Nextra)",
"route": "/plugins/mdx-docs-nextra"
}
}
5 changes: 5 additions & 0 deletions apps/docs/remote/pluginsConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
'mdx',
'graphql-server-apollo',
'react-query',
'mdx-docs-nextra'
],
nestedMetaData: {
"nativewind": {
Expand All @@ -27,6 +28,10 @@ module.exports = {
"react-query": {
"title": "@tanstack/react-query",
"route": "/plugins/react-query"
},
"mdx-docs-nextra": {
"title": "MDX Docs (Nextra)",
"route": "/plugins/mdx-docs-nextra"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"ios": "npm -w @app/expo run ios",
"expo:web": "npm -w @app/expo run web",
"build": "npm -w @app/next run build",
"build:docs": "npm -w @app/docs run build",
"add-dependencies": "npm -w @app/expo run add-dependencies",
"env:local": "npm -w @app/next run env:local & npm -w @app/expo run env:local",
"postinstall": "npx patch-package"
Expand Down

0 comments on commit 3a61e77

Please sign in to comment.