chore(website): add Rsdoctor plugin (#10418)

This commit is contained in:
Sébastien Lorber 2024-08-20 11:42:13 +02:00 committed by GitHub
parent aba22afa18
commit 473d1442b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 442 additions and 103 deletions

View file

@ -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);