diff --git a/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/package.json b/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/package.json index c9407fe6af..94be30eb2d 100644 --- a/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/package.json +++ b/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/package.json @@ -8,16 +8,17 @@ "packages/*" ], "scripts": { - "build:app": "cd packages/main && npm run build && cd ..", - "build:flow": "cd packages/spark-flow && npm run build && cd ..", + "build:app": "cd packages/main && npm run build", + "build:flow": "cd packages/spark-flow && npm run build", "build:subtree": "npm run clear", - "build:subtree:java": "npm run build:subtree && npm install && npm run build:flow && BACK_END=java npm run build:app", - "build:subtree:python": "npm run build:subtree && npm install && npm run build:flow && BACK_END=python npm run build:app", - "clear": "rm -rf node_modules && rm -rf packages/spark-flow/node_modules && rm -rf packages/main/node_modules && rm -rf packages/main/src/.umi", - "lint": "umi lint {packages/main/src,packages/spark-flow/src}/**/*.{ts,tsx,less} --fix", - "prepare": "husky install", + "build:subtree:java": "npm run build:subtree && npm install && npm run build:flow && cross-env BACK_END=java npm run build:app", + "build:subtree:python": "npm run build:subtree && npm install && npm run build:flow && cross-env BACK_END=python npm run build:app", + "clear": "npx rimraf node_modules && npx rimraf packages/spark-flow/node_modules && npx rimraf packages/main/node_modules && npx rimraf packages/main/src/.umi", + "lint": "umi lint \"{packages/main/src,packages/spark-flow/src}/**/*.{ts,tsx,less}\" --fix", + "prepare": "npx husky install", "re-install": "npm run clear && npm install && npm run build:flow", - "re-install:flow": "npm run build:flow && rm -rf packages/main/node_modules && npm install" + "re-install:flow": "npm run build:flow && npx rimraf packages/main/node_modules && npm install", + "dev": "cd packages/main && npm run dev" }, "lint-staged": { "*.{jsx,ts,tsx,css,less}": [ @@ -47,6 +48,7 @@ "devDependencies": { "@umijs/lint": "^4.4.11", "babel-jest": "^29.6.1", + "cross-env": "^7.0.3", "eslint": "^8", "husky": "^9.1.7", "jest": "^29.6.2", @@ -56,6 +58,7 @@ "prettier": "^3.0.0", "prettier-plugin-organize-imports": "^4.1.0", "prettier-plugin-packagejson": "^2.5.14", + "rimraf": "^5.0.5", "stylelint": "^14.16.1", "umi": "^4.4.11" } diff --git a/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/main/package.json b/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/main/package.json index 8d8472a6c0..1658e89f1a 100644 --- a/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/main/package.json +++ b/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/main/package.json @@ -2,8 +2,8 @@ "name": "main", "version": "0.0.1", "scripts": { - "build": "DID_YOU_KNOW=none umi build", - "dev": "DID_YOU_KNOW=none umi dev", + "build": "cross-env DID_YOU_KNOW=none umi build", + "dev": "cross-env DID_YOU_KNOW=none umi dev", "postinstall": "umi setup", "setup": "umi setup", "start": "npm run dev" diff --git a/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/spark-flow/package.json b/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/spark-flow/package.json index f7c9e77483..7940feb42c 100644 --- a/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/spark-flow/package.json +++ b/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/spark-flow/package.json @@ -9,7 +9,7 @@ ], "scripts": { "build:css": "tailwindcss -i ./tailwind.css -o ./dist/index.css --minify", - "build:copy": "cp ./tailwind.css ./dist/tailwind.css", + "build:copy": "node scripts/copy-file.js", "build:replace": "node -e \"const fs=require('fs'); const content=fs.readFileSync('./dist/index.js','utf8'); fs.writeFileSync('./dist/index.js', content.replace('../tailwind.css', './index.css'));\"", "build": "father build && npm run build:css && npm run build:copy && npm run build:replace", "build:watch": "father dev", diff --git a/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/spark-flow/scripts/copy-file.js b/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/spark-flow/scripts/copy-file.js new file mode 100644 index 0000000000..682e686a89 --- /dev/null +++ b/spring-ai-alibaba-studio/spring-ai-alibaba-studio-server/frontend/packages/spark-flow/scripts/copy-file.js @@ -0,0 +1,15 @@ +const fs = require('fs'); +const path = require('path'); + +const sourceFile = path.join(__dirname, '../tailwind.css'); +const destDir = path.join(__dirname, '../dist'); +const destFile = path.join(destDir, 'tailwind.css'); + +// 确保目标目录存在 +if (!fs.existsSync(destDir)) { + fs.mkdirSync(destDir, { recursive: true }); +} + +// 复制文件 +fs.copyFileSync(sourceFile, destFile); +console.log(`Copied ${sourceFile} to ${destFile}`); \ No newline at end of file