Skip to content

Commit

Permalink
chore(website): add Rsdoctor plugin (#10418)
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber authored Aug 20, 2024
1 parent aba22af commit 473d144
Show file tree
Hide file tree
Showing 5 changed files with 442 additions and 103 deletions.
3 changes: 3 additions & 0 deletions project-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ Retrocompatibility
retrocompatible
Retrocompatible
rmiz
rsdoctor
Rsdoctor
RSDOCTOR
rtcts
rtlcss
saurus
Expand Down
2 changes: 2 additions & 0 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import npm2yarn from '@docusaurus/remark-plugin-npm2yarn';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
import configTabs from './src/remark/configTabs';
import RsdoctorPlugin from './src/plugins/rsdoctor/RsdoctorPlugin';

import versions from './versions.json';
import VersionsArchived from './versionsArchived.json';
Expand Down Expand Up @@ -270,6 +271,7 @@ export default async function createConfigAsync() {
],
themes: ['live-codeblock', ...dogfoodingThemeInstances],
plugins: [
RsdoctorPlugin,
[
'./src/plugins/changelog/index.js',
{
Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"devDependencies": {
"@docusaurus/eslint-plugin": "3.5.2",
"@docusaurus/tsconfig": "3.5.2",
"@rsdoctor/webpack-plugin": "^0.3.11",
"@types/color": "^3.0.4",
"@types/jest": "^29.5.3",
"cross-env": "^7.0.3",
Expand Down
44 changes: 44 additions & 0 deletions website/src/plugins/rsdoctor/RsdoctorPlugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import type {PluginConfig} from '@docusaurus/types';

async function createRsdoctorBundlerPlugin() {
// TODO Shitty workaround to bypass lib typechecking
// package does not work will with skipLibCheck false
// eslint-disable-next-line
const {RsdoctorWebpackMultiplePlugin} = require('@rsdoctor/webpack-plugin');

return new RsdoctorWebpackMultiplePlugin({
disableTOSUpload: true,
supports: {
// https://rsdoctor.dev/config/options/options#generatetilegraph
generateTileGraph: true,
},
linter: {
rules: {
'ecma-version-check': 'off',
},
},
});
}

export default (async function RsdoctorPlugin() {
if (!process.env.RSDOCTOR) {
return null;
}
const plugin = await createRsdoctorBundlerPlugin();
console.log('Rsdoctor plugin enabled');
return {
name: 'rsdoctor-plugin',
configureWebpack: () => {
return {
plugins: [plugin],
};
},
};
} satisfies PluginConfig);
Loading

0 comments on commit 473d144

Please sign in to comment.