@coze-arch/cli 0.1.3-alpha.6f25e6 → 0.1.3-alpha.cb26ca

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +3 -3
  2. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +3 -3
  3. package/lib/__templates__/nextjs/package.json +6 -1
  4. package/lib/__templates__/nextjs/pnpm-lock.yaml +59 -54
  5. package/lib/__templates__/nextjs/scripts/build.sh +1 -1
  6. package/lib/__templates__/nextjs/scripts/dev.sh +0 -2
  7. package/lib/__templates__/nextjs/scripts/prepare.sh +4 -1
  8. package/lib/__templates__/nextjs/src/server.ts +1 -1
  9. package/lib/__templates__/nextjs/template.config.js +59 -0
  10. package/lib/__templates__/nuxt-vue/scripts/build.sh +1 -1
  11. package/lib/__templates__/nuxt-vue/scripts/dev.sh +0 -2
  12. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +4 -1
  13. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +2 -3
  14. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +0 -3
  15. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +1 -3
  16. package/lib/__templates__/vite/scripts/build.sh +1 -1
  17. package/lib/__templates__/vite/scripts/dev.sh +0 -2
  18. package/lib/__templates__/vite/scripts/prepare.sh +4 -1
  19. package/lib/__templates__/vite/template.config.js +59 -0
  20. package/lib/cli.js +12 -34
  21. package/package.json +1 -1
  22. package/lib/__templates__/expo/.cozeproj/scripts/prepare-node-modules.sh +0 -142
  23. package/lib/__templates__/nextjs/scripts/prepare-node-modules.sh +0 -142
  24. package/lib/__templates__/nuxt-vue/scripts/prepare-node-modules.sh +0 -142
  25. package/lib/__templates__/taro/.cozeproj/scripts/prepare-node-modules.sh +0 -142
  26. package/lib/__templates__/vite/scripts/prepare-node-modules.sh +0 -142
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash
2
2
  if [ -z "${BASH_VERSION:-}" ]; then exec /usr/bin/env bash "$0" "$@"; fi
3
3
  set -euo pipefail
4
- ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
4
+ ROOT_DIR="$(pwd)"
5
5
  PREVIEW_DIR="/source/preview"
6
6
  SOURCE_DIR="/source"
7
7
 
@@ -34,8 +34,8 @@ echo "==================== 安装项目依赖 ===================="
34
34
  if [ ! -f "package.json" ]; then
35
35
  echo "项目目录下无 package.json,不是合法的 Node.js 项目"
36
36
  fi
37
- # 步骤 2.1/2.2:通过受管入口安装项目依赖
38
- bash "$ROOT_DIR/.cozeproj/scripts/prepare-node-modules.sh" --registry=https://registry.npmmirror.com
37
+ # 步骤 2.1/2.2:安装项目依赖
38
+ pnpm install --registry=https://registry.npmmirror.com || echo "Expo 项目依赖安装失败(pnpm 执行出错)"
39
39
 
40
40
  echo "检查根目录 post_install.py"
41
41
  if [ -f "$PREVIEW_DIR/post_install.py" ]; then
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash
2
2
  if [ -z "${BASH_VERSION:-}" ]; then exec /usr/bin/env bash "$0" "$@"; fi
3
3
  set -euo pipefail
4
- ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
4
+ ROOT_DIR="$(pwd)"
5
5
 
6
6
  # ==================== 工具函数 ====================
