tasks.json 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {
  2. "version": "2.0.0",
  3. "tasks": [
  4. {
  5. "label": "启动前端开发服务器",
  6. "type": "shell",
  7. "command": "npm",
  8. "args": ["start"],
  9. "options": {
  10. "cwd": "${workspaceFolder}/frontend"
  11. },
  12. "group": {
  13. "kind": "build",
  14. "isDefault": false
  15. },
  16. "presentation": {
  17. "echo": true,
  18. "reveal": "always",
  19. "focus": false,
  20. "panel": "new",
  21. "showReuseMessage": true,
  22. "clear": false
  23. },
  24. "isBackground": true,
  25. "problemMatcher": {
  26. "owner": "webpack",
  27. "source": "webpack",
  28. "fileLocation": "relative",
  29. "pattern": {
  30. "regexp": "ERROR in (.*)",
  31. "file": 1
  32. },
  33. "background": {
  34. "activeOnStart": true,
  35. "beginsPattern": ".*webpack.*",
  36. "endsPattern": ".*compiled.*"
  37. }
  38. }
  39. },
  40. {
  41. "label": "构建前端",
  42. "type": "shell",
  43. "command": "npm",
  44. "args": ["run", "build"],
  45. "options": {
  46. "cwd": "${workspaceFolder}/frontend"
  47. },
  48. "group": {
  49. "kind": "build",
  50. "isDefault": true
  51. },
  52. "presentation": {
  53. "echo": true,
  54. "reveal": "always",
  55. "focus": false,
  56. "panel": "shared",
  57. "showReuseMessage": true,
  58. "clear": false
  59. }
  60. },
  61. {
  62. "label": "复制前端构建到后端",
  63. "type": "shell",
  64. "command": "python",
  65. "args": [
  66. "-c",
  67. "import shutil; shutil.copytree('frontend/build', 'backend/static', dirs_exist_ok=True); print('前端构建文件已复制到backend/static')"
  68. ],
  69. "options": {
  70. "cwd": "${workspaceFolder}"
  71. },
  72. "group": "build",
  73. "dependsOn": "构建前端"
  74. },
  75. {
  76. "label": "完整构建流程",
  77. "dependsOrder": "sequence",
  78. "dependsOn": [
  79. "构建前端",
  80. "复制前端构建到后端"
  81. ]
  82. }
  83. ]
  84. }