Skip to content

Commit

Permalink
Merge pull request backstage#9041 from backstage/rugvip/fixdocs
Browse files Browse the repository at this point in the history
fix API reference + add regression test
  • Loading branch information
benjdlambert authored Jan 20, 2022
2 parents 2da2eda + 5cc0b0e commit 1592cfd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ jobs:
- name: check api reports and generate API reference
run: yarn build:api-reports:only --ci --docs

- name: verify api reference
run: node scripts/verify-api-reference.js

- name: verify changesets
run: node scripts/verify-changesets.js

Expand Down
44 changes: 44 additions & 0 deletions scripts/verify-api-reference.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env node
/*
* Copyright 2020 The Backstage Authors
*
* 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.
*/

/* eslint-disable import/no-extraneous-dependencies */

const { resolve: resolvePath } = require('path');
const { promises: fs } = require('fs');

async function main() {
const indexContent = await fs.readFile(
resolvePath(__dirname, '../docs/reference/index.md'),
'utf8',
);

// This makes sure we see the package description of the @backstage/types package
// on the API reference index page.
// Duplicate installations of @microsoft/api-extractor-model can cause this to
// happen, but it also serves as a general check that the API reference is OK.
if (!indexContent.includes('types used within Backstage')) {
throw new Error(
'Could not find package documentation for @backstage/types in the API reference index. ' +
'Make sure there are no duplicate @microsoft or @rushstack dependencies.',
);
}
}

main().catch(error => {
console.error(error.stack);
process.exit(1);
});
26 changes: 1 addition & 25 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4928,7 +4928,7 @@
js-yaml "~3.13.1"
resolve "~1.17.0"

"@microsoft/api-extractor-model@7.15.1":
"@microsoft/api-extractor-model@7.15.1", "@microsoft/api-extractor-model@^7.15.1":
version "7.15.1"
resolved "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.15.1.tgz#e52d68676e846d8b86e3b18e2654af39fba6e4a1"
integrity sha512-DWfS1o3oMY0mzdO3OuQbD/9vzn80jwM6tFd7XbiYnkpxwhD83LMGXz7NZWwSh+IaA+9w3LF4w62fT31Qq+dAMw==
Expand All @@ -4937,15 +4937,6 @@
"@microsoft/tsdoc-config" "~0.15.2"
"@rushstack/node-core-library" "3.44.2"

"@microsoft/api-extractor-model@^7.15.1":
version "7.15.3"
resolved "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.15.3.tgz#cf76deeeb2733d974da678f530c2dbaceb18a065"
integrity sha512-NkSjolmSI7NGvbdz0Y7kjQfdpD+j9E5CwXTxEyjDqxd10MI7GXV8DnAsQ57GFJcgHKgTjf2aUnYfMJ9w3aMicw==
dependencies:
"@microsoft/tsdoc" "0.13.2"
"@microsoft/tsdoc-config" "~0.15.2"
"@rushstack/node-core-library" "3.45.0"

"@microsoft/api-extractor@^7.19.2":
version "7.19.2"
resolved "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.19.2.tgz#8c546003523163c1432f6e19506065f790d6182c"
Expand Down Expand Up @@ -5758,21 +5749,6 @@
timsort "~0.3.0"
z-schema "~5.0.2"

"@rushstack/node-core-library@3.45.0":
version "3.45.0"
resolved "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.45.0.tgz#8c86b39271b6d84260b1e70db87e1e265b54f620"
integrity sha512-YMuIJl19vQT1+g/OU9mLY6T5ZBT9uDlmeXExDQACpGuxTJW+LHNbk/lRX+eCApQI2eLBlaL4U68r3kZlqwbdmw==
dependencies:
"@types/node" "12.20.24"
colors "~1.2.1"
fs-extra "~7.0.1"
import-lazy "~4.0.0"
jju "~1.4.0"
resolve "~1.17.0"
semver "~7.3.0"
timsort "~0.3.0"
z-schema "~5.0.2"

"@rushstack/rig-package@0.3.6":
version "0.3.6"
resolved "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.6.tgz#a57b53db59106fb93bcda36cad4f8602f508ebc6"
Expand Down

0 comments on commit 1592cfd

Please sign in to comment.