7
7
  info() {
@@ -32,8 +32,8 @@ info "==================== 安装 Node 依赖 ===================="
32
32
  info "开始安装 Node 依赖"
33
33
  if [ -f "$ROOT_DIR/package.json" ]; then
34
34
  info "进入目录:$ROOT_DIR"
35
- info "正在执行受管依赖准备入口"
36
- bash "$ROOT_DIR/.cozeproj/scripts/prepare-node-modules.sh" --registry=https://registry.npmmirror.com || error "Node 依赖安装失败"
35
+ info "正在执行:pnpm install"
36
+ (cd "$ROOT_DIR" && pnpm install --registry=https://registry.npmmirror.com) || error "Node 依赖安装失败"
37
37
  else
38
38
  warn "未找到 $ROOT_DIR/package.json 文件,请检查路径是否正确"
39
39
  fi
@@ -56,7 +56,7 @@
56
56
  "embla-carousel-react": "^8.6.0",
57
57
  "input-otp": "^1.4.2",
58
58
  "lucide-react": "^0.468.0",
59
- "next": "16.3.3",
59
+ "next": "16.1.1",
60
60
  "next-themes": "^0.4.6",
61
61
  "pg": "^8.16.3",
62
62
  "react": "19.2.3",
@@ -95,5 +95,10 @@
95
95
  "packageManager": "pnpm@9.0.0",
96
96
  "engines": {
97
97
  "pnpm": ">=9.0.0"
98
+ },
99
+ "pnpm": {
100
+ "overrides": {
101
+ "sharp": "0.35.3"
102
+ }
98
103
  }
99
104
  }
@@ -4,6 +4,9 @@ settings:
4
4
  autoInstallPeers: true
5
5
  excludeLinksFromLockfile: false
6
6
 
7
+ overrides:
8
+ sharp: 0.35.3
9
+
7
10
  importers:
8
11
 
9
12
  .:
@@ -135,8 +138,8 @@ importers:
135
138
  specifier: ^0.468.0
136
139
  version: 0.468.0(react@19.2.3)
137
140
  next:
138
- specifier: 16.3.3
139
- version: 16.3.3(@babel/core@7.28.6)(@types/node@20.19.30)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
141
+ specifier: 16.1.1
142
+ version: 16.1.1(@babel/core@7.28.6)(@types/node@20.19.30)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
140
143
  next-themes:
141
144
  specifier: ^0.4.6
142
145
  version: 0.4.6(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
@@ -1431,60 +1434,56 @@ packages:
1431
1434
  '@napi-rs/wasm-runtime@0.2.12':
1432
1435
  resolution: {integrity: sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==}
1433
1436
 
1434
- '@next/env@16.3.3':
1435
- resolution: {integrity: sha512-U2eYQRwXj+dsqxV79zFqExDdatnNY/ZWc2nsJU1p/OgT7fd3dXwlF6OjYaFQCfMoeTA19PWq+wVmYgimVA+V+g==}
1437
+ '@next/env@16.1.1':
1438
+ resolution: {integrity: sha512-3oxyM97Sr2PqiVyMyrZUtrtM3jqqFxOQJVuKclDsgj/L728iZt/GyslkN4NwarledZATCenbk4Offjk1hQmaAA==}
1436
1439
 
1437
1440
  '@next/eslint-plugin-next@16.3.3':
1438
1441
  resolution: {integrity: sha512-pbEh30vvjKpDoTAmo1v3q2uM4JUi8QaEBpbmjWvGfoec2jLghy/WNtvzAT0bk+Ik9oz6etjt4YjXEk4BQnicCw==}
1439
1442
 
1440
- '@next/swc-darwin-arm64@16.3.3':
1441
- resolution: {integrity: sha512-8Hiv32QJPwdV6KYJ8meR9SBA061tQqnIKTJDocvOXlEQqib0xMFpzArosuffFUUc0sslbh7QQ8a3Yey1QV8EIw==}
1443
+ '@next/swc-darwin-arm64@16.1.1':
1444
+ resolution: {integrity: sha512-JS3m42ifsVSJjSTzh27nW+Igfha3NdBOFScr9C80hHGrWx55pTrVL23RJbqir7k7/15SKlrLHhh/MQzqBBYrQA==}
1442
1445
  engines: {node: '>= 10'}
1443
1446
  cpu: [arm64]
1444
1447
  os: [darwin]
1445
1448
 
1446
- '@next/swc-darwin-x64@16.3.3':
1447
- resolution: {integrity: sha512-A1lgKgwVchRYmSe467zdwhxT9040dd8lH+o65sL5Jet8fjB4kegw/rDyPIpYVRb6jAqwXFOJpjIXJLxQKLiE3A==}
1449
+ '@next/swc-darwin-x64@16.1.1':
1450
+ resolution: {integrity: sha512-hbyKtrDGUkgkyQi1m1IyD3q4I/3m9ngr+V93z4oKHrPcmxwNL5iMWORvLSGAf2YujL+6HxgVvZuCYZfLfb4bGw==}
1448
1451
  engines: {node: '>= 10'}
1449
1452
  cpu: [x64]
1450
1453
  os: [darwin]
1451
1454
 
1452
- '@next/swc-linux-arm64-gnu@16.3.3':
1453
- resolution: {integrity: sha512-bf0FIssMFueU2dm7vQEWWxk0c8UjKTdW0yzuh0sQsD8pf1+KCLDdaqhYZNMYGmXwEOiHAUzgBKudovIlcvvBjg==}
1455
+ '@next/swc-linux-arm64-gnu@16.1.1':
1456
+ resolution: {integrity: sha512-/fvHet+EYckFvRLQ0jPHJCUI5/B56+2DpI1xDSvi80r/3Ez+Eaa2Yq4tJcRTaB1kqj/HrYKn8Yplm9bNoMJpwQ==}
1454
1457
  engines: {node: '>= 10'}
1455
1458
  cpu: [arm64]
1456
1459
  os: [linux]
1457
- libc: [glibc]
1458
1460
 
1459
- '@next/swc-linux-arm64-musl@16.3.3':
1460
- resolution: {integrity: sha512-W7viwCk9JY/cAkdz/A273rd5bb3RgT/IHwR7Upv90tunjBWNtAAhGhoecHh+teRNRSinuAFmE+l7fwZ4YKkrXg==}
1461
+ '@next/swc-linux-arm64-musl@16.1.1':
1462
+ resolution: {integrity: sha512-MFHrgL4TXNQbBPzkKKur4Fb5ICEJa87HM7fczFs2+HWblM7mMLdco3dvyTI+QmLBU9xgns/EeeINSZD6Ar+oLg==}
1461
1463
  engines: {node: '>= 10'}
1462
1464
  cpu: [arm64]
1463
1465
  os: [linux]
1464
- libc: [musl]
1465
1466
 
1466
- '@next/swc-linux-x64-gnu@16.3.3':
1467
- resolution: {integrity: sha512-0W46zw1N3ODpI6n0GeivHvvob1pooozgZVqy65k0mh4/7vr+FbY9+WpHzNVXjHipJf/A3FDheBG19H1s5A25rA==}
1467
+ '@next/swc-linux-x64-gnu@16.1.1':
1468
+ resolution: {integrity: sha512-20bYDfgOQAPUkkKBnyP9PTuHiJGM7HzNBbuqmD0jiFVZ0aOldz+VnJhbxzjcSabYsnNjMPsE0cyzEudpYxsrUQ==}
1468
1469
  engines: {node: '>= 10'}
1469
1470
  cpu: [x64]
1470
1471
  os: [linux]
1471
- libc: [glibc]
1472
1472
 
1473
- '@next/swc-linux-x64-musl@16.3.3':
1474
- resolution: {integrity: sha512-H4mBso8ZTMBPtdT0PN0pBx2ayTvQuTuvS6qT13d77yVFJXAPCxkyIhLTmdMaGTJs0krQYI/qpzdHijCeihXhbg==}
1473
+ '@next/swc-linux-x64-musl@16.1.1':
1474
+ resolution: {integrity: sha512-9pRbK3M4asAHQRkwaXwu601oPZHghuSC8IXNENgbBSyImHv/zY4K5udBusgdHkvJ/Tcr96jJwQYOll0qU8+fPA==}
1475
1475
  engines: {node: '>= 10'}
1476
1476
  cpu: [x64]
1477
1477
  os: [linux]
1478
- libc: [musl]
1479
1478
 
1480
- '@next/swc-win32-arm64-msvc@16.3.3':
1481
- resolution: {integrity: sha512-cTMUJpcEGmeywofCUfhR+rSsoE33+rVPnPEYNTNdLNlsOeEg/vktOsKUSTb28vUGqD2jkm4Zaskcwn7OCI6FQg==}
1479
+ '@next/swc-win32-arm64-msvc@16.1.1':
1480
+ resolution: {integrity: sha512-bdfQkggaLgnmYrFkSQfsHfOhk/mCYmjnrbRCGgkMcoOBZ4n+TRRSLmT/CU5SATzlBJ9TpioUyBW/vWFXTqQRiA==}
1482
1481
  engines: {node: '>= 10'}
1483
1482
  cpu: [arm64]
1484
1483
  os: [win32]
1485
1484
 
1486
- '@next/swc-win32-x64-msvc@16.3.3':
1487
- resolution: {integrity: sha512-2VR4cTBzHXaBjnGsuH6GyJjENzQOmHeAh11uY1iUhjm3j5dEUrVJuUj+VL78jaGi/Dik8xS76zEj18BsFhlVZQ==}
1485
+ '@next/swc-win32-x64-msvc@16.1.1':
1486
+ resolution: {integrity: sha512-Ncwbw2WJ57Al5OX0k4chM68DKhEPlrXBaSXDCi2kPi5f4d8b3ejr3RRJGfKBLrn2YJL5ezNS7w2TZLHSti8CMw==}
1488
1487
  engines: {node: '>= 10'}
1489
1488
  cpu: [x64]
1490
1489
  os: [win32]
@@ -2580,8 +2579,8 @@ packages:
2580
2579
  resolution: {integrity: sha512-Fukw1cUTQ6xdLiHDJhKKPu6svEPaCEDvThqCne3OaQyZvuq2qjhJAd91kJu3PXLG18aooCgYBaB6qQz35hhABg==}
2581
2580
  engines: {node: '>=20.0.0'}
2582
2581
 
2583
- '@swc/helpers@0.5.23':
2584
- resolution: {integrity: sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==}
2582
+ '@swc/helpers@0.5.15':
2583
+ resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}
2585
2584
 
2586
2585
  '@tailwindcss/node@4.1.18':
2587
2586
  resolution: {integrity: sha512-DoR7U1P7iYhw16qJ49fgXUlry1t4CpXeErJHnQ44JgTSKMaZUdf17cfn5mHchfJ4KRBZRFA/Coo+MUF5+gOaCQ==}
@@ -3163,6 +3162,10 @@ packages:
3163
3162
  engines: {node: '>=6.0.0'}
3164
3163
  hasBin: true
3165
3164
 
3165
+ baseline-browser-mapping@2.9.18:
3166
+ resolution: {integrity: sha512-e23vBV1ZLfjb9apvfPk4rHVu2ry6RIr2Wfs+O324okSidrX7pTAnEJPCh/O5BtRlr7QtZI7ktOP3vsqr7Z5XoA==}
3167
+ hasBin: true
3168
+
3166
3169
  binary-extensions@2.3.0:
3167
3170
  resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
3168
3171
  engines: {node: '>=8'}
@@ -4955,8 +4958,8 @@ packages:
4955
4958
  react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc
4956
4959
  react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc
4957
4960
 
4958
- next@16.3.3:
4959
- resolution: {integrity: sha512-tuRTx1nQ/yVw83cwJBo9F+njGUgMn3UHQycreWHB8XsStvvAh1AthbI8/4IpKnFaF58F+iSiHejYOlMQ/eq83g==}
4961
+ next@16.1.1:
4962
+ resolution: {integrity: sha512-QI+T7xrxt1pF6SQ/JYFz95ro/mg/1Znk5vBebsWwbpejj1T0A23hO7GYEaVac9QUOT2BIMiuzm0L99ooq7k0/w==}
4960
4963
  engines: {node: '>=20.9.0'}
4961
4964
  hasBin: true
4962
4965
  peerDependencies:
@@ -5281,8 +5284,8 @@ packages:
5281
5284
  postcss-value-parser@4.2.0:
5282
5285
  resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==}
