@coze-arch/cli 0.0.1-alpha.f74941 → 0.0.1-beta.6

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 (112) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +1 -1
  2. package/lib/__templates__/expo/app.json +1 -1
  3. package/lib/__templates__/expo/client/index.js +2 -1
  4. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +36 -12
  5. package/lib/__templates__/expo/metro.config.js +15 -15
  6. package/lib/__templates__/expo/package.json +14 -5
  7. package/lib/__templates__/expo/pnpm-lock.yaml +335 -4
  8. package/lib/__templates__/nextjs/.babelrc +15 -0
  9. package/lib/__templates__/nextjs/README.md +341 -19
  10. package/lib/__templates__/nextjs/components.json +21 -0
  11. package/lib/__templates__/nextjs/package.json +48 -1
  12. package/lib/__templates__/nextjs/pnpm-lock.yaml +6399 -1356
  13. package/lib/__templates__/nextjs/scripts/dev.sh +2 -1
  14. package/lib/__templates__/nextjs/server.mjs +50 -0
  15. package/lib/__templates__/nextjs/src/app/globals.css +99 -8
  16. package/lib/__templates__/nextjs/src/app/layout.tsx +4 -0
  17. package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
  18. package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
  19. package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
  20. package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
  21. package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
  22. package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
  23. package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
  24. package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
  25. package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
  26. package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
  27. package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
  28. package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
  29. package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
  30. package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
  31. package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
  32. package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
  33. package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
  34. package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
  35. package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
  36. package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
  37. package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
  38. package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
  39. package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
  40. package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
  41. package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
  42. package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
  43. package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
  44. package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
  45. package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
  46. package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
  47. package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
  48. package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
  49. package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
  50. package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
  51. package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
  52. package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
  53. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +56 -0
  54. package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
  55. package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
  56. package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
  57. package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
  58. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +726 -0
  59. package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
  60. package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
  61. package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
  62. package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
  63. package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
  64. package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
  65. package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
  66. package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
  67. package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
  68. package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
  69. package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
  70. package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
  71. package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
  72. package/lib/__templates__/nextjs/template.config.js +1 -1
  73. package/lib/__templates__/templates.json +0 -38
  74. package/lib/__templates__/vite/template.config.js +1 -1
  75. package/lib/cli.js +19 -2
  76. package/package.json +2 -2
  77. package/lib/__templates__/react-rsbuild/.coze +0 -11
  78. package/lib/__templates__/react-rsbuild/.vscode/settings.json +0 -121
  79. package/lib/__templates__/react-rsbuild/README.md +0 -61
  80. package/lib/__templates__/react-rsbuild/_gitignore +0 -97
  81. package/lib/__templates__/react-rsbuild/_npmrc +0 -22
  82. package/lib/__templates__/react-rsbuild/package.json +0 -31
  83. package/lib/__templates__/react-rsbuild/pnpm-lock.yaml +0 -997
  84. package/lib/__templates__/react-rsbuild/rsbuild.config.ts +0 -13
  85. package/lib/__templates__/react-rsbuild/scripts/build.sh +0 -14
  86. package/lib/__templates__/react-rsbuild/scripts/dev.sh +0 -51
  87. package/lib/__templates__/react-rsbuild/scripts/start.sh +0 -15
  88. package/lib/__templates__/react-rsbuild/src/App.tsx +0 -60
  89. package/lib/__templates__/react-rsbuild/src/index.css +0 -21
  90. package/lib/__templates__/react-rsbuild/src/index.html +0 -12
  91. package/lib/__templates__/react-rsbuild/src/index.tsx +0 -16
  92. package/lib/__templates__/react-rsbuild/tailwind.config.js +0 -9
  93. package/lib/__templates__/react-rsbuild/template.config.js +0 -54
  94. package/lib/__templates__/react-rsbuild/tsconfig.json +0 -17
  95. package/lib/__templates__/rsbuild/.coze +0 -11
  96. package/lib/__templates__/rsbuild/.vscode/settings.json +0 -7
  97. package/lib/__templates__/rsbuild/README.md +0 -61
  98. package/lib/__templates__/rsbuild/_gitignore +0 -97
  99. package/lib/__templates__/rsbuild/_npmrc +0 -22
  100. package/lib/__templates__/rsbuild/package.json +0 -24
  101. package/lib/__templates__/rsbuild/pnpm-lock.yaml +0 -888
  102. package/lib/__templates__/rsbuild/rsbuild.config.ts +0 -12
  103. package/lib/__templates__/rsbuild/scripts/build.sh +0 -14
  104. package/lib/__templates__/rsbuild/scripts/dev.sh +0 -51
  105. package/lib/__templates__/rsbuild/scripts/start.sh +0 -15
  106. package/lib/__templates__/rsbuild/src/index.css +0 -21
  107. package/lib/__templates__/rsbuild/src/index.html +0 -12
  108. package/lib/__templates__/rsbuild/src/index.ts +0 -5
  109. package/lib/__templates__/rsbuild/src/main.ts +0 -65
  110. package/lib/__templates__/rsbuild/tailwind.config.js +0 -9
  111. package/lib/__templates__/rsbuild/template.config.js +0 -56
  112. package/lib/__templates__/rsbuild/tsconfig.json +0 -16
