diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..c24c22a --- /dev/null +++ b/.prettierrc @@ -0,0 +1,12 @@ +{ + "trailingComma": "es5", + "tabWidth": 2, + "useTabs": true, + "singleQuote": false, + "semi": true, + "bracketSameLine": false, + "bracketSpacing": true, + "jsxSingleQuote": false, + "quoteProps": "as-needed", + "endOfLine": "lf" +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..bc1aa04 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "esbenp.prettier-vscode", + "davidanson.vscode-markdownlint", + "unifiedjs.vscode-mdx", + "dbaeumer.vscode-eslint" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c41c617 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "markdownlint.config": { + "no-inline-html": false, + "link-image-reference-definitions": false, + "fenced-code-language": false, + } +} diff --git a/docusaurus.config.js b/docusaurus.config.ts similarity index 96% rename from docusaurus.config.js rename to docusaurus.config.ts index f33d792..1fc23e1 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.ts @@ -1,7 +1,9 @@ const math = require('remark-math') const katex = require('rehype-katex') +import { Config } from "@docusaurus/types"; +import type * as Preset from "@docusaurus/preset-classic"; -const config = { +const config: Config = { title: 'Rapier', tagline: 'Fast 2D and 3D physics engine for the Rust programming language.', url: 'https://rapier.rs', @@ -142,7 +144,7 @@ const config = { ], // copyright: `Copyright © ${new Date().getFullYear()} Dimforge EURL. Website built with Docusaurus.`, }, - }, + } satisfies Preset.ThemeConfig, plugins: [ [ '@docusaurus/plugin-content-docs', @@ -174,7 +176,7 @@ const config = { theme: { customCss: require.resolve('./src/css/custom.css'), }, - }, + } satisfies Preset.Options, ], ], stylesheets: [ diff --git a/package.json b/package.json index 414626a..e9df4d1 100644 --- a/package.json +++ b/package.json @@ -37,5 +37,11 @@ "last 1 safari version" ] }, - "packageManager": "yarn@4.3.1" + "packageManager": "yarn@4.3.1", + "devDependencies": { + "@docusaurus/module-type-aliases": "^3.5.2", + "@docusaurus/tsconfig": "^3.5.2", + "@docusaurus/types": "^3.5.2", + "typescript": "^5.5.4" + } } diff --git a/sidebar_community.js b/sidebar_community.ts similarity index 100% rename from sidebar_community.js rename to sidebar_community.ts diff --git a/sidebar_docs.js b/sidebar_docs.ts similarity index 98% rename from sidebar_docs.js rename to sidebar_docs.ts index d64c18d..0716052 100644 --- a/sidebar_docs.js +++ b/sidebar_docs.ts @@ -1,6 +1,6 @@ -let template = { +const template = { '': [ 'user_guides/templates_injected/getting_started', 'user_guides/templates_injected/getting_started_bevy', @@ -23,7 +23,7 @@ let template = { ] }; -let specialized_guides = { +const specialized_guides = { 'Rust': [ 'user_guides/rust/getting_started', 'user_guides/rust/introduction_to_nalgebra', diff --git a/src/pages/benchmarks.js b/src/pages/benchmarks.tsx similarity index 57% rename from src/pages/benchmarks.js rename to src/pages/benchmarks.tsx index 788b750..77dd0df 100644 --- a/src/pages/benchmarks.js +++ b/src/pages/benchmarks.tsx @@ -4,18 +4,19 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; function iframeLoaded() { if (typeof document !== 'undefined') { - var iFrameID = document.getElementById('bench-iframe'); - if (iFrameID) { - let newHeight = (iFrameID.contentWindow.document.body.scrollHeight + 100) + "px"; - if (iFrameID.height != newHeight) - iFrameID.height = newHeight; - } + const iFrameID = document.getElementById('bench-iframe'); + if (!(iFrameID instanceof HTMLIFrameElement)) + throw new Error(`Expected iFrameID to be an HTMLIFrameElement, was ${iFrameID && iFrameID.constructor && iFrameID.constructor.name || iFrameID}`); + + const newHeight = (iFrameID.contentWindow.document.body.scrollHeight + 100) + "px"; + if (iFrameID.height != newHeight) + iFrameID.height = newHeight; } } function Benchmarks() { const context = useDocusaurusContext(); - const {siteConfig = {}} = context; + const {siteConfig} = context; const benchUrl = "/benchmarks3d/index.html"; setInterval(function(){ iframeLoaded(); }, 3000); diff --git a/src/pages/index.js b/src/pages/index.tsx similarity index 99% rename from src/pages/index.js rename to src/pages/index.tsx index dce2d97..935bb3f 100644 --- a/src/pages/index.js +++ b/src/pages/index.tsx @@ -108,7 +108,7 @@ function Feature({ imageUrl, title, description }) { function Home() { const context = useDocusaurusContext(); - const { siteConfig = {} } = context; + const { siteConfig } = context; return ( ": + version: 5.5.4 + resolution: "typescript@patch:typescript@npm%3A5.5.4#optional!builtin::version=5.5.4&hash=379a07" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 10c0/73409d7b9196a5a1217b3aaad929bf76294d3ce7d6e9766dd880ece296ee91cf7d7db6b16c6c6c630ee5096eccde726c0ef17c7dfa52b01a243e57ae1f09ef07 + languageName: node + linkType: hard + "undici-types@npm:~5.26.4": version: 5.26.5 resolution: "undici-types@npm:5.26.5"