5283
5286
 
5284
- postcss@8.5.23:
5285
- resolution: {integrity: sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg==}
5287
+ postcss@8.4.31:
5288
+ resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==}
5286
5289
  engines: {node: ^10 || ^12 || >=14}
5287
5290
 
5288
5291
  postcss@8.5.6:
@@ -7626,7 +7629,7 @@ snapshots:
7626
7629
  '@tybys/wasm-util': 0.10.1
7627
7630
  optional: true
7628
7631
 
7629
- '@next/env@16.3.3': {}
7632
+ '@next/env@16.1.1': {}
7630
7633
 
7631
7634
  '@next/eslint-plugin-next@16.3.3(eslint@9.39.2(jiti@2.6.1))':
7632
7635
  dependencies:
@@ -7635,28 +7638,28 @@ snapshots:
7635
7638
  transitivePeerDependencies:
7636
7639
  - eslint
7637
7640
 
7638
- '@next/swc-darwin-arm64@16.3.3':
7641
+ '@next/swc-darwin-arm64@16.1.1':
7639
7642
  optional: true
7640
7643
 
7641
- '@next/swc-darwin-x64@16.3.3':
7644
+ '@next/swc-darwin-x64@16.1.1':
7642
7645
  optional: true
7643
7646
 
7644
- '@next/swc-linux-arm64-gnu@16.3.3':
7647
+ '@next/swc-linux-arm64-gnu@16.1.1':
7645
7648
  optional: true
