Skip to content

Commit ddbd662

Browse files
committed
Update docusaurus config to es modules
1 parent e552632 commit ddbd662

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

Diff for: docusaurus.config.ts

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1-
const path = require("path");
2-
require("dotenv").config();
1+
import path from "path";
2+
import dotenv from "dotenv";
3+
4+
import remarkMath from "remark-math";
5+
import rehypeKatex from "rehype-katex";
6+
import fs from "fs";
7+
import { themes } from "prism-react-renderer";
8+
import type { Config } from "@docusaurus/types";
9+
import type * as Preset from "@docusaurus/preset-classic";
10+
import npm2yarn from "@docusaurus/remark-plugin-npm2yarn";
11+
const sidebarPath = require.resolve("./sidebars");
12+
const customCss = require.resolve("./src/css/custom.css");
13+
// Initialize dotenv
14+
dotenv.config();
15+
316
const githubOrg = "web3auth";
417
const githubRepo = "web3auth-docs";
518
const githubOrgUrl = `https://github.com/${githubOrg}`;
619
const githubRepoUrl = `${githubOrgUrl}/${githubRepo}`;
720
const githubEditUrl = `${githubRepoUrl}/edit/master`;
8-
const remarkMath = require("remark-math");
9-
const rehypeKatex = require("rehype-katex");
10-
const fs = require("fs");
1121
const baseUrl = process.env.REACT_APP_BASE_URL || "/docs/";
12-
const { themes } = require("prism-react-renderer");
1322

1423
const resourcesDropdown = fs.readFileSync("./src/components/navDropdown/resources.html", "utf-8");
1524
const helpDropdown = fs.readFileSync("./src/components/navDropdown/help.html", "utf-8");
1625
const sdkDropdown = fs.readFileSync("./src/components/navDropdown/sdk.html", "utf-8");
17-
import type { Config } from "@docusaurus/types";
18-
import type * as Preset from "@docusaurus/preset-classic";
1926

2027
const config: Config = {
2128
title: "Documentation | Web3Auth",
@@ -194,15 +201,12 @@ const config: Config = {
194201
routeBasePath: "/",
195202
breadcrumbs: true,
196203
editUrl: githubEditUrl,
197-
sidebarPath: require.resolve("./sidebars.js"),
198-
remarkPlugins: [
199-
remarkMath,
200-
[require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }],
201-
],
204+
sidebarPath,
205+
remarkPlugins: [remarkMath, [npm2yarn, { sync: true }]],
202206
rehypePlugins: [[rehypeKatex, { strict: false }]],
203207
},
204208
theme: {
205-
customCss: require.resolve("./src/css/custom.css"),
209+
customCss,
206210
},
207211
gtag: {
208212
trackingID: "GTM-NFBSNHL",
@@ -218,10 +222,7 @@ const config: Config = {
218222
"**/__tests__/**",
219223
],
220224
mdxPageComponent: "@theme/MDXPage",
221-
remarkPlugins: [
222-
remarkMath,
223-
[require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }],
224-
],
225+
remarkPlugins: [remarkMath, [npm2yarn, { sync: true }]],
225226
rehypePlugins: [[rehypeKatex, { strict: false }]],
226227
beforeDefaultRemarkPlugins: [],
227228
beforeDefaultRehypePlugins: [],

Diff for: package-lock.json

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+3
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,8 @@
100100
"**/*.{md,mdx}": [
101101
"prettier --write"
102102
]
103+
},
104+
"engines": {
105+
"node": ">=18.0"
103106
}
104107
}

0 commit comments

Comments
 (0)