Skip to content

Commit

Permalink
CI: Fix intermittent docs build failures (#1307)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
adamziel authored Apr 23, 2024
1 parent 5291620 commit cceb62c
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 75 deletions.
60 changes: 0 additions & 60 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 0 additions & 7 deletions packages/docs/site/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
3 changes: 2 additions & 1 deletion packages/docs/site/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/node/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/blueprints/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/client/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down

0 comments on commit cceb62c

Please sign in to comment.