7646
7649
 
7647
- '@next/swc-linux-arm64-musl@16.3.3':
7650
+ '@next/swc-linux-arm64-musl@16.1.1':
7648
7651
  optional: true
7649
7652
 
7650
- '@next/swc-linux-x64-gnu@16.3.3':
7653
+ '@next/swc-linux-x64-gnu@16.1.1':
7651
7654
  optional: true
7652
7655
 
7653
- '@next/swc-linux-x64-musl@16.3.3':
7656
+ '@next/swc-linux-x64-musl@16.1.1':
7654
7657
  optional: true
7655
7658
 
7656
- '@next/swc-win32-arm64-msvc@16.3.3':
7659
+ '@next/swc-win32-arm64-msvc@16.1.1':
7657
7660
  optional: true
7658
7661
 
7659
- '@next/swc-win32-x64-msvc@16.3.3':
7662
+ '@next/swc-win32-x64-msvc@16.1.1':
7660
7663
  optional: true
7661
7664
 
7662
7665
  '@noble/ciphers@1.3.0': {}
@@ -8876,7 +8879,7 @@ snapshots:
8876
8879
  - bufferutil
8877
8880
  - utf-8-validate
8878
8881
 
8879
- '@swc/helpers@0.5.23':
8882
+ '@swc/helpers@0.5.15':
8880
8883
  dependencies:
