@coze-arch/cli 0.0.1-alpha.d85d9d → 0.0.1-alpha.de5a13

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 (41) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +13 -12
  2. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +9 -8
  3. package/lib/__templates__/expo/client/package.json +35 -35
  4. package/lib/__templates__/expo/client/screens/demo/index.tsx +3 -3
  5. package/lib/__templates__/expo/package.json +1 -1
  6. package/lib/__templates__/expo/patches/{expo@54.0.32.patch → expo@54.0.33.patch} +3 -2
  7. package/lib/__templates__/expo/pnpm-lock.yaml +336 -1735
  8. package/lib/__templates__/expo/server/package.json +9 -7
  9. package/lib/__templates__/expo/server/src/index.ts +1 -0
  10. package/lib/__templates__/expo/template.config.js +56 -0
  11. package/lib/__templates__/nextjs/.babelrc +0 -3
  12. package/lib/__templates__/nextjs/package.json +3 -1
  13. package/lib/__templates__/nextjs/pnpm-lock.yaml +116 -106
  14. package/lib/__templates__/nextjs/src/app/page.tsx +18 -60
  15. package/lib/__templates__/nextjs/template.config.js +49 -14
  16. package/lib/__templates__/taro/.coze +1 -1
  17. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +5 -6
  18. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +6 -8
  19. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +0 -15
  20. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +28 -5
  21. package/lib/__templates__/taro/_gitignore +40 -0
  22. package/lib/__templates__/taro/_npmrc +18 -0
  23. package/lib/__templates__/taro/config/index.ts +3 -2
  24. package/lib/__templates__/taro/eslint.config.mjs +57 -0
  25. package/lib/__templates__/taro/package.json +30 -32
  26. package/lib/__templates__/taro/pnpm-lock.yaml +466 -679
  27. package/lib/__templates__/taro/server/package.json +8 -7
  28. package/lib/__templates__/taro/server/src/main.ts +14 -2
  29. package/lib/__templates__/taro/src/app.css +29 -18
  30. package/lib/__templates__/taro/src/app.ts +11 -25
  31. package/lib/__templates__/taro/src/index.html +20 -1
  32. package/lib/__templates__/taro/src/pages/index/index.tsx +14 -11
  33. package/lib/__templates__/taro/src/utils/wx-debug.ts +23 -0
  34. package/lib/__templates__/vite/package.json +3 -1
  35. package/lib/__templates__/vite/pnpm-lock.yaml +142 -1659
  36. package/lib/__templates__/vite/src/main.ts +17 -47
  37. package/lib/__templates__/vite/template.config.js +49 -14
  38. package/lib/cli.js +42 -62
  39. package/package.json +1 -1
  40. package/lib/__templates__/taro/.eslintrc +0 -40
  41. package/lib/__templates__/taro/commitlint.config.mjs +0 -1
@@ -11,27 +11,28 @@
11
11
  "start:prod": "node dist/main"
12
12
  },
13
13
  "dependencies": {
14
+ "@aws-sdk/client-s3": "^3.958.0",
15
+ "@aws-sdk/lib-storage": "^3.958.0",
14
16
  "@nestjs/common": "^10.4.15",
15
17
  "@nestjs/core": "^10.4.15",
16
18
  "@nestjs/platform-express": "^10.4.15",
17
19
  "better-sqlite3": "^11.9.1",
18
- "@aws-sdk/client-s3": "^3.958.0",
19
- "@aws-sdk/lib-storage": "^3.958.0",
20
- "coze-coding-dev-sdk": "^0.7.3",
20
+ "coze-coding-dev-sdk": "^0.7.15",
21
21
  "drizzle-kit": "^0.31.8",
22
22
  "drizzle-orm": "^0.45.1",
23
23
  "drizzle-zod": "^0.8.3",
24
+ "express": "5.2.1",
24
25
  "pg": "^8.16.3",
25
- "zod": "^4.3.5",
26
- "rxjs": "^7.8.1"
26
+ "rxjs": "^7.8.1",
27
+ "zod": "^4.3.5"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@nestjs/cli": "^10.4.9",
30
31
  "@nestjs/schematics": "^10.2.3",
31
32
  "@types/better-sqlite3": "^7.6.13",
32
- "@types/express": "^5.0.0",
33
+ "@types/express": "5.0.6",
33
34
  "@types/node": "^22.10.2",
34
35
  "drizzle-kit": "^0.31.8",
35
36
  "typescript": "^5.7.2"
36
37
  }
37
- }
38
+ }
@@ -3,6 +3,18 @@ import { AppModule } from '@/app.module';
3
3
  import * as express from 'express';
