From 2485171a5a457315b7fd13aaa8f6cc714b445375 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 26 Feb 2025 15:47:40 +0800 Subject: [PATCH] Build playground with Vite (#17184) --- .gitignore | 2 +- .vscode/settings.example.json | 2 + website/docusaurus.config.js | 5 +- website/{static/playground => }/index.html | 6 +- website/package.json | 13 +- website/playground/EditorState.js | 3 +- .../{Playground.js => Playground.jsx} | 15 +- website/playground/PrettierFormat.js | 2 +- .../{VersionLink.js => VersionLink.jsx} | 3 +- .../playground/{buttons.js => buttons.jsx} | 3 +- website/playground/{index.js => index.jsx} | 18 +- .../install-service-worker.js | 2 - website/playground/markdown.js | 2 +- website/playground/{panels.js => panels.jsx} | 3 +- .../playground.css | 0 .../{SidebarOptions.js => SidebarOptions.jsx} | 4 +- .../sidebar/{components.js => components.jsx} | 2 +- .../sidebar/{inputs.js => inputs.jsx} | 0 .../sidebar/{options.js => options.jsx} | 2 +- website/playground/urlHash.js | 2 +- website/src/pages/index.jsx | 7 +- website/static/service-worker.js | 1 - website/vite.config.mjs | 14 + website/webpack.config.js | 30 - website/yarn.lock | 1878 ++++++++++------- 25 files changed, 1192 insertions(+), 827 deletions(-) rename website/{static/playground => }/index.html (98%) rename website/playground/{Playground.js => Playground.jsx} (98%) rename website/playground/{VersionLink.js => VersionLink.jsx} (91%) rename website/playground/{buttons.js => buttons.jsx} (94%) rename website/playground/{index.js => index.jsx} (78%) rename website/{static => playground}/install-service-worker.js (89%) rename website/playground/{panels.js => panels.jsx} (98%) rename website/{static/separate-css => playground}/playground.css (100%) rename website/playground/sidebar/{SidebarOptions.js => SidebarOptions.jsx} (91%) rename website/playground/sidebar/{components.js => components.jsx} (86%) rename website/playground/sidebar/{inputs.js => inputs.jsx} (100%) rename website/playground/sidebar/{options.js => options.jsx} (95%) create mode 100644 website/vite.config.mjs delete mode 100644 website/webpack.config.js diff --git a/.gitignore b/.gitignore index e18665e2f..a5057b6b8 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,7 @@ /dist* /website/build /website/i18n -/website/static/playground.js +/website/static/playground /website/static/lib /website/.docusaurus .DS_Store diff --git a/.vscode/settings.example.json b/.vscode/settings.example.json index 3c77df0ba..ce9a389c3 100644 --- a/.vscode/settings.example.json +++ b/.vscode/settings.example.json @@ -12,5 +12,7 @@ "dist*": true, "website/.docusaurus": true, "website/build": true, + "website/static/playground": true, + "website/static/lib": true, }, } diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index b4465ec6d..799043d2b 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -137,7 +137,10 @@ const config = { type: "docsVersionDropdown", }, { - to: "pathname:///playground/", + href: + process.env.NODE_ENV === "production" + ? "pathname:///playground/" + : "http://localhost:5173/", label: "Playground", position: "right", target: "_self", diff --git a/website/static/playground/index.html b/website/index.html similarity index 98% rename from website/static/playground/index.html rename to website/index.html index 5e4965518..9d038506d 100644 --- a/website/static/playground/index.html +++ b/website/index.html @@ -168,7 +168,7 @@ crossorigin="anonymous" referrerpolicy="no-referrer" > - + - - +