8881
8884
  tslib: 2.8.1
8882
8885
 
@@ -9452,6 +9455,8 @@ snapshots:
9452
9455
 
9453
9456
  baseline-browser-mapping@2.11.19: {}
9454
9457
 
9458
+ baseline-browser-mapping@2.9.18: {}
9459
+
9455
9460
  binary-extensions@2.3.0: {}
9456
9461
 
9457
9462
  body-parser@2.2.2:
@@ -9485,7 +9490,7 @@ snapshots:
9485
9490
 
9486
9491
  browserslist@4.28.1:
9487
9492
  dependencies:
9488
- baseline-browser-mapping: 2.11.19
9493
+ baseline-browser-mapping: 2.9.18
9489
9494
  caniuse-lite: 1.0.30001766
9490
9495
  electron-to-chromium: 1.5.279
9491
9496
  node-releases: 2.0.27
@@ -11279,25 +11284,25 @@ snapshots:
11279
11284
  react: 19.2.3
11280
11285
  react-dom: 19.2.3(react@19.2.3)
11281
11286
 
11282
- next@16.3.3(@babel/core@7.28.6)(@types/node@20.19.30)(react-dom@19.2.3(react@19.2.3))(react@19.2.3):
11287
+ next@16.1.1(@babel/core@7.28.6)(@types/node@20.19.30)(react-dom@19.2.3(react@19.2.3))(react@19.2.3):
11283
11288
  dependencies:
11284
- '@next/env': 16.3.3
11285
- '@swc/helpers': 0.5.23
11289
+ '@next/env': 16.1.1
11290
+ '@swc/helpers': 0.5.15
11286
11291
  baseline-browser-mapping: 2.11.19
11287
11292
  caniuse-lite: 1.0.30001766
11288
- postcss: 8.5.23
11293
+ postcss: 8.4.31
11289
11294
  react: 19.2.3
11290
11295
  react-dom: 19.2.3(react@19.2.3)
11291
11296
  styled-jsx: 5.1.6(@babel/core@7.28.6)(react@19.2.3)
11292
11297
  optionalDependencies:
11293
- '@next/swc-darwin-arm64': 16.3.3
11294
- '@next/swc-darwin-x64': 16.3.3
11295
- '@next/swc-linux-arm64-gnu': 16.3.3
11296
- '@next/swc-linux-arm64-musl': 16.3.3
11297
- '@next/swc-linux-x64-gnu': 16.3.3
11298
- '@next/swc-linux-x64-musl': 16.3.3
11299
- '@next/swc-win32-arm64-msvc': 16.3.3
11300
- '@next/swc-win32-x64-msvc': 16.3.3
11298
+ '@next/swc-darwin-arm64': 16.1.1
11299
+ '@next/swc-darwin-x64': 16.1.1
11300
+ '@next/swc-linux-arm64-gnu': 16.1.1
11301
+ '@next/swc-linux-arm64-musl': 16.1.1
11302
+ '@next/swc-linux-x64-gnu': 16.1.1
11303
+ '@next/swc-linux-x64-musl': 16.1.1
11304
+ '@next/swc-win32-arm64-msvc': 16.1.1
11305
+ '@next/swc-win32-x64-msvc': 16.1.1
11301
11306
  sharp: 0.35.3(@types/node@20.19.30)
11302
11307
  transitivePeerDependencies:
11303
11308
  - '@babel/core'
@@ -11587,7 +11592,7 @@ snapshots:
11587
11592
 
