Skip to content

Commit

Permalink
Bump TypeScript to 5.4.5, Fix CI build errors (#1299)
Browse files Browse the repository at this point in the history
Related to #1287

TypeScript 5.4.5 (well, technically 5.2) gives us the
[Disposable](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html)
interface for cleaning up resources.

Also includes the changes from [CI: Fix intermittent docs build
failures](#1307):

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
```
  • Loading branch information
adamziel authored Apr 23, 2024
1 parent 3ffc8a1 commit b9352b2
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 82 deletions.
68 changes: 4 additions & 64 deletions package-lock.json

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

7 changes: 2 additions & 5 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,9 +160,7 @@
"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.1.6",
"typescript": "5.4.5",
"vite": "4.5.0",
"vite-plugin-dts": "3.6.3",
"vite-plugin-eslint": "^1.8.1",
Expand All @@ -180,7 +177,7 @@
"rollup": "^3.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "5.1.6",
"typescript": "5.4.5",
"typedoc": "0.23.27"
},
"workspaces": [
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
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"jsx": "react",
"target": "ES2021",
"module": "esnext",
"lib": ["ES2022", "dom"],
"lib": ["ES2022", "esnext.disposable", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
Expand Down

0 comments on commit b9352b2

Please sign in to comment.