refactor(frontend):Use a Monorepo architecture replace the current architecture of frontend project (#3545)

* refactor(frontend):replace to monorepo

* chore(frontend):add push auto image in makefile
This commit is contained in:
xudaotutou
2023-07-20 15:37:46 +08:00
committed by GitHub
parent 089f251831
commit ed40683b9b
73 changed files with 13028 additions and 1711 deletions
+68 -2
View File
@@ -38,8 +38,70 @@ env:
DEFAULT_OWNER: "labring"
jobs:
image-prebuild:
runs-on: ubuntu-latest
strategy:
matrix:
module:
[
deps
]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare
id: prepare
run: |
bash ./scripts/resolve-tag-image.sh "${{ inputs.push_image }}" "${{ steps.check_tag.outputs.isTag }}" "${{ inputs.push_image_tag }}"
- name: Extract module name
id: module_name
run: |
MODULE_NAME=$(basename ${{ matrix.module }})
echo "MODULE_NAME=${MODULE_NAME}" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/sealos-${{ env.MODULE_NAME }}-frontend
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=dev,enable=true
type=raw,value=${{ steps.prepare.outputs.tag_name }},enable=true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github Container Hub
if: ${{ (github.event_name == 'push') ||(github.event_name == 'create') || (inputs.push_image == true) }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT }}
- name: Build And Push
uses: docker/build-push-action@v4
with:
context: ./frontend
file: ./frontend/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
target: deps
# Push if it's a push event or if push_image is true
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
image-build:
runs-on: ubuntu-latest
needs:
- image-prebuild
strategy:
matrix:
module:
@@ -106,12 +168,16 @@ jobs:
- name: Build And Push
uses: docker/build-push-action@v4
with:
context: ./frontend/${{ matrix.module }}
file: ./frontend/${{ matrix.module }}/Dockerfile
context: ./frontend
file: ./frontend/Dockerfile
build-args: |
name=${{ env.MODULE_NAME }}
path=${{ matrix.module }}
# Push if it's a push event or if push_image is true
push: ${{ (github.event_name == 'push') ||(github.event_name == 'create') || (inputs.push_image == true) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
save-sealos:
uses: ./.github/workflows/import-save-sealos.yml
cluster-image-build:
+14
View File
@@ -0,0 +1,14 @@
**/Dockerfile
**/.dockerignore
**/node_modules/
**/npm-debug.log
**/README.md
**/.next/
**/.git/
**/.env.local
**/config.yaml
**/.vscode/
**/.yalc/
**/dist/
**/yalc.lock
**/.gitignore
+1
View File
@@ -0,0 +1 @@
node_modules/
+100
View File
@@ -0,0 +1,100 @@
# Copyright © 2022 sealos.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ARG name
# ARG path
FROM node:current-alpine AS runner
WORKDIR /app
ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
RUN sed -i 's/https/http/' /etc/apk/repositories
RUN apk add curl \
&& apk add ca-certificates \
&& update-ca-certificates
USER nextjs
EXPOSE 3000
ENV PORT 3000
# Install dependencies only when needed
FROM node:current-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat && npm install -g pnpm
WORKDIR /app
# Install dependencies based on the preferred package manager root workspace
COPY pnpm-lock.yaml package.json pnpm-workspace.yaml ./
RUN \
[ -f pnpm-lock.yaml ] && pnpm fetch || \
(echo "Lockfile not found." && exit 1)
COPY ./tsconfig.json ./tsconfig.json
COPY ./tsconfig.deps.json ./tsconfig.deps.json
COPY ./tsconfig.base.json ./tsconfig.base.json
COPY ./packages ./packages
RUN pnpm -r --offline --filter=./packages/* install \
&& pnpm -r --filter=./packages/* run build
# Rebuild the source code only when needed
FROM node:current-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
# COPY --from=deps /app/packages ./packages
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1
RUN npm install -g pnpm
COPY --from=deps /app/packages ./packages
COPY . .
# RUN pnpm -r --offline --filter=./packages/* install \
# && pnpm -r --filter=./packages/* run build
ARG name
ARG path
RUN \
[ -f $path/pnpm-lock.yaml ] && (pnpm --offline --filter=$name install && pnpm --filter=$name run build) || \
(echo "Lockfile not found." && exit 1)
# Production image, copy all the files and run next
FROM runner
ARG name
ARG path
# You only need to copy next.config.js if you are NOT using the default configuration
# COPY --from=builder /app/desktop/next.config.js ./
COPY --from=builder /app/$path/public ./$path/public
COPY --from=builder --chown=nextjs:nodejs /app/$path/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/$path/.next/static ./$path/.next/static
ENV launchpath=./${path}/server.js
ENTRYPOINT ["sh","-c","node ${launchpath}"]
+75
View File
@@ -0,0 +1,75 @@
ifeq ($(OS),Windows_NT)
SHELL := powershell.exe
DOCKER_USERNAME := $(DOCKER_USERNAME)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
SHELL := /bin/bash
CURRENT_USER := $(shell echo $$USER)
endif
ifeq ($(UNAME_S),Darwin)
SHELL = /usr/bin/env bash
CURRENT_USER := $(shell id -un)
endif
endif
ifneq ($(strip $(DOCKER_USERNAME)),)
imageOwner := $(DOCKER_USERNAME)/
else
imageOwner :=
endif
# build image
buildTargets := \
desktop \
providers/terminal \
providers/adminer \
providers/bytebase \
providers/costcenter \
providers/dbprovider \
providers/applaunchpad \
providers/imagehub
buildTargets-all := $(addprefix image-build-,$(buildTargets))
pushTargets-all := $(addprefix image-push-,$(buildTargets))
$(foreach target,$(buildTargets),$(eval .PHONY: image-build-$($(target))))
$(foreach target,$(buildTargets),$(eval .PHONY: image-push-$($(target))))
$(foreach target,$(buildTargets),$(eval .PHONY: dev-$($(target))))
$(foreach target,$(buildTargets),$(eval .PHONY: build-$($(target))))
.PHONY: all dev-desktop image-prebuild
all: image-prebuild $(buildTargets-all)
push-images: image-prebuild $(pushTargets-all)
fetch-deps: pnpm-lock.yaml
pnpm fetch
build-packages: fetch-deps
pnpm -r --offline --filter=./packages/* install
pnpm -r --offline --filter=./packages/* build
build-providers/%: build-packages
pnpm -r --offline --filter=./providers/$* install
pnpm -r --offline --filter=./providers/$* build
build-%: build-packages
pnpm -r --offline --filter=$* install
pnpm -r --offline --filter=$* build
dev-providers/%: build-packages
pnpm -r --offline --filter=./providers/$* install
pnpm -r --offline --filter=./providers/$* dev
dev-%: build-packages
pnpm -r --offline --filter=$* install
pnpm -r --offline --filter=$* dev
# prebuild-image-for -j
image-prebuild: pnpm-lock.yaml
docker build --target deps . -t $(imageOwner)sealos-deps:dev
image-build-providers/%: image-prebuild
docker build -t $(imageOwner)sealos-$*:dev --build-arg path=providers/$* --build-arg name=$* .
image-build-%: image-prebuild
docker build -t $(imageOwner)sealos-$*:dev --build-arg path=$* --build-arg name=$* .
image-push-providers/%: image-build-providers/%
docker push $(imageOwner)sealos-$*:dev
image-push-%: image-build-%
docker push $(imageOwner)sealos-$*:dev
# Default target to run all builds.
+32
View File
@@ -18,6 +18,37 @@ echo '35.240.227.100 apiserver.cluster.local' | sudo tee -a /etc/hosts
echo '121.41.82.246 apiserver.cluster.local' | sudo tee -a /etc/hosts
```
## how to dev
- dev your app
```bash
cd frontend
make dev-[app path, such as providers/costcenter, desktop, etc.]
```
- add packages
```bash
cd frontend
# add remote
pnpm --filter=[project name or path] -r add \[package name\]
# add local
pnpm --filter=[project name or path] -r --offline add \[package name\]
```
## how to build
```bash
cd frontend
make image-build-[app path, such as providers/costcenter, desktop, etc.]
# multi jobs build
make all -j
```
- you can use `make all DOCKER_USERNAME=your_account` to build all apps for your account.
## new App
Refer to other apps to add some configuration.
@@ -28,3 +59,4 @@ Refer to other apps to add some configuration.
4. frontend/providers/app/deploy/manifests/appcr.yaml.tmpl
5. frontend/providers/app/deploy/manifests/deploy.yaml
6. frontend/providers/app/deploy/manifests/ingress.yaml.tmpl
7. makefile
-1
View File
@@ -1 +0,0 @@
node_modules
-36
View File
@@ -1,36 +0,0 @@
{
"name": "sealos-desktop-sdk",
"version": "0.1.14",
"description": "sealos desktop sdk",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup --config",
"async": "yalc push --replace",
"dev": "nodemon --ignore build/ --ignore node_modules/ --watch src/ -C -e ts --debug -x 'npm run build && cd dist && npm run async'"
},
"main": "index.js",
"types": "index.d.ts",
"files": [
"**"
],
"keywords": [],
"author": "lizhenq2009@gmail.com",
"license": "ISC",
"devDependencies": {
"@rollup/plugin-typescript": "^11.0.0",
"@types/uuid": "^9.0.1",
"@types/js-cookie": "^3.0.3",
"esbuild": "^0.15.9",
"rollup": "2.79.1",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-dts": "^4.2.2",
"tslib": "^2.5.0",
"typescript": "^4.8.4"
},
"dependencies": {
"axios": "^1.3.2",
"js-cookie": "^3.0.5",
"sealos-desktop-sdk": "^0.1.13",
"uuid": "^9.0.0"
}
}
-21
View File
@@ -1,21 +0,0 @@
{
"compilerOptions": {
"sourceMap": true,
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
"noEmitOnError": true,
"lib": [
"es2017",
"DOM"
],
"strict": true,
"esModuleInterop": false,
"allowJs": true,
"noImplicitAny": true,
"allowSyntheticDefaultImports": true
},
"include": [
"./src/**/*.ts"
]
}
+4
View File
@@ -1,4 +1,5 @@
/** @type {import('next').NextConfig} */
const path = require('path')
const runtimeCaching = require('next-pwa/cache')
const isProduction = process.env.NODE_ENV === 'production'
const { i18n } = require('./next-i18next.config')
@@ -17,6 +18,9 @@ const nextConfig = withPWA({
output: 'standalone',
typescript: {
ignoreBuildErrors: true
},
experimental: {
outputFileTracingRoot: path.join(__dirname, '../')
}
})
+20 -21
View File
@@ -9,54 +9,53 @@
"lint": "next lint"
},
"dependencies": {
"@alicloud/dysmsapi20170525": "^2.0.23",
"@alicloud/dysmsapi20170525": "^2.0.24",
"@alicloud/openapi-client": "^0.4.6",
"@alicloud/tea-util": "^1.4.5",
"@chakra-ui/react": "^2.5.5",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@alicloud/tea-util": "^1.4.7",
"@chakra-ui/react": "^2.8.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@kubernetes/client-node": "^0.18.1",
"@tanstack/react-query": "^4.29.3",
"axios": "^1.3.5",
"@tanstack/react-query": "^4.29.25",
"axios": "^1.4.0",
"clsx": "^1.2.1",
"cors": "^2.8.5",
"dayjs": "^1.11.7",
"dayjs": "^1.11.9",
"eslint": "8.38.0",
"eslint-config-next": "13.3.0",
"framer-motion": "^10.12.3",
"i18next": "^22.4.14",
"immer": "^10.0.1",
"framer-motion": "^10.12.22",
"i18next": "^22.5.1",
"immer": "^10.0.2",
"js-cookie": "^3.0.5",
"js-yaml": "^4.1.0",
"jsonwebtoken": "^9.0.0",
"jsonwebtoken": "^9.0.1",
"lodash": "^4.17.21",
"mongodb": "^5.5.0",
"mongodb": "^5.7.0",
"nanoid": "^4.0.2",
"next": "13.3.0",
"next-i18next": "^13.2.2",
"next-i18next": "^13.3.0",
"next-pwa": "^5.6.0",
"nprogress": "^0.2.0",
"qrcode.react": "^3.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-draggable": "^4.4.5",
"react-i18next": "^12.2.0",
"sass": "^1.62.0",
"sealos-desktop-sdk": "^0.1.14",
"typescript": "5.0.4",
"react-i18next": "^12.3.1",
"sass": "^1.63.6",
"sealos-desktop-sdk": "workspace:*",
"uuid": "^9.0.0",
"zustand": "^4.3.7"
"zustand": "^4.3.9"
},
"devDependencies": {
"@types/js-cookie": "^3.0.3",
"@types/js-yaml": "^4.0.5",
"@types/jsonwebtoken": "^9.0.2",
"@types/lodash": "^4.14.194",
"@types/lodash": "^4.14.195",
"@types/node": "18.15.11",
"@types/nprogress": "^0.2.0",
"@types/react": "18.0.37",
"@types/react-dom": "18.0.11",
"@types/uuid": "^9.0.1",
"@types/uuid": "^9.0.2",
"prettier": "^2.8.8"
}
}
+403 -1334
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,12 @@
.background {
position: absolute;
top: 0;
left: 0;
z-index: -10;
min-width: 100vw;
min-height: 100vh;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
transition: all 0.2s ease;
}
+4 -18
View File
@@ -1,24 +1,12 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
@@ -27,10 +15,8 @@
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
"src/**/*.ts",
"src/**/*.tsx"
],
"exclude": [
"node_modules"
]
"extends": "../tsconfig.web.json",
}
+11 -2
View File
@@ -3,9 +3,18 @@
"private": true,
"version": "0.1.0",
"scripts": {
"format": "prettier --config \"./.prettierrc.js\" --write \"./*/*/src/**/*.{ts,tsx,scss}\""
"format": "prettier --config \"./.prettierrc.js\" --write \"./*/*/src/**/*.{ts,tsx,scss}\"",
"preinstall": "npx only-allow pnpm"
},
"workspaces": [
"./packages/*",
"./providers/*",
"./desktop"
],
"devDependencies": {
"prettier": "^2.8.4"
"prettier": "^2.8.8"
},
"dependencies": {
"typescript": "^5.1.6"
}
}
+2
View File
@@ -0,0 +1,2 @@
node_modules
dist
+57
View File
@@ -0,0 +1,57 @@
{
"name": "sealos-desktop-sdk",
"version": "0.1.14",
"description": "sealos desktop sdk",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup -c",
"dev": "rollup -c -w"
},
"exports": {
".": {
"import": "./dist/index.esm.js",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./master": {
"import": "./dist/master.esm.js",
"require": "./dist/master.js",
"types": "./dist/master.d.ts"
},
"./app": {
"import": "./dist/app.esm.js",
"require": "./dist/app.js",
"types": "./dist/app.d.ts"
}
},
"typesVersions": {
"*": {
"master": [
"./dist/master.d.ts"
],
"app": [
"./dist/app.d.ts"
],
"*": [
"./dist/index.d.ts"
]
}
},
"keywords": [],
"author": "lizhenq2009@gmail.com",
"license": "ISC",
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.2",
"@types/js-cookie": "^3.0.3",
"@types/uuid": "^9.0.2",
"rollup": "2.79.1",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-dts": "^4.2.3",
"tslib": "^2.6.0"
},
"dependencies": {
"axios": "^1.4.0",
"js-cookie": "^3.0.5",
"uuid": "^9.0.0"
}
}
@@ -1,3 +1,3 @@
// export { request } from "./utils"
export { API_NAME, EVENT_NAME } from './constants';
export type { MasterReplyMessageType, AppSendMessageType } from './types';
export type { MasterReplyMessageType, AppSendMessageType } from './types';
@@ -1,4 +1,4 @@
type Method =
export type Method =
| 'get'
| 'GET'
| 'delete'
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.deps.json",
"compilerOptions": {
"lib": ["es2017", "DOM"],
"noImplicitAny": true
},
"include": ["src/**/*.ts", "src/**/*.tsx","dist/**/*.d.ts","dist/**/*.ts"]
}
+11916 -9
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -0,0 +1,4 @@
packages:
- "packages/*"
- "providers/*"
- "desktop"
@@ -1,4 +1,5 @@
/** @type {import('next').NextConfig} */
const path = require('path')
const nextConfig = {
reactStrictMode: false,
output: 'standalone',
@@ -9,6 +10,9 @@ const nextConfig = {
// })
// return config
// },
experimental: {
outputFileTracingRoot: path.join(__dirname, '../../')
}
}
module.exports = nextConfig
+4 -5
View File
@@ -10,16 +10,15 @@
},
"dependencies": {
"@kubernetes/client-node": "0.18.1",
"@tanstack/react-query": "^4.29.13",
"@tanstack/react-query": "^4.29.25",
"axios": "1.4.0",
"clsx": "^1.2.1",
"immer": "^10.0.2",
"js-yaml": "^4.1.0",
"next": "13.4.5",
"react": "18.2.0",
"sealos-desktop-sdk": "^0.1.14",
"typescript": "5.1.3",
"zustand": "^4.3.8"
"sealos-desktop-sdk": "workspace:*",
"zustand": "^4.3.9"
},
"devDependencies": {
"@types/js-yaml": "^4.0.5",
@@ -27,6 +26,6 @@
"@types/react": "18.2.12",
"eslint": "8.42.0",
"eslint-config-next": "13.4.5",
"sass": "^1.63.4"
"sass": "^1.63.6"
}
}
+3 -19
View File
@@ -1,24 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
@@ -32,11 +19,8 @@
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"src/**/*.{ts,tsx}",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
"extends": "../../tsconfig.web.json",
}
@@ -2,7 +2,7 @@
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const { i18n } = require('./next-i18next.config')
const analyzer = process.env === 'production' ? [new BundleAnalyzerPlugin()] : []
const path = require('path')
const nextConfig = {
i18n,
output: 'standalone',
@@ -18,6 +18,9 @@ const nextConfig = {
])
config.plugins = [...config.plugins, ...analyzer]
return config
},
experimental: {
outputFileTracingRoot: path.join(__dirname, '../../')
}
}
+24 -25
View File
@@ -1,5 +1,5 @@
{
"name": "kf-web",
"name": "applaunchpad",
"private": true,
"version": "0.1.0",
"scripts": {
@@ -11,55 +11,54 @@
"unlink-sdk": "yalc remove --all && pnpm install sealos-desktop-sdk"
},
"dependencies": {
"@chakra-ui/icons": "^2.0.17",
"@chakra-ui/react": "^2.5.1",
"@chakra-ui/system": "^2.5.5",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@chakra-ui/icons": "^2.1.0",
"@chakra-ui/react": "^2.8.0",
"@chakra-ui/system": "^2.6.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@kubernetes/client-node": "^0.18.1",
"@next/font": "13.1.6",
"@tanstack/react-query": "^4.24.10",
"@tanstack/react-query": "^4.29.25",
"ansi_up": "^5.2.1",
"axios": "^1.3.4",
"dayjs": "^1.11.7",
"echarts": "^5.4.1",
"axios": "^1.4.0",
"dayjs": "^1.11.9",
"echarts": "^5.4.3",
"fast-json-patch": "^3.1.1",
"framer-motion": "^9.0.4",
"i18next": "^22.5.0",
"immer": "^9.0.19",
"framer-motion": "^9.1.7",
"i18next": "^22.5.1",
"immer": "^9.0.21",
"js-cookie": "^3.0.5",
"js-yaml": "^4.1.0",
"jszip": "^3.10.1",
"lodash": "^4.17.21",
"nanoid": "^4.0.1",
"nanoid": "^4.0.2",
"next": "13.1.6",
"next-i18next": "^13.2.2",
"next-i18next": "^13.3.0",
"nprogress": "^0.2.0",
"prettier": "^2.8.4",
"prettier": "^2.8.8",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.43.1",
"react-hook-form": "^7.45.2",
"react-i18next": "^12.3.1",
"react-markdown": "^8.0.4",
"react-markdown": "^8.0.7",
"react-syntax-highlighter": "^15.5.0",
"sass": "^1.58.3",
"sealos-desktop-sdk": "^0.1.14",
"typescript": "4.9.5",
"zustand": "^4.3.5"
"sass": "^1.63.6",
"sealos-desktop-sdk": "workspace:*",
"zustand": "^4.3.9"
},
"devDependencies": {
"@svgr/webpack": "^6.5.1",
"@types/js-cookie": "^3.0.3",
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.191",
"@types/lodash": "^4.14.195",
"@types/node": "18.13.0",
"@types/nprogress": "^0.2.0",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"@types/react-syntax-highlighter": "^15.5.6",
"@types/react-syntax-highlighter": "^15.5.7",
"eslint": "8.33.0",
"eslint-config-next": "13.1.6",
"svg-inline-loader": "^0.8.2",
"webpack-bundle-analyzer": "^4.8.0"
"webpack-bundle-analyzer": "^4.9.0"
}
}
@@ -0,0 +1,19 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import { ApiResp } from '@/services/kubernet';
import { jsonRes } from '@/services/backend/response';
export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResp>) {
try {
jsonRes(res, {
data: {
SEALOS_DOMAIN: process.env.SEALOS_DOMAIN || 'cloud.sealos.io',
INGRESS_SECRET: process.env.INGRESS_SECRET || 'wildcard-cert'
}
});
} catch (err: any) {
jsonRes(res, {
code: 500,
error: err
});
}
}
+13 -17
View File
@@ -1,24 +1,20 @@
{
"compilerOptions": {
"target": "es2015",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
"@/*": [
"./src/*"
]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"src/**/*.{ts,tsx,d.ts}"
],
"extends": "../../tsconfig.web.json"
}
+5 -1
View File
@@ -1,7 +1,11 @@
/** @type {import('next').NextConfig} */
const path = require('path')
const nextConfig = {
reactStrictMode: false,
output: 'standalone'
output: 'standalone',
experimental: {
outputFileTracingRoot: path.join(__dirname, '../../')
}
}
module.exports = nextConfig
+5 -6
View File
@@ -10,25 +10,24 @@
},
"dependencies": {
"@kubernetes/client-node": "0.18.0",
"@tanstack/react-query": "^4.28.0",
"@tanstack/react-query": "^4.29.25",
"axios": "1.2.1",
"clsx": "^1.2.1",
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"immer": "^9.0.16",
"immer": "^9.0.21",
"js-yaml": "^4.1.0",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"sealos-desktop-sdk": "^0.1.11",
"typescript": "5.0.2",
"zustand": "^4.1.5"
"sealos-desktop-sdk": "workspace:*",
"zustand": "^4.3.9"
},
"devDependencies": {
"@types/js-yaml": "^4.0.5",
"@types/node": "18.15.5",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"sass": "^1.57.1"
"sass": "^1.63.6"
}
}
@@ -17,7 +17,7 @@ export default function Index() {
useEffect(() => {
const initApp = async () => {
try {
const result = await sealosApp.getUserInfo();
const result = await sealosApp.getSession();
setSession(result);
} catch (error) {}
};
+2 -18
View File
@@ -1,23 +1,10 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"@/*": [
@@ -27,10 +14,7 @@
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
"src/**/*.{ts,tsx}"
],
"exclude": [
"node_modules"
]
"extends": "../../tsconfig.web.json"
}
+6 -2
View File
@@ -1,11 +1,15 @@
const { i18n } = require('./next-i18next.config');
const path = require('path');
/** @type {import('next').NextConfig} */
const nextConfig = {
i18n,
reactStrictMode: false,
output: 'standalone',
transpilePackages: ['echarts']
transpilePackages: ['echarts'],
experimental: {
// this includes files from the monorepo base two directories up
outputFileTracingRoot: path.join(__dirname, '../../'),
}
};
module.exports = nextConfig;
+12 -14
View File
@@ -1,13 +1,12 @@
{
"name": "terminal",
"name": "costcenter",
"version": "0.1.1",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"docker": "docker build . -t"
"lint": "next lint"
},
"dependencies": {
"@alicloud/dysmsapi20170525": "^2.0.24",
@@ -18,13 +17,13 @@
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@kubernetes/client-node": "0.18.0",
"@tanstack/query-sync-storage-persister": "^4.29.7",
"@tanstack/react-query": "^4.29.7",
"@tanstack/react-query-persist-client": "^4.29.7",
"@tanstack/query-sync-storage-persister": "^4.29.25",
"@tanstack/react-query": "^4.29.25",
"@tanstack/react-query-persist-client": "^4.29.25",
"axios": "1.2.1",
"clsx": "^1.2.1",
"date-fns": "^2.30.0",
"echarts": "^5.4.2",
"echarts": "^5.4.3",
"echarts-for-react": "^3.0.2",
"formik": "^2.4.2",
"framer-motion": "^10.9.1",
@@ -35,16 +34,16 @@
"lodash": "^4.17.21",
"mongodb": "^5.7.0",
"next": "13.1.6",
"next-i18next": "^13.2.2",
"next-i18next": "^13.3.0",
"nprogress": "^0.2.0",
"qrcode.react": "^3.1.0",
"react": "18.2.0",
"react-activation": "^0.12.4",
"react-day-picker": "^8.7.1",
"react-day-picker": "^8.8.0",
"react-dom": "18.2.0",
"react-i18next": "^12.2.2",
"sealos-desktop-sdk": "^0.1.14",
"zustand": "^4.1.5"
"react-i18next": "^12.3.1",
"sealos-desktop-sdk": "workspace:*",
"zustand": "^4.3.9"
},
"devDependencies": {
"@types/js-cookie": "^3.0.3",
@@ -56,7 +55,6 @@
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"prettier": "^2.8.8",
"sass": "^1.57.1",
"typescript": "4.9.5"
"sass": "^1.63.6"
}
}
+13 -17
View File
@@ -1,24 +1,20 @@
{
"compilerOptions": {
"target": "es2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
"@/*": [
"./src/*"
]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"src/**/*.{ts,tsx}"
],
"extends": "../../tsconfig.web.json"
}
+5 -1
View File
@@ -2,7 +2,7 @@
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const { i18n } = require('./next-i18next.config');
const analyzer = process.env === 'production' ? [new BundleAnalyzerPlugin()] : [];
const path = require('path')
const nextConfig = {
i18n,
output: 'standalone',
@@ -18,6 +18,10 @@ const nextConfig = {
]);
config.plugins = [...config.plugins, ...analyzer];
return config;
},
experimental: {
// this includes files from the monorepo base two directories up
outputFileTracingRoot: path.join(__dirname, '../../'),
}
};
+26 -27
View File
@@ -1,5 +1,5 @@
{
"name": "kf-web",
"name": "dbprovider",
"private": true,
"version": "0.1.0",
"scripts": {
@@ -11,57 +11,56 @@
"unlink-sdk": "yalc remove --all && pnpm install sealos-desktop-sdk"
},
"dependencies": {
"@chakra-ui/anatomy": "^2.1.1",
"@chakra-ui/icons": "^2.0.17",
"@chakra-ui/react": "^2.5.1",
"@chakra-ui/system": "^2.5.5",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@chakra-ui/anatomy": "^2.2.0",
"@chakra-ui/icons": "^2.1.0",
"@chakra-ui/react": "^2.8.0",
"@chakra-ui/system": "^2.6.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@kubernetes/client-node": "^0.18.1",
"@next/font": "13.1.6",
"@tanstack/react-query": "^4.24.10",
"@tanstack/react-query": "^4.29.25",
"ansi_up": "^5.2.1",
"axios": "^1.3.4",
"axios": "^1.4.0",
"date-fns": "^2.30.0",
"dayjs": "^1.11.7",
"echarts": "^5.4.1",
"framer-motion": "^9.0.4",
"i18next": "^22.5.0",
"immer": "^9.0.19",
"dayjs": "^1.11.9",
"echarts": "^5.4.3",
"framer-motion": "^9.1.7",
"i18next": "^22.5.1",
"immer": "^9.0.21",
"js-cookie": "^3.0.5",
"js-yaml": "^4.1.0",
"jszip": "^3.10.1",
"lodash": "^4.17.21",
"nanoid": "^4.0.1",
"nanoid": "^4.0.2",
"next": "13.1.6",
"next-i18next": "^13.2.2",
"next-i18next": "^13.3.0",
"nprogress": "^0.2.0",
"prettier": "^2.8.4",
"prettier": "^2.8.8",
"react": "18.2.0",
"react-day-picker": "^8.7.1",
"react-day-picker": "^8.8.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.43.1",
"react-hook-form": "^7.45.2",
"react-i18next": "^12.3.1",
"react-markdown": "^8.0.4",
"react-markdown": "^8.0.7",
"react-syntax-highlighter": "^15.5.0",
"sass": "^1.58.3",
"sealos-desktop-sdk": "^0.1.14",
"typescript": "4.9.5",
"zustand": "^4.3.5"
"sass": "^1.63.6",
"sealos-desktop-sdk": "workspace:*",
"zustand": "^4.3.9"
},
"devDependencies": {
"@svgr/webpack": "^6.5.1",
"@types/js-cookie": "^3.0.3",
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.191",
"@types/lodash": "^4.14.195",
"@types/node": "18.13.0",
"@types/nprogress": "^0.2.0",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"@types/react-syntax-highlighter": "^15.5.6",
"@types/react-syntax-highlighter": "^15.5.7",
"eslint": "8.33.0",
"eslint-config-next": "13.1.6",
"svg-inline-loader": "^0.8.2",
"webpack-bundle-analyzer": "^4.8.0"
"webpack-bundle-analyzer": "^4.9.0"
}
}
-9
View File
@@ -5,9 +5,6 @@ settings:
excludeLinksFromLockfile: false
dependencies:
'@chakra-ui/anatomy':
specifier: ^2.1.1
version: registry.npmmirror.com/@chakra-ui/anatomy@2.1.1
'@chakra-ui/icons':
specifier: ^2.0.17
version: registry.npmmirror.com/@chakra-ui/icons@2.0.18(@chakra-ui/system@2.5.5)(react@18.2.0)
@@ -1819,12 +1816,6 @@ packages:
react: registry.npmmirror.com/react@18.2.0
dev: false
registry.npmmirror.com/@chakra-ui/anatomy@2.1.1:
resolution: {integrity: sha512-LUHAoqJAgxAqmyckG5bUpBrfEo1FleEyY+1A8hkWciy58gZ+h3GoY9oBpHcdo7XdHPpy3G+3hieK/7i9NLwxAw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/anatomy/-/anatomy-2.1.1.tgz}
name: '@chakra-ui/anatomy'
version: 2.1.1
dev: false
registry.npmmirror.com/@chakra-ui/anatomy@2.1.2:
resolution: {integrity: sha512-pKfOS/mztc4sUXHNc8ypJ1gPWSolWT770jrgVRfolVbYlki8y5Y+As996zMF6k5lewTu6j9DQequ7Cc9a69IVQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/anatomy/-/anatomy-2.1.2.tgz}
name: '@chakra-ui/anatomy'
@@ -1,6 +1,8 @@
import { GET, POST, DELETE } from '@/services/request';
import type { Response as resourcePriceResponse } from '@/pages/api/platform/resourcePrice';
import type { Response as DBVersionMapType } from '@/pages/api/platform/getVersion';
import { Response as EnvResponse } from '@/pages/api/getEnv';
export const getResourcePrice = () => GET<resourcePriceResponse>('/api/platform/resourcePrice');
export const getAppEnv = () => GET<EnvResponse>('/api/getEnv');
export const getDBVersionMap = () => GET<DBVersionMapType>('/api/platform/getVersion');
@@ -15,7 +15,7 @@ import { useLoading } from '@/hooks/useLoading';
import { useRouter } from 'next/router';
import { appWithTranslation, useTranslation } from 'next-i18next';
import { getLangStore, setLangStore } from '@/utils/cookieUtils';
import { getUserPrice, getDBVersion, updateStorageClassName } from '@/store/static';
import { getUserPrice, getDBVersion, StorageClassName, Domain, getEnv } from '@/store/static';
import 'nprogress/nprogress.css';
import 'react-day-picker/dist/style.css';
@@ -40,9 +40,9 @@ const queryClient = new QueryClient({
function App({
Component,
pageProps,
domain,
env_storage_className
}: AppProps & { domain: string; env_storage_className?: string }) {
// domain,
// env_storage_className
}: AppProps) {
const router = useRouter();
const { i18n } = useTranslation();
const { setScreenWidth, loading, setLastRoute } = useGlobalStore();
@@ -67,7 +67,7 @@ function App({
if (!process.env.NEXT_PUBLIC_MOCK_USER) {
localStorage.removeItem('session');
openConfirm(() => {
window.open(`https://${domain}`, '_self');
window.open(`https://${Domain}`, '_self');
})();
}
}
@@ -75,7 +75,7 @@ function App({
NProgress.done();
return response;
}, [openConfirm, domain]);
}, [openConfirm]);
// add resize event
useEffect(() => {
@@ -106,8 +106,7 @@ function App({
getUserPrice();
getDBVersion();
updateStorageClassName(env_storage_className);
getEnv();
(async () => {
try {
const lang = await sealosApp.getLanguage();
@@ -155,11 +154,5 @@ function App({
);
}
App.getInitialProps = async () => {
return {
domain: process.env.SEALOS_DOMAIN || 'cloud.sealos.io',
env_storage_className: process.env.STORAGE_CLASSNAME
};
};
export default appWithTranslation(App);
@@ -0,0 +1,24 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import { ApiResp } from '@/services/kubernet';
import { authSession } from '@/services/backend/auth';
import { getK8s } from '@/services/backend/kubernetes';
import { jsonRes } from '@/services/backend/response';
export type Response = {
domain?: string;
env_storage_className?: string;
}
export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResp>) {
try {
jsonRes<Response>(res, {
data: {
domain: process.env.SEALOS_DOMAIN || 'cloud.sealos.io',
env_storage_className: process.env.STORAGE_CLASSNAME
}
});
} catch (err: any) {
jsonRes(res, {
code: 500,
error: err
});
}
}
@@ -42,7 +42,8 @@ export type ComponentRef = {
backupProcessing: boolean;
};
const BackupTable = ({ db }: { db: DBDetailType }, ref: ForwardedRef<ComponentRef>) => {
const BackupTable = ({ db }: { db?: DBDetailType }, ref: ForwardedRef<ComponentRef>) => {
if(!db) return <></>
const { t } = useTranslation();
const { toast } = useToast();
const { Loading, setIsLoading } = useLoading();
@@ -36,6 +36,7 @@ const BackupModal = ({
onClose: () => void;
onSuccess?: () => void;
}) => {
if(!db) return <></>
const router = useRouter();
const { t } = useTranslation();
const { toast } = useToast();
@@ -1,4 +1,4 @@
import { getResourcePrice, getDBVersionMap } from '@/api/platform';
import { getResourcePrice, getDBVersionMap, getAppEnv } from '@/api/platform';
import type { Response as resourcePriceResponse } from '@/pages/api/platform/resourcePrice';
import { DBTypeEnum } from '@/constants/db';
import type { Response as DBVersionMapType } from '@/pages/api/platform/getVersion';
@@ -9,11 +9,12 @@ export let SOURCE_PRICE: resourcePriceResponse = {
storage: 0.002048
};
export let StorageClassName: string | undefined;
export let Domain: string | undefined;
export let INSTALL_ACCOUNT = false;
let retryGetPrice = 3;
let retryVersion = 3;
let retryGetEnv = 3
export let DBVersionMap: DBVersionMapType = {
[DBTypeEnum.postgresql]: [{ id: 'postgresql-14.8.0', label: 'postgresql-14.8.0' }],
[DBTypeEnum.mongodb]: [{ id: 'mongodb-5.0.14', label: 'mongodb-5.0.14' }],
@@ -35,7 +36,20 @@ export const getUserPrice = async () => {
}
}
};
export const getEnv = async () => {
try {
const res = await getAppEnv()
StorageClassName = res.env_storage_className;
Domain = res.domain;
} catch {
retryGetEnv--;
if (retryGetEnv >= 0) {
setTimeout(() => {
getEnv();
}, 1000);
}
}
}
export const getDBVersion = async () => {
try {
const res = await getDBVersionMap();
@@ -50,6 +64,3 @@ export const getDBVersion = async () => {
}
};
export const updateStorageClassName = (val?: string) => {
StorageClassName = val;
};
+13 -17
View File
@@ -1,24 +1,20 @@
{
"compilerOptions": {
"target": "es2015",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
"@/*": [
"./src/*"
]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"src/**/*.{ts,tsx,.d.ts}"
],
"extends": "../../tsconfig.web.json"
}
+5 -1
View File
@@ -1,7 +1,11 @@
/** @type {import('next').NextConfig} */
const path = require('path')
const nextConfig = {
reactStrictMode: false,
output: 'standalone'
output: 'standalone',
experimental: {
outputFileTracingRoot: path.join(__dirname, '../../')
}
}
module.exports = nextConfig
+12 -13
View File
@@ -12,35 +12,34 @@
"@ctrl/golang-template": "^1.4.1",
"@kubernetes/client-node": "0.18.0",
"@next/font": "13.1.1",
"@tanstack/react-query": "^4.20.4",
"@tanstack/react-query": "^4.29.25",
"axios": "1.2.1",
"clsx": "^1.2.1",
"eslint": "8.33.0",
"eslint-config-next": "13.1.0",
"github-markdown-css": "^5.1.0",
"immer": "^9.0.16",
"github-markdown-css": "^5.2.0",
"immer": "^9.0.21",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"next": "13.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-markdown": "^8.0.4",
"react-markdown": "^8.0.7",
"react-syntax-highlighter": "^15.5.0",
"sealos-desktop-sdk": "^0.1.11",
"sealos-desktop-sdk": "workspace:^",
"ts-md5": "^1.3.1",
"zustand": "^4.1.5"
"zustand": "^4.3.9"
},
"devDependencies": {
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.191",
"@types/lodash": "^4.14.195",
"@types/node": "18.11.19",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"@types/react-syntax-highlighter": "^15.5.6",
"autoprefixer": "^10.4.13",
"postcss": "^8.4.21",
"sass": "^1.57.1",
"tailwindcss": "^3.2.4",
"typescript": "4.9.5"
"@types/react-syntax-highlighter": "^15.5.7",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.26",
"sass": "^1.63.6",
"tailwindcss": "^3.3.3"
}
}
@@ -16,7 +16,7 @@ export default function Layout({ children }: any) {
useEffect(() => {
const initApp = async () => {
try {
const result = await sealosApp.getUserInfo();
const result = await sealosApp.getSession();
setSession(result);
} catch (error) {}
setIsLoading(false);
+2 -18
View File
@@ -1,23 +1,10 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"@/*": [
@@ -27,10 +14,7 @@
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
"src/**/*.{ts,tsx}"
],
"exclude": [
"node_modules"
]
"extends": "../../tsconfig.web.json"
}
@@ -0,0 +1 @@
docker.io/labring/docker-terminal:1.20.4-6
+5 -1
View File
@@ -1,7 +1,11 @@
/** @type {import('next').NextConfig} */
const path = require('path')
const nextConfig = {
reactStrictMode: false,
output: 'standalone'
output: 'standalone',
experimental: {
outputFileTracingRoot: path.join(__dirname, '../../')
}
}
module.exports = nextConfig
+10 -11
View File
@@ -9,33 +9,32 @@
"lint": "next lint"
},
"dependencies": {
"@chakra-ui/react": "^2.5.5",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@chakra-ui/react": "^2.8.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@kubernetes/client-node": "0.18.0",
"@tanstack/react-query": "^4.28.0",
"@tanstack/react-query": "^4.29.25",
"axios": "1.2.1",
"clsx": "^1.2.1",
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"framer-motion": "^10.11.6",
"immer": "^9.0.16",
"framer-motion": "^10.12.22",
"immer": "^9.0.21",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"nanoid": "^4.0.2",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"sealos-desktop-sdk": "^0.1.11",
"typescript": "5.0.2",
"zustand": "^4.1.5"
"sealos-desktop-sdk": "workspace:*",
"zustand": "^4.3.9"
},
"devDependencies": {
"@types/lodash": "^4.14.191",
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.195",
"@types/node": "18.15.5",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"sass": "^1.57.1"
"sass": "^1.63.6"
}
}
@@ -23,7 +23,7 @@ export default function Index(props: ServiceEnv) {
useEffect(() => {
const initApp = async () => {
try {
const result = await sealosApp.getUserInfo();
const result = await sealosApp.getSession();
setSession(result);
} catch (error) {}
};
+2 -18
View File
@@ -1,23 +1,10 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"@/*": [
@@ -27,10 +14,7 @@
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
"src/**/*.{ts,tsx}"
],
"exclude": [
"node_modules"
]
"extends": "../../tsconfig.web.json"
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "es2015",
"module": "esnext",
"sourceMap": true,
"moduleResolution": "node",
"isolatedModules": true,
"allowJs": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"noUnusedLocals": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"removeComments": true,
},
"exclude": [
"**/node_modules",
]
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"noEmitOnError": true,
}
}
+7
View File
@@ -0,0 +1,7 @@
{
"references": [
{ "path": "./tsconfig.base.json" },
{ "path": "./tsconfig.deps.json" },
{ "path": "./tsconfig.web.json"}
]
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"jsx": "preserve",
"incremental": true,
"skipLibCheck": true
},
}