11588
11593
  postcss-value-parser@4.2.0: {}
11589
11594
 
11590
- postcss@8.5.23:
11595
+ postcss@8.4.31:
11591
11596
  dependencies:
11592
11597
  nanoid: 3.3.18
11593
11598
  picocolors: 1.1.1
@@ -6,7 +6,7 @@ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
6
6
  cd "${COZE_WORKSPACE_PATH}"
7
7
 
8
8
  echo "Installing dependencies..."
9
- bash "$COZE_WORKSPACE_PATH/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
9
+ pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
10
 
11
11
  echo "Building the Next.js project..."
12
12
  pnpm next build
@@ -77,7 +77,6 @@ shift
77
77
  child_pid=$!
78
78
 
79
79
  # 先忽略 TERM,才能在向整组发 TERM(自己也在组里)之后存活下来补一发 KILL。
80
- if [[ -z "${COZE_EVAL:-}" ]]; then
81
80
  ( trap "" TERM
82
81
  sleep "${timeout_seconds}"
83
82
  echo "[dev] 后台进程运行超过 ${timeout_seconds}s,回收进程组 $$。"
@@ -85,7 +84,6 @@ if [[ -z "${COZE_EVAL:-}" ]]; then
85
84
  sleep 5
86
85
  kill -KILL -- "-$$" 2>/dev/null || true
87
86
  ) &
88
- fi
89
87
 
90
88
  wait "${child_pid}"
91
89
  kill -KILL -- "-$$" 2>/dev/null || true
@@ -6,4 +6,7 @@ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
6
6
  cd "${COZE_WORKSPACE_PATH}"
7
7
 
8
8
  echo "Installing dependencies..."
9
- bash "$COZE_WORKSPACE_PATH/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
9
+ pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
+ if command -v coze-dev > /dev/null 2>&1 && coze-dev check-bins --help > /dev/null 2>&1; then
11
+ coze-dev check-bins --fix
12
+ fi
@@ -7,7 +7,7 @@ const hostname = process.env.HOSTNAME || 'localhost';
7
7
  const port = parseInt(process.env.PORT || '<%= port %>', 10);
8
8
 
9
9
  // Create Next.js app
10
- const app = next({ dev, hostname, port, webpack: true });
10
+ const app = next({ dev, hostname, port });
11
11
  const handle = app.getRequestHandler();
12
12
 
