Skip to content

Commit

Permalink
chore: Refactor docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Mar 29, 2024
1 parent 746e552 commit cbcdaed
Show file tree
Hide file tree
Showing 128 changed files with 7,194 additions and 2,434 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -8,7 +8,6 @@ dist
samples
out
typedoc-examples
plugin-docs
html
/devdocs
/devdocs-html
Expand Down
28 changes: 14 additions & 14 deletions devtools/packages/helpers/constants.ts
Expand Up @@ -5,50 +5,50 @@ export const PRESETS_PATH = `${process.cwd()}/src/options/presets.ts`;
export const DOCS_CONFIG: Record<string, DocsConfig> = {
['typedoc-plugin-markdown']: {
declarationsPath: `${process.cwd()}/src/app/options/declarations.ts`,
optionsPath: '',
docsPath: '',
optionsPath: '/docs',
docsPath: '/docs',
declarations: true,
presets: false,
},
['typedoc-plugin-frontmatter']: {
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
optionsPath: 'utilities/frontmatter',
docsPath: '/utilities/frontmatter/introduction',
optionsPath: 'plugins/frontmatter',
docsPath: '/plugins/frontmatter/introduction',
declarations: true,
presets: false,
},
['typedoc-plugin-remark']: {
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
optionsPath: 'utilities/remark',
docsPath: '/utilities/remark/introduction',
optionsPath: 'plugins/remark',
docsPath: '/plugins/remark/introduction',
declarations: true,
presets: false,
},
['typedoc-github-wiki-theme']: {
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
optionsPath: 'themes/github-wiki',
docsPath: '/themes/github-wiki',
optionsPath: 'plugins/github-wiki',
docsPath: '/plugins/github-wiki/introduction',
declarations: true,
presets: true,
},
['typedoc-gitlab-wiki-theme']: {
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
optionsPath: 'themes/gitlab-wiki',
docsPath: '/themes/gitlab-wiki/introduction',
optionsPath: 'plugins/gitlab-wiki',
docsPath: '/plugins/gitlab-wiki/introduction',
declarations: true,
presets: true,
},
['typedoc-vitepress-theme']: {
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
optionsPath: 'themes/vitepress',
docsPath: '/themes/vitepress/introduction',
optionsPath: 'plugins/vitepress',
docsPath: '/plugins/vitepress/introduction',
declarations: true,
presets: false,
},
['docusaurus-plugin-typedoc']: {
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
optionsPath: '/integrations/docusaurus/options',
docsPath: '/integrations/docusaurus/introduction',
optionsPath: '/plugins/docusaurus/options',
docsPath: '/plugins/docusaurus/introduction',
declarations: false,
presets: false,
},
Expand Down
15 changes: 7 additions & 8 deletions devtools/packages/prebuild-options/tasks/generate-docs.ts
Expand Up @@ -86,8 +86,7 @@ export async function generateDocs(docsConfig: DocsConfig) {
}
options.forEach((option) => {
out.push(
`${optionLevel} ${
Boolean(option.deprecated) ? `~${option.name}~` : `${option.name}`
`${optionLevel} ${Boolean(option.deprecated) ? `~${option.name}~` : `${option.name}`
}`,
);
if (Boolean(option.deprecated)) {
Expand Down Expand Up @@ -131,12 +130,12 @@ export async function generateDocs(docsConfig: DocsConfig) {
out.push(`
\`\`\`json filename="typedoc.json"
${JSON.stringify(
JSON.parse(`{
JSON.parse(`{
"${option.name}": ${getExampleValue(option)}
}`),
null,
2,
)}
null,
2,
)}
\`\`\``);
}
Expand All @@ -146,7 +145,7 @@ ${JSON.stringify(
}

const optionDocPath = path.join(
getDocsPath(docsConfig.optionsPath),
getPagesPath(docsConfig.optionsPath),
'options.mdx',
);

Expand Down Expand Up @@ -212,7 +211,7 @@ function getExampleValue(option) {
return getDefaultValue(option);
}

function getDocsPath(docsPath: string) {
function getPagesPath(docsPath: string) {
const pagesPath = path.join(
__dirname,
'..',
Expand Down
6 changes: 6 additions & 0 deletions devtools/packages/prebuild-options/tasks/generate-models.ts
Expand Up @@ -37,6 +37,9 @@ export async function generateModels(declarationsPath: string) {
}
}
/**
* @category Types
*/
export interface PluginOptions {
${(Object.entries(optionsConfig) as any)
.map(([name, option]) => `${name}: ${getType(name, option)};`)
Expand All @@ -46,6 +49,9 @@ export async function generateModels(declarationsPath: string) {
${mixedTypes
?.map(([name, option]) => {
return `
/**
* @category Types
*/
export interface ${capitalize(name)} {
${Object.entries(option.defaultValue as any)
.map(
Expand Down
12 changes: 9 additions & 3 deletions docs/components/package-description.jsx
@@ -1,10 +1,16 @@
import Link from 'next/link';

export const PackageDescription = ({ description }) => {
const parts = description.substring(0, description.length - 1).split(' ');
export const PackageDescription = ({ pjson }) => {
const parts = pjson.description
.substring(0, pjson.description.length - 1)
.split(' ');

return (
<p className="nx-mt-6 nx-leading-7">
<p className="text-lg">
<span className="inline-flex items-center rounded-md bg-gray-50 px-2 py-1 mb-5 mt-3 text-sm font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10">
{pjson.version}
</span>
<br />
{parts.map((part) => {
const isLink = [
'TypeDoc',
Expand Down
4 changes: 4 additions & 0 deletions docs/styles.css → docs/global.css
@@ -1,3 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

.nextra-toc a[href^='#parameters'],
.nextra-toc a[href^='#returns'],
.nextra-toc a[href^='#source'],
Expand Down
5 changes: 5 additions & 0 deletions docs/next-env.d.ts
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
9 changes: 4 additions & 5 deletions docs/next.config.js
@@ -1,9 +1,8 @@
const withNextra = require('nextra')({
import nextra from "nextra";

const withNextra = nextra({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.jsx',
});

module.exports = withNextra();

// If you have other Next.js configurations, you can pass them as the parameter:
// module.exports = withNextra({ /* other next.js config */ })
export default withNextra();

0 comments on commit cbcdaed

Please sign in to comment.