Skip to content

Commit e8f76eb

Browse files
si-netbahrimootaz
andauthored
Integrate 'Scalar' openapi plugin so that we can render Real Device Access API (#3312)
Co-authored-by: Bahri <[email protected]> Co-authored-by: bahrimootaz <[email protected]>
1 parent 7a9b2e5 commit e8f76eb

File tree

4 files changed

+183
-3
lines changed

4 files changed

+183
-3
lines changed

.github/workflows/deploy-pr-preview.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ jobs:
5353
CLOUDSDK_PYTHON: ${{ env.pythonLocation }}/python
5454

5555
- name: Set Preview Path
56-
run: echo "PREVIEW_PATH=pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_ENV"
56+
run: |
57+
PREVIEW_PATH="pr-preview/pr-${{ github.event.number }}"
58+
echo "PREVIEW_PATH=$PREVIEW_PATH" >> "$GITHUB_ENV"
59+
echo "BASE_URL=/$PREVIEW_PATH/" >> "$GITHUB_ENV"
5760
5861
- name: Install Dependencies
5962
if: github.event.action != 'closed' # Skip if the PR was closed

docusaurus.config.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ if (typeof unwrapJsx !== 'function') {
55
throw new Error('unwrapJsx plugin is not a function');
66
}
77
// Enabling PR previews
8-
let siteBaseUrl = '/';
9-
if (process.env.PREVIEW_PATH) siteBaseUrl += process.env.PREVIEW_PATH;
8+
// Docusaurus will read the BASE_URL env var set in the CI.
9+
// We fall back to '/' for local development.
10+
let siteBaseUrl = process.env.BASE_URL || '/';
1011

1112
const docusaurusConfig = {
1213
title: 'Sauce Labs Documentation',
@@ -174,6 +175,31 @@ const docusaurusConfig = {
174175
],
175176
],
176177
themes: ['docusaurus-theme-github-codeblock'],
178+
plugins: [
179+
[
180+
'@scalar/docusaurus',
181+
{
182+
id: 'real-device-access-api',
183+
label: 'Real Device Access API',
184+
route: '/real-device-access-api',
185+
showNavLink: true,
186+
configuration: {
187+
hideClientButton: true,
188+
hideTestRequestButton: true,
189+
hideSearch: true,
190+
defaultOpenAllTags: true,
191+
layout: 'classic',
192+
sources: [
193+
{
194+
// This title will appear in the top left dropdown within Scalar API doc.
195+
title: 'Real Device Access API',
196+
url: 'https://raw.githubusercontent.com/saucelabs/real-device-api/main/open_api_specification.yaml',
197+
},
198+
],
199+
},
200+
},
201+
],
202+
],
177203
};
178204

179205
if (!process.env.SAUCE_DOCS_DEV) {

package-lock.json

Lines changed: 150 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"dependencies": {
2525
"@docusaurus/core": "^3.7.0",
2626
"@docusaurus/preset-classic": "^3.7.0",
27+
"@scalar/docusaurus": "^0.7.21",
2728
"clsx": "^2.1.1",
2829
"docusaurus-theme-github-codeblock": "^2.0.2",
2930
"react": "^19.2.0",

0 commit comments

Comments
 (0)