fix(template):fix deps, fix styles #4378
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π€[deprecated] Generated by Copilot at 707097e
Summary
π οΈπ¨π
This pull request updates the frontend template provider and the Kubepanel plugin to use the
@sealos/ui
library for UI consistency and functionality. It also improves the YAML editor experience by replacing the@uiw/react-codemirror
package with the@replit/codemirror-vscode-keymap
andcodemirror
packages. It fixes a bug related to an optional dependency and adds a package to update the browserslist database. It also removes some unused code and files and applies some code formatting.Walkthrough
next
andnext-pwa
dependencies to use@babel/core@7.23.5
instead of@babel/core@7.23.3
to fix a bug related to the@next/swc-darwin-arm64
optional dependency (link,link,link,link,link,link,link,link,link,link,link,link)@codemirror/commands
,@codemirror/state
,@codemirror/view
,@replit/codemirror-vscode-keymap
,@sealos/ui
, andcodemirror
dependencies to thefrontend/plugins/kubepanel
andfrontend/providers/template
workspaces to provide a better editor experience for YAML files in the Kubepanel plugin (link,link,link,link)@uiw/react-codemirror
dependency from thefrontend/plugins/kubepanel
andfrontend/providers/template
workspaces because it was replaced by the@replit/codemirror-vscode-keymap
andcodemirror
dependencies (link,link,link,link,link)@babel/code-frame
dependency to7.23.5
in various packages to fix a bug related to the@next/swc-darwin-arm64
optional dependency (link,link,link,link,link,link,link)browserslist@4.22.2
andcaniuse-lite@1.0.30001566
dependencies to support theupdate-browserslist-db
package, which updates the browserslist database automatically (link,link,link)electron-to-chromium@1.4.603
dependency to support thebrowserslist
package, which provides information about browser support for various features (link)@babel/core@7.23.5
,@babel/generator@7.23.5
,@babel/helper-module-transforms@7.23.3(@babel/core@7.23.5)
,@babel/helpers@7.23.5
,@babel/parser@7.23.5
,@babel/traverse@7.23.5
, and@babel/types@7.23.5
dependencies to fix a bug related to the@next/swc-darwin-arm64
optional dependency (link,link,link,link,link,link,link)@types/eslint
dependency to8.44.8
instead of8.44.7
to fix a type mismatch issue with theeslint
dependency (link)babel-loader
dependency to use@babel/core@7.23.5
instead of@babel/core@7.23.3
to fix a bug related to the@next/swc-darwin-arm64
optional dependency (link,link)@replit/codemirror-vscode-keymap@6.0.2(@codemirror/autocomplete@6.11.1)(@codemirror/commands@6.3.2)(@codemirror/language@6.9.3)(@codemirror/lint@6.4.2)(@codemirror/search@6.5.5)(@codemirror/state@6.3.2)(@codemirror/view@6.22.1)
dependency to provide a VS Code-like keymap for the CodeMirror editor (link)@codemirror/theme-one-dark@6.1.2
dependency because it was not used by the Kubepanel plugin (link)nextConfig
value infrontend/providers/template/next.config.js
to include thetranspilePackages
option, which specifies the packages that need to be transpiled by Next.js. This is needed for the@sealos/ui
package, which is a UI library for the Kubepanel plugin (link)theme
value infrontend/providers/template/src/constants/theme.ts
to extend thetheme
value from the@sealos/ui
package, which provides a UI library for the Kubepanel plugin (link,link)Yaml
component infrontend/providers/template/src/pages/deploy/components/Yaml.tsx
to use theYamlCode
component from the@sealos/ui
package, which provides a UI library for the Kubepanel plugin. TheYamlCode
component takes amarkdown
prop instead of acontent
prop, so the code was adjusted accordingly (link,link,link)Editor
component infrontend/providers/template/src/pages/develop/components/Editor.tsx
to provide a custom editor component for YAML files, using the@replit/codemirror-vscode-keymap
andcodemirror
packages, which provide a better editor experience than the@uiw/react-codemirror
package. TheEditor
component takes anonDocChange
prop, which is a callback function that receives the editor state when it changes. TheEditor
component also persists the editor state in the local storage and restores it when mounted (link)YamlList
component infrontend/providers/template/src/pages/develop/components/YamlList.tsx
to use theYamlCode
component from the@sealos/ui
package, which provides a UI library for the Kubepanel plugin. TheYamlCode
component takes amarkdown
prop instead of acontent
prop, so the code was adjusted accordingly. TheYamlCode
component also uses aGrid
component instead of aFlex
component to wrap the code, to fix a layout issue caused by the removal of the@uiw/react-codemirror
package. TheYamlList
component also adds ah="0"
prop to theFlex
component that wraps the YAML list items, to fix another layout issue caused by the removal of the@uiw/react-codemirror
package (link,link,link)Develop
component infrontend/providers/template/src/pages/develop/index.tsx
to use theEditor
component instead of theCodeMirror
component to render the YAML editor. TheEditor
component takes anonDocChange
prop, which is a callback function that receives the editor state when it changes. TheonYamlChange
function was updated to accept anEditorState
parameter instead of astring
parameter, and to use thedoc.toString()
method to get the YAML string from the editor state. TheonYamlChange
function was also wrapped in auseCallback
hook to memoize it and avoid unnecessary re-renders. TheEditor
component also handles the width, height, and min-height of the editor, so the props for those were removed from theCodeMirror
component. TheDevelop
component also uses thedynamic
function from thenext/dynamic
package to dynamically import theEditor
component and render it only on the client side, because theEditor
component uses the@replit/codemirror-vscode-keymap
andcodemirror
packages, which rely on the browser environment and cannot be rendered on the server side. Thedynamic
function takes a loading component, which is aSpinner
component from the@chakra-ui/react
package, and anssr
option, which is set tofalse
to disable server-side rendering for theEditor
component. TheDevelop
component also adds a condition to check if the YAML string is empty or blank before parsing it and setting the YAML source and list, to avoid errors when the editor is cleared or initialized with an empty string. TheDevelop
component also uses theuseEffect
hook to watch the form data changes and call theformOnchangeDebounce
function, because thewatch
method from thereact-hook-form
package returns a subscription object, which needs to be unsubscribed when the component unmounts to avoid memory leaks. TheuseEffect
hook returns a cleanup function that calls theunsubscribe
method on the subscription object. TheDevelop
component also fixes some syntax errors by adding closing angle brackets to some components (link,link,link,link,link,link,link,link,link,link,link)frontend/plugins/kubepanel/src/api/delete.ts
because it was not needed (link)