@@ -204,7 +204,7 @@ fi
204
204
 
205
205
  write_log "INFO" "==================== 启动 server 服务 ===================="
206
206
  write_log "INFO" "正在执行:npm run server"
207
- nohup npm run server > logs/app.log 2>&1 &
207
+ PORT="$SERVER_PORT" nohup npm run server > logs/app.log 2>&1 &
208
208
  SERVER_PID=$!
209
209
  if [ -z "${SERVER_PID}" ]; then
210
210
  write_log "ERROR" "无法获取 server 后台进程 PID"
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "web": {
21
21
  "bundler": "metro",
22
- "output": "static",
22
+ "output": "single",
23
23
  "favicon": "./client/assets/images/favicon.png"
24
24
  },
25
25
  "plugins": [
@@ -1,3 +1,4 @@
1
+ import '@expo/metro-runtime';
1
2
  import { registerRootComponent } from 'expo';
2
3
  import { ExpoRoot } from 'expo-router';
3
4
 
@@ -8,4 +9,4 @@ export function App() {
8
9
  return <ExpoRoot context={ctx} />;
9
10
  }
10
11
 
11
- registerRootComponent(App);
12
+ registerRootComponent(App);
@@ -18,7 +18,7 @@ try {
18
18
  try {
19
19
  depcheckOutput = execSync('npx depcheck --json', {
20
20
  encoding: 'utf-8',
21
- stdio: ['pipe', 'pipe', 'pipe']
21
+ stdio: ['pipe', 'pipe', 'pipe'],
22
22
  });
23
23
  } catch (execError) {
24
24
  // depcheck 返回非零退出码时仍然有输出
@@ -30,10 +30,34 @@ try {
30
30
  }
31
31
 
32
32
  const result = JSON.parse(depcheckOutput);
33
-
33
+
34
34
  // 获取缺失的依赖
35
35
  const missing = result.missing || {};
36
- const missingPackages = Object.keys(missing).filter(pkg => !pkg.startsWith('@api/') && !pkg.startsWith('@/') && pkg !== '@api');
36
+
37
+ // 需要忽略的文件模式
38
+ const ignoreFilePatterns = [
39
+ /template\.config\.(ts|js)$/, // 模板配置文件
40
+ /\.template\./, // 其他模板文件
41
+ ];
42
+
43
+ // 过滤包:排除内部别名和只被模板文件引用的包
44
+ const missingPackages = Object.keys(missing).filter(pkg => {
45
+ // 排除内部路径别名
46
+ if (pkg.startsWith('@api/') || pkg.startsWith('@/') || pkg === '@api') {
47
+ return false;
48
+ }
49
+
50
+ // 获取引用该包的文件列表
51
+ const referencingFiles = missing[pkg] || [];
52
+
53
+ // 过滤掉模板配置文件
54
+ const nonTemplateFiles = referencingFiles.filter(file => {
55
+ return !ignoreFilePatterns.some(pattern => pattern.test(file));
56
+ });
57
+
58
+ // 只有当存在非模板文件引用时才保留该包
59
+ return nonTemplateFiles.length > 0;
60
+ });
37
61
 
38
62
  if (missingPackages.length === 0) {
39
63
  console.log('✅ 没有发现缺失的依赖!');
@@ -44,30 +68,31 @@ try {
44
68
  missingPackages.forEach((pkg, index) => {
45
69
  const files = missing[pkg];
46
70
  console.log(` ${index + 1}. ${pkg}`);
47
- console.log(` 被引用于: ${files.slice(0, 2).join(', ')}${files.length > 2 ? ' ...' : ''}`);
71
+ console.log(
72
+ ` 被引用于: ${files.slice(0, 2).join(', ')}${files.length > 2 ? ' ...' : ''}`,
73
+ );
48
74
  });
49
75
 
50
76
  console.log('\n🚀 开始安装...\n');
51
77
 
52
78
  // 使用 expo install 安装所有缺失的包
53
79
  const packagesToInstall = missingPackages.join(' ');
54
-
80
+
55
81
  try {
56
82
  execSync(`pnpm expo install ${packagesToInstall}`, {
57
- stdio: 'inherit'
83
+ stdio: 'inherit',
58
84
  });
59
-
85
+
60
86
  console.log('\n✅ 所有缺失的依赖已安装完成!');
61
87
  } catch (installError) {
62
88
  console.log('\n⚠️ expo install 失败,尝试使用 npm install...\n');
63
-
89
+
64
90
  execSync(`npm install ${packagesToInstall}`, {
65
- stdio: 'inherit'
91
+ stdio: 'inherit',
66
92
  });
67
-
93
+
68
94
  console.log('\n✅ 所有缺失的依赖已通过 npm 安装完成!');
69
95
  }
70
-
71
96
  } catch (error) {
72
97
  if (error.message.includes('depcheck')) {
73
98
  console.error('❌ depcheck 未安装或运行失败');
@@ -77,4 +102,3 @@ try {
77
102
  }
78
103
  process.exit(1);
79
104
  }
80
-
@@ -8,29 +8,29 @@ const config = getDefaultConfig(__dirname);
8
8
  const existingBlockList = [].concat(config.resolver.blockList || []);
9
9
 
10
10
  config.resolver.blockList = [
11
- ...existingBlockList,
12
- /.*\/\.expo\/.*/, // Expo 的缓存和构建产物目录
11
+ ...existingBlockList,
12
+ /.*\/\.expo\/.*/, // Expo 的缓存和构建产物目录
13
13
 
14
- // 1. 原生代码 (Java/C++/Objective-C)
15
- /.*\/react-native\/ReactAndroid\/.*/,
16
- /.*\/react-native\/ReactCommon\/.*/,
14
+ // 1. 原生代码 (Java/C++/Objective-C)
15
+ /.*\/react-native\/ReactAndroid\/.*/,
16
+ /.*\/react-native\/ReactCommon\/.*/,
17
17
 
18
- // 2. 纯开发和调试工具
19
- // 这些工具只在开发电脑上运行,不会被打包到应用中
20
- /.*\/@typescript-eslint\/eslint-plugin\/.*/,
18
+ // 2. 纯开发和调试工具
19
+ // 这些工具只在开发电脑上运行,不会被打包到应用中
20
+ /.*\/@typescript-eslint\/eslint-plugin\/.*/,
21
21
 
22
- // 3. 构建时数据
23
- // 这个数据库只在打包过程中使用,应用运行时不需要
24
- /.*\/caniuse-lite\/data\/.*/,
22
+ // 3. 构建时数据
23
+ // 这个数据库只在打包过程中使用,应用运行时不需要
24
+ /.*\/caniuse-lite\/data\/.*/,
25
25
 
26
- // 4. 通用规则
27
- /.*\/__tests__\/.*/, // 排除所有测试目录
28
- /.*\.git\/.*/, // 排除 Git 目录
26
+ // 4. 通用规则
27
+ /.*\/__tests__\/.*/, // 排除所有测试目录
28
+ /.*\.git\/.*/, // 排除 Git 目录
29
29
  ];
30
30
 
31
31
  /*
32
32
  const apiProxy = createProxyMiddleware({
33
- target: 'http://localhost:3000',
33
+ target: 'http://localhost:5000',
34
34
  logLevel: 'debug',
35
35
  });
36
36
 
@@ -4,15 +4,14 @@
4
4
  "private": true,
5
5
  "main": "client/index.js",
6
6
  "scripts": {
7
- "build": "expo export --platform web",
7
+ "build": "bash .cozeproj/scripts/deploy_build.sh",
8
8
  "check-deps": "npx depcheck",
9
9
  "dev": "bash .cozeproj/scripts/deploy_run.sh",
10
- "fix-deps": "node ./client/scripts/install-missing-deps.js",
11
- "install-missing": "node ./client/scripts/install-missing-deps.js",
12
- "lint": "expo lint",
13
10
  "preinstall": "npx only-allow pnpm",
14
11
  "postinstall": "node ./client/scripts/install-missing-deps.js",
15
- "server": "node ./src/index.ts",
12
+ "install-missing": "node ./client/scripts/install-missing-deps.js",
13
+ "lint": "expo lint",
14
+ "server": "NODE_ENV=development tsx ./src/index.ts",
16
15
  "start": "expo start --web",
17
16
  "test": "jest --watchAll"
18
17
  },
@@ -20,6 +19,9 @@
20
19
  "preset": "jest-expo"
21
20
  },
22
21
  "dependencies": {
22
+ "@aws-sdk/client-s3": "^3.958.0",
23
+ "@aws-sdk/lib-storage": "^3.958.0",
24
+ "@expo/metro-runtime": "^6.1.2",
23
25
  "@expo/vector-icons": "^15.0.0",
24
26
  "@react-native-async-storage/async-storage": "^2.2.0",
25
27
  "@react-native-community/datetimepicker": "^8.5.0",
@@ -30,8 +32,12 @@
30
32
  "@react-navigation/native": "^7.0.14",
31
33
  "ajv": "^8.17.1",
32
34
  "ajv-formats": "^3.0.1",
35
+ "connect": "^3.7.0",
33
36
  "coze-coding-dev-sdk": "0.5.0",
34
37
  "dayjs": "^1.11.19",
38
+ "drizzle-kit": "^0.31.8",
39
+ "drizzle-orm": "^0.45.1",
40
+ "drizzle-zod": "^0.8.3",
35
41
  "expo": "^54.0.7",
36
42
  "expo-auth-session": "^7.0.9",
37
43
  "expo-av": "~16.0.6",
@@ -52,6 +58,7 @@
52
58
  "expo-system-ui": "~6.0.9",
53
59
  "expo-web-browser": "~15.0.10",
54
60
  "express": "^4.22.1",
61
+ "pg": "^8.16.3",
55
62
  "react": "19.1.0",
56
63
  "react-dom": "19.1.0",
57
64
  "react-native": "0.81.5",
@@ -74,6 +81,7 @@
74
81
  "@eslint/js": "^9.27.0",
75
82
  "@types/express": "^5.0.6",
76
83
  "@types/jest": "^29.5.12",
84
+ "@types/pg": "^8.16.0",
77
85
  "@types/react": "~19.1.0",
78
86
  "@types/react-test-renderer": "19.1.0",
79
87
  "babel-plugin-module-resolver": "^5.0.2",
@@ -91,6 +99,7 @@
91
99
  "jest": "^29.2.1",
92
100
  "jest-expo": "~54.0.10",
93
101
  "react-test-renderer": "19.1.0",
102
+ "tsx": "^4.21.0",
94
103
  "typescript": "^5.8.3",
95
104
  "typescript-eslint": "^8.32.1"
96
105
  },