Skip to content

Commit

Permalink
Merge pull request #94 from easyops-cn/steve/hide-depreacted-bricks
Browse files Browse the repository at this point in the history
Steve/hide-depreacted-bricks
  • Loading branch information
weareoutman committed Aug 9, 2024
2 parents 1ec6db0 + ee3b413 commit 757bb3b
Show file tree
Hide file tree
Showing 4 changed files with 1,439 additions and 1,404 deletions.
14 changes: 13 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for (const dir of readdirSync(bricksDir, { withFileTypes: true })) {
}

bootstrapJson.settings.misc.local_editors = bootstrapJson.brickPackages.flatMap(
(pkg) => (pkg.id ? pkg.editors ?? [] : pkg.propertyEditors ?? [])
(pkg) => (pkg.id ? (pkg.editors ?? []) : (pkg.propertyEditors ?? []))
);

const bootstrapJsonContent = JSON.stringify(bootstrapJson);
Expand Down Expand Up @@ -129,6 +129,18 @@ const config = {
routeBasePath: "/",
sidebarPath: require.resolve("./sidebars.js"),
// editUrl: "https://github.com/easyops-cn/next-docs/tree/master/",
// Ignore deprecated bricks
async sidebarItemsGenerator({
defaultSidebarItemsGenerator,
docs,
...args
}) {
const sidebarItems = await defaultSidebarItemsGenerator({
...args,
docs: docs.filter((doc) => !doc.frontMatter.deprecated),
});
return sidebarItems;
},
},
blog: false,
theme: {
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"prebuild": "node ./scripts/pre-build.mjs"
},
"dependencies": {
"@docusaurus/core": "3.0.1",
"@docusaurus/preset-classic": "3.0.1",
"@easyops-cn/docusaurus-search-local": "^0.37.4",
"@docusaurus/core": "3.4.0",
"@docusaurus/preset-classic": "3.4.0",
"@easyops-cn/docusaurus-search-local": "^0.44.4",
"@mdx-js/react": "^3.0.0",
"@next-core/brick-manifest": "^0.7.1",
"@next-core/doc-helpers": "^0.2.13",
Expand All @@ -30,8 +30,8 @@
"@next-core/preview": "^0.7.12",
"clsx": "^1.2.1",
"copy-to-clipboard": "^3.3.3",
"monaco-editor": "^0.40.0",
"monaco-editor-webpack-plugin": "^7.0.1",
"monaco-editor": "^0.50.0",
"monaco-editor-webpack-plugin": "^7.1.0",
"prism-react-renderer": "^2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -41,9 +41,9 @@
"unified": "^11.0.4"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.0.1",
"@docusaurus/tsconfig": "3.0.1",
"@docusaurus/types": "3.0.1",
"@docusaurus/module-type-aliases": "3.4.0",
"@docusaurus/tsconfig": "3.4.0",
"@docusaurus/types": "3.4.0",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"copy-webpack-plugin": "^11.0.0",
Expand All @@ -54,8 +54,8 @@
"husky": "^8.0.3",
"js-yaml": "^4.1.0",
"lint-staged": "^13.2.1",
"prettier": "^3.0.3",
"typescript": "~5.2.2"
"prettier": "^3.3.3",
"typescript": "~5.5.4"
},
"browserslist": {
"production": [
Expand Down
11 changes: 8 additions & 3 deletions scripts/pre-build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,17 @@ for (const { path: pkgPath, manifest, types } of packages) {
brickDoc = brick.description ?? "";
}
const typeRefs = brick.types?.map((item) => item.name);
const deprecated = brick.deprecated ?? false;

const content =
`---
description: ${JSON.stringify(`<${brick.name}>`)}
description: ${JSON.stringify(`<${brick.name}>`)}${
deprecated ? `\ndeprecated: true` : ""
}
---
${deprecated ? `\n<head>
<meta name="robots" content="noindex, nofollow" />
</head>\n` : ""}
import BrickTagName from "@site/src/components/BrickTagName";
import BrickDocProperties from "@site/src/components/BrickDocProperties";
import BrickDocSlots from "@site/src/components/BrickDocSlots";
Expand All @@ -77,7 +82,7 @@ import { TypeReferencesContext } from "@site/src/components/GeneralType";
name={${JSON.stringify(brick.name)}}
alias={${JSON.stringify(brick.alias ?? null)}}
insider={${JSON.stringify(brick.insider ?? false)}}
deprecated={${JSON.stringify(brick.deprecated ?? false)}}
deprecated={${JSON.stringify(deprecated)}}
/>
${brickDoc}
Expand Down
Loading

0 comments on commit 757bb3b

Please sign in to comment.