4
4
  import { HttpStatusInterceptor } from '@/interceptors/http-status.interceptor';
5
5
 
6
+ function parsePort(): number {
7
+ const args = process.argv.slice(2);
8
+ const portIndex = args.indexOf('-p');
9
+ if (portIndex !== -1 && args[portIndex + 1]) {
10
+ const port = parseInt(args[portIndex + 1], 10);
11
+ if (!isNaN(port) && port > 0 && port < 65536) {
12
+ return port;
13
+ }
14
+ }
15
+ return <%= serverPort %>;
16
+ }
17
+
6
18
  async function bootstrap() {
7
19
  const app = await NestFactory.create(AppModule);
8
20
 
@@ -19,8 +31,8 @@ async function bootstrap() {
19
31
  // 1. 开启优雅关闭 Hooks (关键!)
20
32
  app.enableShutdownHooks();
21
33
 
22
- // 2. 增加错误处理,防止端口被占时直接崩溃,而是给出一个清晰的提示
23
- const port = <%= serverPort %>;
34
+ // 2. 解析端口
35
+ const port = parsePort();
24
36
  try {
25
37
  await app.listen(port);
26
38
  console.log(`Server running on http://localhost:${port}`);
@@ -2,51 +2,62 @@
2
2
 
3
3
  /*
4
4
  * H5 端 rem 适配:与小程序 rpx 缩放一致
5
- * 375px 屏幕:1rem = 16px,小程序 32rpx = 16px
5
+ * 375px 屏幕:1rem = 16px,小程序 32rpx = 16px
6
6
  */
7
7
  html {
8
- font-size: 4vw !important;
8
+ font-size: 4vw !important;
9
9
  }
10
10
 
11
11
  /* 小程序页面容器高度设置,确保垂直居中生效 */
12
12
  /* stylelint-disable-next-line selector-type-no-unknown */
13
13
  page {
14
- height: 100%;
14
+ height: 100%;
15
15
  }
16
16
 
17
17
  /* H5 端组件默认样式修复 */
18
18
  taro-view-core {
19
- display: block;
19
+ display: block;
20
20
  }
21
21
 
22
22
  taro-text-core {
23
- display: inline;
23
+ display: inline;
24
24
  }
25
25
 
26
26
  taro-input-core {
27
- display: block;
28
- width: 100%;
27
+ display: block;
28
+ width: 100%;
29
29
  }
30
30
 
31
31
  taro-input-core input {
32
- width: 100%;
33
- background: transparent;
34
- border: none;
35
- outline: none;
32
+ width: 100%;
33
+ background: transparent;
34
+ border: none;
35
+ outline: none;
36
36
  }
37
37
 
38
38
  /* 全局按钮样式重置 */
39
39
  taro-button-core,
40
40
  button {
41
- margin: 0 !important;
42
- padding: 0 !important;
43
- line-height: inherit;
44
- display: flex;
45
- align-items: center;
46
- justify-content: center;
41
+ margin: 0 !important;
42
+ padding: 0 !important;
43
+ line-height: inherit;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
47
  }
48
48
 
49
49
  taro-button-core::after,
50
50
  button::after {
51
- border: none;
51
+ border: none;
52
+ }
53
+
54
+ /* Vite 错误覆盖层无法选择文本的问题 */
55
+ vite-error-overlay {
56
+ /* stylelint-disable-next-line property-no-vendor-prefix */
57
+ -webkit-user-select: text !important;
58
+ }
59
+
60
+ vite-error-overlay::part(window) {
61
+ max-width: 90vw;
62
+ padding: 10px;
52
63
  }
@@ -1,28 +1,14 @@
1
- import { PropsWithChildren } from 'react'
2
- import Taro, { useLaunch } from '@tarojs/taro'
3
- import { injectH5Styles } from '@/utils/h5-styles'
4
- import '@/app.css'
1
+ import { PropsWithChildren } from 'react';
2
+ import { useLaunch } from '@tarojs/taro';
3
+ import { injectH5Styles } from '@/utils/h5-styles';
4
+ import { enableWxDebugIfNeeded } from '@/utils/wx-debug';
5
+ import '@/app.css';
5
6
 
6
7
  export default ({ children }: PropsWithChildren<any>) => {
7
- useLaunch(() => {
8
- // 仅在微信小程序环境执行
9
- if (process.env.TARO_ENV === 'weapp') {
10
- try {
11
- const accountInfo = Taro.getAccountInfoSync()
12
- const envVersion = accountInfo.miniProgram.envVersion
13
- console.log('[Debug] envVersion:', envVersion)
8
+ useLaunch(() => {
9
+ enableWxDebugIfNeeded();
10
+ injectH5Styles();
11
+ });
14
12
 
15
- // 开发版/体验版自动开启调试
16
- if (envVersion !== 'release') {
17
- Taro.setEnableDebug({ enableDebug: true })
18
- }
19
- } catch (error) {
20
- console.error('[Debug] 开启调试模式失败:', error)
21
- }
22
- }
23
-
24
- injectH5Styles()
25
- })
26
-
27
- return children
28
- }
13
+ return children;
14
+ };
@@ -14,7 +14,26 @@
14
14
  </head>
15
15
 
16
16
  <body>
17
- <div id="app"></div>
17
+ <div id="app">
18
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="lab(2.86037 0.455312 0.568903)"
19
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="
20
+ position: fixed;
21
+ inset: 0;
22
+ margin: auto;
23
+ width: 24px;
24
+ height: 24px;
25
+ animation: __app-loading-spin 1s linear infinite;
26
+ ">
27
+ <path d="M21 12a9 9 0 1 1-6.219-8.56" />
28
+ </svg>
29
+ <style>
30
+ @keyframes __app-loading-spin {
31
+ to {
32
+ transform: rotate(360deg);
33
+ }
34
+ }
35
+ </style>
36
+ </div>
18
37
  </body>
19
38
 
20
39
  </html>
@@ -1,20 +1,23 @@
1
- import { View, Text, Image } from '@tarojs/components'
2
- import { useLoad } from '@tarojs/taro'
3
- import { Network } from '@/network'
4
- import './index.css'
1
+ import { View, Text, Image } from '@tarojs/components';
2
+ import { useLoad } from '@tarojs/taro';
3
+ import { Network } from '@/network';
4
+ import './index.css';
5
5
 
6
6
  /**
7
7
  * 默认首页,直接覆盖本页内容
8
8
  */
9
9
  const IndexPage = () => {
10
10
  useLoad(async () => {
11
- const res = await Network.request({ url: '/api/hello' })
12
- console.log(res.data)
13
- })
11
+ const res = await Network.request({ url: '/api/hello' });
12
+ console.log(res.data);
13
+ });
14
14
 
15
15
  return (
16
16
  <View className="w-full h-full flex flex-col justify-center items-center gap-1">
17
- <Image className="w-32 h-28" src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif" />
17
+ <Image
18
+ className="w-32 h-28"
19
+ src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
20
+ />
18
21
  <View className="self-stretch flex flex-col justify-start items-start gap-2">
19
22
  <Text className="self-stretch text-center justify-start text-base-accent-foreground text-base font-bold">
20
23
  应用开发中
@@ -24,7 +27,7 @@ const IndexPage = () => {
24
27
  </Text>
25
28
  </View>
26
29
  </View>
27
- )
28
- }
30
+ );
31
+ };
29
32
 
