mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-28 08:27:03 +02:00
misc: convert all internal scripts to ESM (#6286)
* misc: convert all internal scripts to ESM * fixes * fix * fixes * fix! * complete eslint * more move * fix! * This looks better? * Final ones
This commit is contained in:
parent
bcc05e243f
commit
4fad1ce0cd
66 changed files with 412 additions and 374 deletions
|
@ -12,11 +12,7 @@ const math = require('remark-math');
|
|||
const katex = require('rehype-katex');
|
||||
const VersionsArchived = require('./versionsArchived.json');
|
||||
const {dogfoodingPluginInstances} = require('./_dogfooding/dogfooding.config');
|
||||
const FeatureRequestsPlugin = require('./src/featureRequests/FeatureRequestsPlugin');
|
||||
const npm2yarn = require('@docusaurus/remark-plugin-npm2yarn');
|
||||
const configTabs = require('./src/remark/configTabs');
|
||||
const lightTheme = require('./src/utils/prismLight');
|
||||
const darkTheme = require('./src/utils/prismDark');
|
||||
|
||||
const ArchivedVersionsDropdownItems = Object.entries(VersionsArchived).splice(
|
||||
0,
|
||||
|
@ -120,7 +116,6 @@ const config = {
|
|||
],
|
||||
themes: ['live-codeblock'],
|
||||
plugins: [
|
||||
FeatureRequestsPlugin,
|
||||
[
|
||||
'content-docs',
|
||||
/** @type {import('@docusaurus/plugin-content-docs').Options} */
|
||||
|
@ -265,7 +260,7 @@ const config = {
|
|||
},
|
||||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
remarkPlugins: [math, [npm2yarn, {sync: true}], configTabs],
|
||||
remarkPlugins: [math, [npm2yarn, {sync: true}]],
|
||||
rehypePlugins: [katex],
|
||||
disableVersioning: isVersioningDisabled,
|
||||
lastVersion: isDev || isDeployPreview ? 'current' : undefined,
|
||||
|
@ -332,8 +327,6 @@ const config = {
|
|||
content: `⭐️ If you like Docusaurus, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/facebook/docusaurus">GitHub</a> and follow us on <a target="_blank" rel="noopener noreferrer" href="https://twitter.com/docusaurus" >Twitter</a> ${TwitterSvg}`,
|
||||
},
|
||||
prism: {
|
||||
theme: lightTheme,
|
||||
darkTheme,
|
||||
// We need to load markdown again so that YAML is loaded before MD
|
||||
// and the YAML front matter is highlighted correctly.
|
||||
// TODO after we have forked prism-react-renderer, we should tweak the
|
||||
|
@ -519,11 +512,18 @@ const config = {
|
|||
}),
|
||||
};
|
||||
|
||||
// TODO temporary dogfood async config, remove soon
|
||||
async function createConfig() {
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 0);
|
||||
});
|
||||
const FeatureRequestsPlugin = (await import('./src/featureRequests/FeatureRequestsPlugin.mjs')).default;
|
||||
const configTabs = (await import('./src/remark/configTabs.mjs')).default;
|
||||
const lightTheme = (await import('./src/utils/prismLight.mjs')).default;
|
||||
const darkTheme = (await import('./src/utils/prismDark.mjs')).default;
|
||||
config.plugins?.push(FeatureRequestsPlugin);
|
||||
// @ts-expect-error: we know it exists, right
|
||||
config.presets[0][1].docs.remarkPlugins.push(configTabs);
|
||||
// @ts-expect-error: we know it exists, right
|
||||
config.themeConfig.prism.theme = lightTheme;
|
||||
// @ts-expect-error: we know it exists, right
|
||||
config.themeConfig.prism.darkTheme = darkTheme;
|
||||
return config;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue