diff --git a/.github/workflows/microsite-build-check.yml b/.github/workflows/microsite-build-check.yml index 45182229c9..881a7ca5e4 100644 --- a/.github/workflows/microsite-build-check.yml +++ b/.github/workflows/microsite-build-check.yml @@ -43,3 +43,7 @@ jobs: - name: build microsite run: yarn build working-directory: microsite + + - name: verify sidebars + run: yarn verify:sidebars + working-directory: microsite diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ddc5449cd8..b19329daaf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,7 +76,7 @@ A consistent coding style is included via [EditorConfig](https://editorconfig.or If you're contributing to the backend or CLI tooling, be mindful of cross-platform support. [This](https://shapeshed.com/writing-cross-platform-node/) blog post is a good guide of what to keep in mind when writing cross-platform NodeJS. -Also be sure to skim through our [ADRs](https://github.com/backstage/backstage/tree/master/docs/architecture-decisions) to see if they cover what you're working on. In particular [ADR006: Avoid React.FC and React.SFC](https://github.com/backstage/backstage/blob/master/docs/architecture-decisions/adr006-avoid-react-fc.md) is one to look out for. +Also be sure to skim through our [ADRs](docs/architecture-decisions) to see if they cover what you're working on. In particular [ADR006: Avoid React.FC and React.SFC](docs/architecture-decisions/adr006-avoid-react-fc.md) is one to look out for. If there are any updates in `markdown` file please make sure to run `yarn run lint:docs`. Though it is checked on `lint-staged`. It is required to install [vale](https://docs.errata.ai/vale/install) separately and make sure it is accessed by global command. diff --git a/microsite/package.json b/microsite/package.json index cb82e6ec85..ea16fd8a32 100644 --- a/microsite/package.json +++ b/microsite/package.json @@ -11,7 +11,8 @@ "publish-gh-pages": "docusaurus-publish", "write-translations": "docusaurus-write-translations", "version": "docusaurus-version", - "rename-version": "docusaurus-rename-version" + "rename-version": "docusaurus-rename-version", + "verify:sidebars": "node ./scripts/verify-sidebars" }, "devDependencies": { "@spotify/prettier-config": "^9.0.0", diff --git a/microsite/scripts/verify-sidebars.js b/microsite/scripts/verify-sidebars.js new file mode 100755 index 0000000000..a82780135f --- /dev/null +++ b/microsite/scripts/verify-sidebars.js @@ -0,0 +1,51 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This script relies on docusaurus internals. It can be replaced in case + * docusaurus adds proper validation of the sidebar items. + */ + +let metadata; +try { + metadata = require('docusaurus/lib/core/metadata.js'); +} catch (error) { + console.log('❌ Run `yarn build` before running `yarn verify:sidebars`'); + process.exit(1); +} + +const errors = []; +const ids = Object.keys(metadata); +for (let id of ids) { + const { next, previous } = metadata[id]; + + if (next && !ids.includes(next)) { + errors.push(`Next ${next} does not exist in ${id}.`); + } + + if (previous && !ids.includes(previous)) { + errors.push(`Previous ${previous} does not exist in ${id}.`); + } +} + +if (errors.length) { + for (const error of errors) { + console.log(`❌ ${error}`); + } + process.exit(1); +} + +console.log('✅ All sidebar links are correct.'); diff --git a/microsite/sidebars.json b/microsite/sidebars.json index 799433b8ef..8b5c0e5f0c 100644 --- a/microsite/sidebars.json +++ b/microsite/sidebars.json @@ -13,7 +13,7 @@ "Getting Started": [ "getting-started/index", "getting-started/running-backstage-locally", - "getting-started/contributing", + "getting-started/contributors", "getting-started/create-an-app", { "type": "subcategory", @@ -59,7 +59,6 @@ "features/software-catalog/well-known-relations", "features/software-catalog/extending-the-model", "features/software-catalog/external-integrations", - "features/software-catalog/kubernetes-in-backstage", "features/software-catalog/software-catalog-api" ] }, @@ -180,8 +179,7 @@ "api/utility-apis", "reference/utility-apis/README", "reference/createPlugin", - "reference/createPlugin-feature-flags", - "reference/createPlugin-router" + "reference/createPlugin-feature-flags" ] }, { @@ -209,7 +207,6 @@ "architecture-decisions/adrs-adr010", "architecture-decisions/adrs-adr011" ], - "Contribute": ["../CONTRIBUTING"], "Support": ["support/support", "support/project-structure"], "Glossary": ["glossary"], "FAQ": ["FAQ"] diff --git a/mkdocs.yml b/mkdocs.yml index 6b1971ce03..031fb56059 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -111,7 +111,6 @@ nav: - Utilities: 'api/utility-apis.md' - createPlugin: 'reference/createPlugin.md' - createPlugin-feature-flags: 'reference/createPlugin-feature-flags.md' - - createPlugin-router: 'reference/createPlugin-router.md' - Backend APIs: - Backend: 'api/backend.md' - Tutorials: @@ -129,7 +128,6 @@ nav: - ADR009 - Entity References: 'architecture-decisions/adr009-entity-references.md' - ADR010 - Luxon Date Library: 'architecture-decisions/adr010-luxon-date-library.md' - ADR011 - Plugin Package Structure: 'architecture-decisions/adr011-plugin-package-structure.md' - - Contribute: '../CONTRIBUTING.md' - Support: - 'support/support.md' - 'support/project-structure.md'