From 8426450aa260f0c0ee8014503792b312abc4becb Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 21 Feb 2023 17:58:26 +0100 Subject: [PATCH 1/4] chore: microsite build speed improvements Signed-off-by: blam --- microsite-next/docusaurus.config.js | 19 ++- microsite-next/package.json | 4 +- .../bannerSection/bannerSectionGrid.tsx | 3 - microsite-next/yarn.lock | 121 ++++++++++++++++++ 4 files changed, 141 insertions(+), 6 deletions(-) diff --git a/microsite-next/docusaurus.config.js b/microsite-next/docusaurus.config.js index a5dbd144da..4b44604ab5 100644 --- a/microsite-next/docusaurus.config.js +++ b/microsite-next/docusaurus.config.js @@ -47,8 +47,6 @@ module.exports = { /** @type {import('@docusaurus/preset-classic').Options} */ { docs: { - showLastUpdateAuthor: true, - showLastUpdateTime: true, editUrl: 'https://github.com/backstage/backstage/edit/master/docs/', path: '../docs', sidebarPath: 'sidebars.json', @@ -65,6 +63,23 @@ module.exports = { }, ], ], + webpack: { + jsLoader: isServer => ({ + loader: require.resolve('swc-loader'), + options: { + jsc: { + parser: { + syntax: 'typescript', + tsx: true, + }, + target: 'es2017', + }, + module: { + type: isServer ? 'commonjs' : 'es6', + }, + }, + }), + }, plugins: [ 'docusaurus-plugin-sass', () => ({ diff --git a/microsite-next/package.json b/microsite-next/package.json index f56ed6ae39..c223e87584 100644 --- a/microsite-next/package.json +++ b/microsite-next/package.json @@ -31,10 +31,12 @@ "dependencies": { "@docusaurus/core": "2.3.1", "@docusaurus/preset-classic": "2.3.1", + "@swc/core": "^1.3.36", "clsx": "^1.1.1", "docusaurus-plugin-sass": "^0.2.3", "react": "^17.0.2", "react-dom": "^17.0.2", - "sass": "^1.57.1" + "sass": "^1.57.1", + "swc-loader": "^0.2.3" } } diff --git a/microsite-next/src/components/bannerSection/bannerSectionGrid.tsx b/microsite-next/src/components/bannerSection/bannerSectionGrid.tsx index 639cc0a97c..dc9853d1fe 100644 --- a/microsite-next/src/components/bannerSection/bannerSectionGrid.tsx +++ b/microsite-next/src/components/bannerSection/bannerSectionGrid.tsx @@ -6,7 +6,6 @@ import bannerGridStyles from './bannerSectionGrid.module.scss'; export type IBannerSectionColumnsProps = PropsWithChildren<{ header?: ReactNode; className?: string; - // children: ReactNode | ReactNode[]; }>; export const BannerSectionGrid = ({ @@ -14,8 +13,6 @@ export const BannerSectionGrid = ({ children, className, }: IBannerSectionColumnsProps) => { - console.log('Header: ', header); - return (
{header &&
{header}
} diff --git a/microsite-next/yarn.lock b/microsite-next/yarn.lock index 81d5c07f6f..98d0e36c7a 100644 --- a/microsite-next/yarn.lock +++ b/microsite-next/yarn.lock @@ -2603,6 +2603,115 @@ __metadata: languageName: node linkType: hard +"@swc/core-darwin-arm64@npm:1.3.36": + version: 1.3.36 + resolution: "@swc/core-darwin-arm64@npm:1.3.36" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@swc/core-darwin-x64@npm:1.3.36": + version: 1.3.36 + resolution: "@swc/core-darwin-x64@npm:1.3.36" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@swc/core-linux-arm-gnueabihf@npm:1.3.36": + version: 1.3.36 + resolution: "@swc/core-linux-arm-gnueabihf@npm:1.3.36" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@swc/core-linux-arm64-gnu@npm:1.3.36": + version: 1.3.36 + resolution: "@swc/core-linux-arm64-gnu@npm:1.3.36" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@swc/core-linux-arm64-musl@npm:1.3.36": + version: 1.3.36 + resolution: "@swc/core-linux-arm64-musl@npm:1.3.36" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@swc/core-linux-x64-gnu@npm:1.3.36": + version: 1.3.36 + resolution: "@swc/core-linux-x64-gnu@npm:1.3.36" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@swc/core-linux-x64-musl@npm:1.3.36": + version: 1.3.36 + resolution: "@swc/core-linux-x64-musl@npm:1.3.36" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@swc/core-win32-arm64-msvc@npm:1.3.36": + version: 1.3.36 + resolution: "@swc/core-win32-arm64-msvc@npm:1.3.36" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@swc/core-win32-ia32-msvc@npm:1.3.36": + version: 1.3.36 + resolution: "@swc/core-win32-ia32-msvc@npm:1.3.36" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@swc/core-win32-x64-msvc@npm:1.3.36": + version: 1.3.36 + resolution: "@swc/core-win32-x64-msvc@npm:1.3.36" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@swc/core@npm:^1.3.36": + version: 1.3.36 + resolution: "@swc/core@npm:1.3.36" + dependencies: + "@swc/core-darwin-arm64": 1.3.36 + "@swc/core-darwin-x64": 1.3.36 + "@swc/core-linux-arm-gnueabihf": 1.3.36 + "@swc/core-linux-arm64-gnu": 1.3.36 + "@swc/core-linux-arm64-musl": 1.3.36 + "@swc/core-linux-x64-gnu": 1.3.36 + "@swc/core-linux-x64-musl": 1.3.36 + "@swc/core-win32-arm64-msvc": 1.3.36 + "@swc/core-win32-ia32-msvc": 1.3.36 + "@swc/core-win32-x64-msvc": 1.3.36 + dependenciesMeta: + "@swc/core-darwin-arm64": + optional: true + "@swc/core-darwin-x64": + optional: true + "@swc/core-linux-arm-gnueabihf": + optional: true + "@swc/core-linux-arm64-gnu": + optional: true + "@swc/core-linux-arm64-musl": + optional: true + "@swc/core-linux-x64-gnu": + optional: true + "@swc/core-linux-x64-musl": + optional: true + "@swc/core-win32-arm64-msvc": + optional: true + "@swc/core-win32-ia32-msvc": + optional: true + "@swc/core-win32-x64-msvc": + optional: true + checksum: 36e96e86d1ab8fd84eb51e7264a7ae781ee7e507d36b9ccc028d7f31a2ccf2949f074656e34139c970196774d24d55a54c3aa5c53d04eb6e3569c71cbfed0c0d + languageName: node + linkType: hard + "@szmarczak/http-timer@npm:^1.1.2": version: 1.1.2 resolution: "@szmarczak/http-timer@npm:1.1.2" @@ -3601,6 +3710,7 @@ __metadata: "@docusaurus/module-type-aliases": 2.3.1 "@docusaurus/preset-classic": 2.3.1 "@spotify/prettier-config": ^14.0.0 + "@swc/core": ^1.3.36 "@tsconfig/docusaurus": ^1.0.6 "@types/webpack-env": ^1.18.0 clsx: ^1.1.1 @@ -3611,6 +3721,7 @@ __metadata: react-dom: ^17.0.2 replace: ^1.2.2 sass: ^1.57.1 + swc-loader: ^0.2.3 typescript: ^4.9.4 yaml-loader: ^0.8.0 languageName: unknown @@ -9998,6 +10109,16 @@ __metadata: languageName: node linkType: hard +"swc-loader@npm:^0.2.3": + version: 0.2.3 + resolution: "swc-loader@npm:0.2.3" + peerDependencies: + "@swc/core": ^1.2.147 + webpack: ">=2" + checksum: 010d84d399525c0185d36d62c86c55ae017e7a90046bc8a39be4b7e07526924037868049f6037bc966da98151cb2600934b96a66279b742d3c413a718b427251 + languageName: node + linkType: hard + "tapable@npm:^1.0.0": version: 1.1.3 resolution: "tapable@npm:1.1.3" From c3bf22a2455ae35b29d225f11bfe9d8be6d15d3f Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 21 Feb 2023 18:00:09 +0100 Subject: [PATCH 2/4] chore: add the concurrency Signed-off-by: blam --- .github/workflows/deploy_microsite.yml | 1 + .github/workflows/verify_microsite-next.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/deploy_microsite.yml b/.github/workflows/deploy_microsite.yml index 61a0cd5b0f..1b0f7753bd 100644 --- a/.github/workflows/deploy_microsite.yml +++ b/.github/workflows/deploy_microsite.yml @@ -15,6 +15,7 @@ jobs: env: CI: true NODE_OPTIONS: --max-old-space-size=4096 + DOCUSAURUS_SSR_CONCURRENCY: 5 steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/verify_microsite-next.yml b/.github/workflows/verify_microsite-next.yml index ea0cbae0be..fc42ec4225 100644 --- a/.github/workflows/verify_microsite-next.yml +++ b/.github/workflows/verify_microsite-next.yml @@ -17,6 +17,7 @@ jobs: env: CI: true NODE_OPTIONS: --max-old-space-size=4096 + DOCUSAURUS_SSR_CONCURRENCY: 5 steps: - uses: actions/checkout@v3 From 19985912e78f62729d6cbdbd10b8cf667b9cd7b3 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 21 Feb 2023 20:00:02 +0100 Subject: [PATCH 3/4] chore: make sure to build the api-docs Signed-off-by: blam --- .github/workflows/verify_microsite-next.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/verify_microsite-next.yml b/.github/workflows/verify_microsite-next.yml index fc42ec4225..6c9edf2031 100644 --- a/.github/workflows/verify_microsite-next.yml +++ b/.github/workflows/verify_microsite-next.yml @@ -29,10 +29,16 @@ jobs: # Skip caching of microsite dependencies, it keeps the global cache size # smaller, which make Windows builds a lot faster for the rest of the project. + - name: top-level install + run: yarn install --immutable + - name: yarn install run: yarn install --immutable working-directory: microsite-next + - name: build API reference + run: yarn build:api-docs + - name: verify yarn dependency duplicates run: node scripts/verify-lockfile-duplicates.js From cfa7f8c5175c7c00c711936f96a39f16eb3deffe Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 21 Feb 2023 23:11:33 +0100 Subject: [PATCH 4/4] chore: add comment and fix Signed-off-by: blam --- packages/test-utils/src/testUtils/TestApiProvider.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/test-utils/src/testUtils/TestApiProvider.tsx b/packages/test-utils/src/testUtils/TestApiProvider.tsx index f38433ace9..c212b94bea 100644 --- a/packages/test-utils/src/testUtils/TestApiProvider.tsx +++ b/packages/test-utils/src/testUtils/TestApiProvider.tsx @@ -91,6 +91,10 @@ export class TestApiRegistry implements ApiHolder { * It lets you provide any number of API implementations, without necessarily * having to fully implement each of the APIs. * + * @remarks + * todo: remove this remark tag and ship in the api-reference. There's some odd formatting going on when this is made into a markdown doc, that there's no line break between + * the emmited

for To the following

so what happens is that when parsing in docusaurus, it thinks that the code block is mdx rather than a code + * snippet. Just ommiting this from the report for now until we can work out how to fix laterr. * A migration from `ApiRegistry` and `ApiProvider` might look like this, from: * * ```tsx @@ -100,7 +104,7 @@ export class TestApiRegistry implements ApiHolder { * [identityApiRef, mockIdentityApi as unknown as IdentityApi] * ])} * > - * // ... + * ... * * ) * ``` @@ -110,7 +114,7 @@ export class TestApiRegistry implements ApiHolder { * ```tsx * renderInTestApp( * - * // ... + * ... * * ) * ```