30
- export default IndexPage
33
+ export default IndexPage;
@@ -0,0 +1,23 @@
1
+ import Taro from '@tarojs/taro'
2
+
3
+ /**
4
+ * 微信小程序调试工具
5
+ * 在开发版/体验版自动开启调试模式
6
+ */
7
+ export function enableWxDebugIfNeeded() {
8
+ // 仅在微信小程序环境执行
9
+ if (Taro.getEnv() === Taro.ENV_TYPE.WEAPP) {
10
+ try {
11
+ const accountInfo = Taro.getAccountInfoSync()
12
+ const envVersion = accountInfo.miniProgram.envVersion
13
+ console.log('[Debug] envVersion:', envVersion)
14
+
15
+ // 开发版/体验版自动开启调试
16
+ if (envVersion !== 'release') {
17
+ Taro.setEnableDebug({ enableDebug: true })
18
+ }
19
+ } catch (error) {
20
+ console.error('[Debug] 开启调试模式失败:', error)
21
+ }
22
+ }
23
+ }
@@ -11,8 +11,10 @@
11
11
  "ts-check": "tsc -p tsconfig.json"
12
12
  },
13
13
  "devDependencies": {
14
+ "@supabase/supabase-js": "2.95.3",
14
15
  "autoprefixer": "^10.4.20",
15
- "coze-coding-dev-sdk": "^0.7.3",
16
+ "coze-coding-dev-sdk": "^0.7.15",
17
+ "dotenv": "^17.2.3",
16
18
  "eslint": "^9",
17
19
  "only-allow": "^1.2.2",
18
20
  "postcss": "^8.4.49",