From cceb62cd4733d2c01eae423d761db41f50655a40 Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Tue, 23 Apr 2024 13:46:36 +0200 Subject: [PATCH] CI: Fix intermittent docs build failures (#1307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building the documentation page often fails. This PR is an exploration to fix it. It: * Patches the typedoc library in `node_modules` as otherwise it won't work with TypeScript 5.4 🙈 * Removes non-essential TypeDoc plugins (link API reference to MDN, cross-link Typedoc modules) * Copies the `rollup.d.ts` files to `dist` instead of moving them. TypeDoc, apparently, expects to find them in their original location: ``` error TS6053: File '/home/runner/work/wordpress-playground/wordpress-playground/packages/php-wasm/web/src/rollup.d.ts' not found. The file is in the program because: Root file specified for compilation ``` ## Testing Instructions Restart the CI 5 times, confirm the build worked every single time. --- package-lock.json | 60 --------------------- package.json | 3 -- packages/docs/site/docusaurus.config.js | 7 --- packages/docs/site/project.json | 3 +- packages/php-wasm/node/project.json | 2 +- packages/php-wasm/web/project.json | 2 +- packages/playground/blueprints/project.json | 2 +- packages/playground/client/project.json | 2 +- 8 files changed, 6 insertions(+), 75 deletions(-) diff --git a/package-lock.json b/package-lock.json index 74c58ad6dc..1b66c674e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,6 @@ "@docusaurus/plugin-ideal-image": "^2.4.1", "@docusaurus/preset-classic": "2.4.1", "@docusaurus/theme-live-codeblock": "^2.4.1", - "@knodes/typedoc-plugin-pages": "0.23.1", "@mdx-js/react": "^1.6.22", "@nx/cypress": "16.9.0", "@nx/devkit": "16.9.0", @@ -123,8 +122,6 @@ "ts-node": "10.9.1", "tslib": "^2.3.0", "typedoc": "0.23.27", - "typedoc-plugin-mdn-links": "3.0.3", - "typedoc-plugin-resolve-crossmodule-references": "0.3.3", "typescript": "5.4.5", "vite": "4.5.0", "vite-plugin-dts": "3.6.3", @@ -5338,33 +5335,6 @@ "devOptional": true, "license": "MIT" }, - "node_modules/@knodes/typedoc-plugin-pages": { - "version": "0.23.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@knodes/typedoc-pluginutils": "~0.23.1", - "lodash": "^4.17.21" - }, - "peerDependencies": { - "lunr": "^2.3.0", - "typedoc": "^0.23.0" - } - }, - "node_modules/@knodes/typedoc-pluginutils": { - "version": "0.23.4", - "dev": true, - "license": "MIT", - "dependencies": { - "fastest-levenshtein": "^1.0.16", - "lodash": "^4.17.21", - "pkg-up": "^3.1.0", - "semver": "^7.3.5" - }, - "peerDependencies": { - "typedoc": "^0.23.0" - } - }, "node_modules/@leichtgewicht/ip-codec": { "version": "2.0.4", "dev": true, @@ -24718,14 +24688,6 @@ "dev": true, "license": "MIT" }, - "node_modules/fastest-levenshtein": { - "version": "1.0.16", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.9.1" - } - }, "node_modules/fastq": { "version": "1.15.0", "license": "ISC", @@ -42041,28 +42003,6 @@ "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x" } }, - "node_modules/typedoc-plugin-mdn-links": { - "version": "3.0.3", - "dev": true, - "license": "MIT", - "peerDependencies": { - "typedoc": ">= 0.23.14 || 0.24.x" - } - }, - "node_modules/typedoc-plugin-resolve-crossmodule-references": { - "version": "0.3.3", - "dev": true, - "license": "Apache-2.0", - "workspaces": [ - "test/packages/*" - ], - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "typedoc": ">=0.22 <=0.23" - } - }, "node_modules/typedoc/node_modules/brace-expansion": { "version": "2.0.1", "dev": true, diff --git a/package.json b/package.json index c9e8955985..7ef8d5cf78 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "@docusaurus/plugin-ideal-image": "^2.4.1", "@docusaurus/preset-classic": "2.4.1", "@docusaurus/theme-live-codeblock": "^2.4.1", - "@knodes/typedoc-plugin-pages": "0.23.1", "@mdx-js/react": "^1.6.22", "@nx/cypress": "16.9.0", "@nx/devkit": "16.9.0", @@ -161,8 +160,6 @@ "ts-node": "10.9.1", "tslib": "^2.3.0", "typedoc": "0.23.27", - "typedoc-plugin-mdn-links": "3.0.3", - "typedoc-plugin-resolve-crossmodule-references": "0.3.3", "typescript": "5.4.5", "vite": "4.5.0", "vite-plugin-dts": "3.6.3", diff --git a/packages/docs/site/docusaurus.config.js b/packages/docs/site/docusaurus.config.js index 06df1d78da..06e06069bf 100644 --- a/packages/docs/site/docusaurus.config.js +++ b/packages/docs/site/docusaurus.config.js @@ -203,13 +203,6 @@ function getDocusaurusPluginTypedocApiConfig() { options.entryPoints = packages.map((entry) => path.join(projectRoot, entry) ); - options.plugin = [ - 'typedoc-plugin-resolve-crossmodule-references', - // This plugin somehow doesn't work with docusaurus-plugin-typedoc-api. - // @TODO: Fix it - 'typedoc-plugin-mdn-links', - ]; - return old.call(this, options); }; diff --git a/packages/docs/site/project.json b/packages/docs/site/project.json index 6bd3f0b125..9f9ea3ccd8 100644 --- a/packages/docs/site/project.json +++ b/packages/docs/site/project.json @@ -13,7 +13,8 @@ "executor": "nx:run-commands", "options": { "commands": [ - "cd ../../../; npx typedoc --plugin typedoc-plugin-mdn-links --plugin typedoc-plugin-resolve-crossmodule-references --json packages/docs/site/src/model.json", + "sed -i 's/namedDeclarations\\[i\\]\\./namedDeclarations[i]?./g' ../../../node_modules/typedoc/dist/lib/converter/types.js ", + "cd ../../../; npx typedoc --json packages/docs/site/src/model.json", "docusaurus build --out-dir ../../../dist/docs/build" ], "parallel": false, diff --git a/packages/php-wasm/node/project.json b/packages/php-wasm/node/project.json index 5aa9daff70..58a38431fb 100644 --- a/packages/php-wasm/node/project.json +++ b/packages/php-wasm/node/project.json @@ -35,7 +35,7 @@ "npx dts-bundle-generator -o packages/php-wasm/node/src/rollup.d.ts -- packages/php-wasm/node/src/index.ts", "rimraf dist/packages/php-wasm/node/lib/*.d.ts", "rimraf dist/packages/php-wasm/node/*.d.ts", - "mv packages/php-wasm/node/src/rollup.d.ts dist/packages/php-wasm/node/index.d.ts" + "cp packages/php-wasm/node/src/rollup.d.ts dist/packages/php-wasm/node/index.d.ts" ], "parallel": false }, diff --git a/packages/php-wasm/web/project.json b/packages/php-wasm/web/project.json index e3687964c5..efe09768a0 100644 --- a/packages/php-wasm/web/project.json +++ b/packages/php-wasm/web/project.json @@ -41,7 +41,7 @@ "npx dts-bundle-generator -o packages/php-wasm/web/src/rollup.d.ts -- packages/php-wasm/web/src/index.ts", "rimraf dist/packages/php-wasm/web/lib/*.d.ts", "rimraf dist/packages/php-wasm/web/*.d.ts", - "mv packages/php-wasm/web/src/rollup.d.ts dist/packages/php-wasm/web/index.d.ts" + "cp packages/php-wasm/web/src/rollup.d.ts dist/packages/php-wasm/web/index.d.ts" ], "parallel": false }, diff --git a/packages/playground/blueprints/project.json b/packages/playground/blueprints/project.json index 98e621938a..7dcc481a0f 100644 --- a/packages/playground/blueprints/project.json +++ b/packages/playground/blueprints/project.json @@ -30,7 +30,7 @@ "npx dts-bundle-generator -o packages/playground/blueprints/src/rollup.d.ts -- packages/playground/blueprints/src/index.ts", "rimraf dist/packages/playground/blueprints/lib/*.d.ts", "rimraf dist/packages/playground/blueprints/*.d.ts", - "mv packages/playground/blueprints/src/rollup.d.ts dist/packages/playground/blueprints/index.d.ts" + "cp packages/playground/blueprints/src/rollup.d.ts dist/packages/playground/blueprints/index.d.ts" ], "parallel": false }, diff --git a/packages/playground/client/project.json b/packages/playground/client/project.json index 61d53d4e0c..c6fb1f7184 100644 --- a/packages/playground/client/project.json +++ b/packages/playground/client/project.json @@ -15,7 +15,7 @@ "npx dts-bundle-generator -o packages/playground/client/src/rollup.d.ts -- packages/playground/client/src/index.ts", "rimraf dist/packages/playground/client/lib/*.d.ts", "rimraf dist/packages/playground/client/*.d.ts", - "mv packages/playground/client/src/rollup.d.ts dist/packages/playground/client/index.d.ts" + "cp packages/playground/client/src/rollup.d.ts dist/packages/playground/client/index.d.ts" ], "parallel": false },