diff --git a/webapp/packages/chat-sdk/package.json b/webapp/packages/chat-sdk/package.json index 0e9780605..dda58c264 100644 --- a/webapp/packages/chat-sdk/package.json +++ b/webapp/packages/chat-sdk/package.json @@ -35,6 +35,8 @@ "scripts": { "start": "npm run start:dev", "start:dev": "node scripts/start.js", + "watch": "rollup -c rollup/rollup.esm.config.mjs --watch", + "watch:bg": "rollup -c rollup/rollup.esm.config.mjs --watch &", "clean": "rimraf ./dist", "build": "npm run clean && npm run build-es", "test": "node scripts/test.js", @@ -85,8 +87,8 @@ "@types/jest": "^27.5.2", "@types/lodash": "^4.14.198", "@types/node": "^16.18.31", - "@types/react": "^18.2.6", - "@types/react-dom": "^18.2.4", + "@types/react": "^18.3.0", + "@types/react-dom": "^18.3.0", "autoprefixer": "^10.4.14", "babel-jest": "^27.4.2", "babel-loader": "^8.2.3", @@ -122,10 +124,10 @@ "postcss-normalize": "^10.0.1", "postcss-preset-env": "^7.0.1", "prompts": "^2.4.2", - "react": "^18.2.0", + "react": "^18.3.1", "react-app-polyfill": "^3.0.0", "react-dev-utils": "^12.0.1", - "react-dom": "^18.2.0", + "react-dom": "^18.3.0", "react-refresh": "^0.11.0", "resolve": "^1.20.0", "resolve-url-loader": "^4.0.0", diff --git a/webapp/packages/supersonic-fe/config/config.ts b/webapp/packages/supersonic-fe/config/config.ts index 8554def86..95fa5d527 100644 --- a/webapp/packages/supersonic-fe/config/config.ts +++ b/webapp/packages/supersonic-fe/config/config.ts @@ -1,6 +1,6 @@ // https://umijs.org/config/ import { defineConfig } from '@umijs/max'; -// import { join } from 'path'; +import path from 'path'; import defaultSettings, { publicPath, basePath } from './defaultSettings'; import proxy from './proxy'; import routes from './routes'; @@ -180,5 +180,8 @@ export default defineConfig({ }, requestRecord: {}, exportStatic: {}, + alias: { + 'supersonic-chat-sdk': path.resolve(__dirname, '../../chat-sdk/src/'), + }, // esbuildMinifyIIFE: true, }); diff --git a/webapp/packages/supersonic-fe/config/proxy.ts b/webapp/packages/supersonic-fe/config/proxy.ts index 166919713..8ab959470 100644 --- a/webapp/packages/supersonic-fe/config/proxy.ts +++ b/webapp/packages/supersonic-fe/config/proxy.ts @@ -1,7 +1,8 @@ export default { dev: { '/api/': { - target: 'http://localhost:9080', + // target: 'http://localhost:9080', + target: 'http://supersonic-pre.tmeoa.com/', changeOrigin: true, }, }, diff --git a/webapp/packages/supersonic-fe/package.json b/webapp/packages/supersonic-fe/package.json index fa2a5cc2f..c9277eaba 100644 --- a/webapp/packages/supersonic-fe/package.json +++ b/webapp/packages/supersonic-fe/package.json @@ -95,7 +95,7 @@ "react-split-pane": "^2.0.3", "react-syntax-highlighter": "^15.4.3", "sql-formatter": "^2.3.3", - "supersonic-chat-sdk": "0.0.0", + "supersonic-chat-sdk": "workspace:*", "supersonic-insights-flow-components": "^1.4.9", "umi-request": "1.4.0" }, @@ -137,8 +137,5 @@ "engines": { "node": ">=16.0.0 <20.0.0" }, - "resolutions": { - "@types/react": "18.3.1" - }, "__npminstall_done": false } \ No newline at end of file diff --git a/webapp/pnpm-lock.yaml b/webapp/pnpm-lock.yaml index 8a1303a28..f4a6ded1d 100644 --- a/webapp/pnpm-lock.yaml +++ b/webapp/pnpm-lock.yaml @@ -52,7 +52,7 @@ importers: version: 1.4.4(react-dom@18.3.1)(react@18.3.1) react-markdown: specifier: ^9.0.1 - version: 9.0.1(@types/react@18.3.2)(react@18.3.1) + version: 9.0.1(@types/react@18.3.1)(react@18.3.1) react-spinners: specifier: ^0.13.8 version: 0.13.8(react-dom@18.3.1)(react@18.3.1) @@ -115,10 +115,10 @@ importers: specifier: ^16.18.31 version: 16.18.97 '@types/react': - specifier: ^18.2.6 - version: 18.3.2 + specifier: ^18.3.0 + version: 18.3.1 '@types/react-dom': - specifier: ^18.2.4 + specifier: ^18.3.0 version: 18.3.0 autoprefixer: specifier: ^10.4.14 @@ -226,7 +226,7 @@ importers: specifier: ^2.4.2 version: 2.4.2 react: - specifier: ^18.2.0 + specifier: ^18.3.1 version: 18.3.1 react-app-polyfill: specifier: ^3.0.0 @@ -235,7 +235,7 @@ importers: specifier: ^12.0.1 version: 12.0.1(eslint@8.57.0)(typescript@4.9.5)(webpack@5.91.0) react-dom: - specifier: ^18.2.0 + specifier: ^18.3.0 version: 18.3.1(react@18.3.1) react-refresh: specifier: ^0.11.0 @@ -427,7 +427,7 @@ importers: specifier: ^2.3.3 version: 2.3.4 supersonic-chat-sdk: - specifier: 0.0.0 + specifier: workspace:* version: link:../chat-sdk supersonic-insights-flow-components: specifier: ^1.4.9 @@ -6449,12 +6449,6 @@ packages: '@types/prop-types': 15.7.12 csstype: 3.1.3 - /@types/react@18.3.2: - resolution: {integrity: sha512-Btgg89dAnqD4vV7R3hlwOxgqobUQKgx3MmrQRi0yYbs/P0ym8XozIAlkqVilPqHQwXs4e9Tf63rrCgl58BcO4w==} - dependencies: - '@types/prop-types': 15.7.12 - csstype: 3.1.3 - /@types/resolve@1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: @@ -22759,14 +22753,14 @@ packages: /react-lifecycles-compat@3.0.4: resolution: {integrity: sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==} - /react-markdown@9.0.1(@types/react@18.3.2)(react@18.3.1): + /react-markdown@9.0.1(@types/react@18.3.1)(react@18.3.1): resolution: {integrity: sha512-186Gw/vF1uRkydbsOIkcGXw7aHq0sZOCRFFjGrr7b9+nVZg4UfA4enXCaxm4fUzecU38sWfrNDitGhshuU7rdg==} peerDependencies: '@types/react': '>=18' react: '>=18' dependencies: '@types/hast': 3.0.4 - '@types/react': 18.3.2 + '@types/react': 18.3.1 devlop: 1.1.0 hast-util-to-jsx-runtime: 2.3.0 html-url-attributes: 3.0.0 diff --git a/webapp/start-fe-pnpm-workspace-dev.bat b/webapp/start-fe-pnpm-workspace-dev.bat new file mode 100644 index 000000000..4fe9129b2 --- /dev/null +++ b/webapp/start-fe-pnpm-workspace-dev.bat @@ -0,0 +1,39 @@ +@echo off + +for /f "delims=" %%i in ('node -v') do set "node_version=%%i" + +for /f "tokens=2 delims=v." %%i in ("%node_version%") do set "major_version=%%i" + +if %major_version% GEQ 17 ( + set "NODE_OPTIONS=--openssl-legacy-provider" + echo Node.js version is greater than or equal to 17. NODE_OPTIONS has been set to --openssl-legacy-provider. +) +where /q pnpm +if errorlevel 1 ( + echo pnpm is not installed. Installing... + npm install -g pnpm + if errorlevel 1 ( + echo Failed to install pnpm. Please check if npm is installed and the network connection is working. + ) else ( + echo pnpm installed successfully. + ) +) else ( + echo pnpm is already installed. +) + +rmdir /s /q ".\packages\supersonic-fe\src\.umi" +rmdir /s /q ".\packages\supersonic-fe\src\.umi-production" + +cd ./packages/chat-sdk + +call pnpm i + +call pnpm run build + +call npm run watch:bg + +cd ../supersonic-fe + +call pnpm i + +call npm run start \ No newline at end of file diff --git a/webapp/start-fe-pnpm-workspace-dev.sh b/webapp/start-fe-pnpm-workspace-dev.sh new file mode 100755 index 000000000..adebe227f --- /dev/null +++ b/webapp/start-fe-pnpm-workspace-dev.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +node_version=$(node -v) + +major_version=$(echo $node_version | cut -d'.' -f1 | tr -d 'v') + +if [ $major_version -ge 17 ]; then + export NODE_OPTIONS=--openssl-legacy-provider +fi + +if ! command -v pnpm >/dev/null 2>&1; then + npm i -g pnpm +fi + +rm -rf ./packages/supersonic-fe/src/.umi ./packages/supersonic-fe/src/.umi-production + +cd ./packages/chat-sdk + +pnpm i + +npm run watch:bg + +cd ../supersonic-fe + +pnpm i + +npm run start