13
13
  app.prepare().then(() => {
@@ -1,5 +1,9 @@
1
1
 
2
2
 
3
+ import { spawn } from 'child_process';
4
+ import { resolve, join, basename } from 'path';
5
+ import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
6
+ import { homedir } from 'os';
3
7
 
4
8
 
5
9
 
@@ -53,6 +57,61 @@ const config = {
53
57
  onAfterRender: async (_context, _outputPath) => {
54
58
  // 输出由 init 命令统一处理
55
59
  },
60
+
61
+ onComplete: async (_context, outputPath) => {
62
+ // Skip pnpm update in test environment to avoid monorepo workspace issues
63
+ if (process.env.NODE_ENV === 'test') {
64
+ console.log('⊘ Skipping dependency update in test environment');
65
+ return;
66
+ }
67
+
68
+ const cmd = 'pnpm';
69
+ const args = ['update', 'coze-coding-dev-sdk@^0.7.25'];
70
+ console.log(
71
+ `\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
72
+ );
73
+
74
+ try {
75
+ const projectRoot = resolve(outputPath);
76
+
77
+ // Determine log directory
78
+ const cozeHome = process.env.COZE_HOME || join(homedir(), '.coze');
79
+ const logDir = process.env.COZE_LOG_DIR || join(cozeHome, 'logs');
80
+ mkdirSync(logDir, { recursive: true });
81
+
82
+ // Use project name in log file to avoid conflicts
83
+ const projectName = basename(projectRoot);
84
+ const logFile = join(logDir, `${projectName}-init.log`);
85
+
86
+ // Write log header
87
+ const timestamp = new Date().toISOString();
88
+ appendFileSync(
89
+ logFile,
90
+ `\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
91
+ );
92
+
93
+ // Open log file for appending
94
+ const logFd = openSync(logFile, 'a');
95
+
96
+ // Spawn in detached mode
97
+ const child = spawn(cmd, args, {
98
+ cwd: projectRoot,
99
+ detached: true,
100
+ stdio: ['ignore', logFd, logFd],
101
+ });
102
+
103
+ child.unref();
104
+ closeSync(logFd);
105
+
106
+ console.log(
107
+ '✓ coze-coding-dev-sdk update triggered (running in background)',
108
+ );
109
+ console.log(` Log file: ${logFile}`);
110
+ } catch (error) {
111
+ console.error('✗ Failed to trigger coze-coding-dev-sdk update:', error);
112
+ console.log(' You can manually run: pnpm update coze-coding-dev-sdk');
113
+ }
114
+ },
56
115
  };
57
116
 
58
117
  export default config;
@@ -6,7 +6,7 @@ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
6
6
  cd "${COZE_WORKSPACE_PATH}"
7
7
 
8
8
  echo "Installing dependencies..."
9
- bash "$COZE_WORKSPACE_PATH/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
9
+ pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
10
 
11
11
  echo "Building the Nuxt.js project..."
12
12
  pnpm nuxt build
@@ -77,7 +77,6 @@ shift
77
77
  child_pid=$!
78
78
 
79
79
  # 先忽略 TERM,才能在向整组发 TERM(自己也在组里)之后存活下来补一发 KILL。
80
- if [[ -z "${COZE_EVAL:-}" ]]; then
81
80
  ( trap "" TERM
82
81
  sleep "${timeout_seconds}"
83
82
  echo "[dev] 后台进程运行超过 ${timeout_seconds}s,回收进程组 $$。"
@@ -85,7 +84,6 @@ if [[ -z "${COZE_EVAL:-}" ]]; then
85
84
  sleep 5
86
85
  kill -KILL -- "-$$" 2>/dev/null || true
87
86
  ) &
88
- fi
89
87
 
90
88
  wait "${child_pid}"
91
89
  kill -KILL -- "-$$" 2>/dev/null || true
@@ -6,7 +6,10 @@ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
6
6
  cd "${COZE_WORKSPACE_PATH}"
7
7
 
8
8
  echo "Installing dependencies..."
9
- bash "$COZE_WORKSPACE_PATH/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline
9
+ pnpm install --prefer-frozen-lockfile --prefer-offline
10
+ if command -v coze-dev > /dev/null 2>&1 && coze-dev check-bins --help > /dev/null 2>&1; then
11
+ coze-dev check-bins --fix
12
+ fi
10
13
 
11
14
  echo "Preparing Nuxt project..."
12
15
  pnpm exec nuxt prepare
@@ -1,8 +1,7 @@
1
1
  #!/bin/bash
2
2
  set -Eeuo pipefail
3
3
 
4
- ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
5
- cd "$ROOT_DIR"
4
+ cd "${COZE_WORKSPACE_PATH}"
6
5
  if [ -f "./.cozeproj/scripts/init_env.sh" ]; then
7
6
  echo "⚙️ Initializing environment..."
8
7
  # 使用 bash 执行,确保即使没有 x 权限也能跑
@@ -12,7 +11,7 @@ else
12
11
  fi
13
12
  echo "Installing dependencies..."
14
13
  # 安装所有依赖(包含 Taro 核心和 React)
15
- bash "$ROOT_DIR/.cozeproj/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline
14
+ pnpm install
16
15
 
17
16
  echo "Building the Taro project..."
18
17
  pnpm build
@@ -1,5 +1,2 @@
1
1
  #!/bin/bash
2
2
  set -Eeuo pipefail
3
-
4
- ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
5
- bash "$ROOT_DIR/.cozeproj/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline
@@ -43,7 +43,6 @@ shift
43
43
  child_pid=$!
44
44
 
45
45
  # 先忽略 TERM,才能在向整组发 TERM(自己也在组里)之后存活下来补一发 KILL。
46
- if [[ -z "${COZE_EVAL:-}" ]]; then
47
46
  ( trap "" TERM
48
47
  sleep "${timeout_seconds}"
49
48
  echo "[dev] 后台进程运行超过 ${timeout_seconds}s,回收进程组 $$。"
@@ -51,7 +50,6 @@ if [[ -z "${COZE_EVAL:-}" ]]; then
51
50
  sleep 5
52
51
  kill -KILL -- "-$$" 2>/dev/null || true
53
52
  ) &
54
- fi
55
53
 
56
54
  wait "${child_pid}"
57
55
  kill -KILL -- "-$$" 2>/dev/null || true
@@ -196,7 +194,7 @@ cleanup_previous_run() {
196
194
  # ---------------------------------------------------------
197
195
  echo "📦 Installing dependencies..."
198
196
  PNPM_BIN="$(command -v pnpm)"
199
- bash "$ROOT_DIR/.cozeproj/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline
197
+ "${PNPM_BIN}" install
200
198
  echo "✅ Dependencies installed successfully!"
201
199
 
202
200
  # ---------------------------------------------------------
@@ -6,7 +6,7 @@ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
6
6
  cd "${COZE_WORKSPACE_PATH}"
7
7
 
8
8
  echo "Installing dependencies..."
9
- bash "$COZE_WORKSPACE_PATH/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
9
+ pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
10
 
11
11
  echo "Building frontend with Vite..."
12
12
  pnpm vite build
@@ -57,7 +57,6 @@ shift
57
57
  child_pid=$!
58
58
 
59
59
  # 先忽略 TERM,才能在向整组发 TERM(自己也在组里)之后存活下来补一发 KILL。
60
- if [[ -z "${COZE_EVAL:-}" ]]; then
61
60
  ( trap "" TERM
62
61
  sleep "${timeout_seconds}"
63
62
  echo "[dev] 后台进程运行超过 ${timeout_seconds}s,回收进程组 $$。"
@@ -65,7 +64,6 @@ if [[ -z "${COZE_EVAL:-}" ]]; then
65
64
  sleep 5
66
65
  kill -KILL -- "-$$" 2>/dev/null || true
67
66
  ) &
68
- fi
69
67
 
70
68
  wait "${child_pid}"
71
69
  kill -KILL -- "-$$" 2>/dev/null || true
@@ -6,4 +6,7 @@ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
6
6
  cd "${COZE_WORKSPACE_PATH}"
7
7
 
8
8
  echo "Installing dependencies..."
9
- bash "$COZE_WORKSPACE_PATH/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
9
+ pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
+ if command -v coze-dev > /dev/null 2>&1 && coze-dev check-bins --help > /dev/null 2>&1; then
11
+ coze-dev check-bins --fix
12
+ fi
@@ -1,4 +1,8 @@
1
1
 
2
+ import { spawn } from 'child_process';
3
+ import { resolve, join, basename } from 'path';
4
+ import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
5
+ import { homedir } from 'os';
2
6
 
3
7
 
4
8
 
@@ -60,6 +64,61 @@ const config = {
60
64
  onAfterRender: async (_context, _outputPath) => {
61
65
  // 输出由 init 命令统一处理
62
66
  },
67
+
68
+ onComplete: async (_context, outputPath) => {
69
+ // Skip pnpm update in test environment to avoid monorepo workspace issues
70
+ if (process.env.NODE_ENV === 'test') {
71
+ console.log('⊘ Skipping dependency update in test environment');
72
+ return;
73
+ }
74
+
75
+ const cmd = 'pnpm';
76
+ const args = ['update', 'coze-coding-dev-sdk@^0.7.25'];
77
+ console.log(
78
+ `\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
79
+ );
80
+
81
+ try {
82
+ const projectRoot = resolve(outputPath);
83
+
84
+ // Determine log directory
85
+ const cozeHome = process.env.COZE_HOME || join(homedir(), '.coze');
86
+ const logDir = process.env.COZE_LOG_DIR || join(cozeHome, 'logs');
87
+ mkdirSync(logDir, { recursive: true });
88
+
89
+ // Use project name in log file to avoid conflicts
90
+ const projectName = basename(projectRoot);
91
+ const logFile = join(logDir, `${projectName}-init.log`);
92
+
93
+ // Write log header
94
+ const timestamp = new Date().toISOString();
95
+ appendFileSync(
96
+ logFile,
97
+ `\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
98
+ );
99
+
100
+ // Open log file for appending
101
+ const logFd = openSync(logFile, 'a');
102
+
103
+ // Spawn in detached mode
104
+ const child = spawn(cmd, args, {
105
+ cwd: projectRoot,
106
+ detached: true,
107
+ stdio: ['ignore', logFd, logFd],
108
+ });
109
+
110
+ child.unref();
111
+ closeSync(logFd);
112
+
113
+ console.log(
114
+ '✓ coze-coding-dev-sdk update triggered (running in background)',
115
+ );
116
+ console.log(` Log file: ${logFile}`);
117
+ } catch (error) {
118
+ console.error('✗ Failed to trigger coze-coding-dev-sdk update:', error);
119
+ console.log(' You can manually run: pnpm update coze-coding-dev-sdk');
120
+ }
121
+ },
63
122
  };
64
123
 
65
124
  export default config;