@coze-arch/cli 0.0.1-alpha.dffbaa → 0.0.1-alpha.f37dff

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 (63) hide show
  1. package/lib/__templates__/expo/.coze +7 -2
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +220 -0
  4. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
  5. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
  6. package/lib/__templates__/expo/README.md +66 -7
  7. package/lib/__templates__/expo/_gitignore +1 -1
  8. package/lib/__templates__/expo/_npmrc +2 -4
  9. package/lib/__templates__/expo/client/app/_layout.tsx +1 -1
  10. package/lib/__templates__/expo/client/app/home.tsx +1 -0
  11. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  12. package/lib/__templates__/expo/client/app.config.ts +75 -0
  13. package/lib/__templates__/expo/client/assets/images/coze-logo.png +0 -0
  14. package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
  15. package/lib/__templates__/expo/client/components/ThemedView.tsx +38 -0
  16. package/lib/__templates__/expo/client/constants/theme.ts +780 -48
  17. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +34 -1
  18. package/lib/__templates__/expo/client/hooks/useTheme.ts +1 -1
  19. package/lib/__templates__/expo/client/metro.config.js +121 -0
  20. package/lib/__templates__/expo/client/package.json +93 -0
  21. package/lib/__templates__/expo/client/screens/home/index.tsx +8 -38
  22. package/lib/__templates__/expo/client/screens/home/styles.ts +16 -52
  23. package/lib/__templates__/expo/client/tsconfig.json +24 -0
  24. package/lib/__templates__/expo/package.json +13 -103
  25. package/lib/__templates__/expo/pnpm-lock.yaml +421 -867
  26. package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
  27. package/lib/__templates__/expo/server/package.json +31 -0
  28. package/lib/__templates__/expo/{src → server/src}/index.ts +8 -2
  29. package/lib/__templates__/expo/server/tsconfig.json +24 -0
  30. package/lib/__templates__/expo/template.config.js +1 -0
  31. package/lib/__templates__/expo/tsconfig.json +1 -24
  32. package/lib/__templates__/nextjs/.coze +1 -0
  33. package/lib/__templates__/nextjs/next.config.ts +10 -0
  34. package/lib/__templates__/nextjs/package.json +2 -1
  35. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  36. package/lib/__templates__/nextjs/src/app/globals.css +99 -87
  37. package/lib/__templates__/nextjs/src/app/page.tsx +2 -3
  38. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  39. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  40. package/lib/__templates__/nextjs/template.config.js +24 -0
  41. package/lib/__templates__/templates.json +61 -43
  42. package/lib/__templates__/vite/.coze +1 -0
  43. package/lib/__templates__/vite/eslint.config.mjs +9 -0
  44. package/lib/__templates__/vite/package.json +6 -3
  45. package/lib/__templates__/vite/pnpm-lock.yaml +961 -120
  46. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  47. package/lib/__templates__/vite/template.config.js +4 -0
  48. package/lib/cli.js +144 -31
  49. package/package.json +8 -3
  50. package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +0 -116
  51. package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +0 -239
  52. package/lib/__templates__/expo/app.json +0 -63
  53. package/lib/__templates__/expo/babel.config.js +0 -9
  54. package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
  55. package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
  56. package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
  57. package/lib/__templates__/expo/client/app/+not-found.tsx +0 -79
  58. package/lib/__templates__/expo/client/index.js +0 -12
  59. package/lib/__templates__/expo/metro.config.js +0 -53
  60. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  61. package/lib/__templates__/vite/.vscode/settings.json +0 -7
  62. /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
  63. /package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +0 -0
@@ -1,11 +1,20 @@
1
1
 
2
2
 
3
+ import { execSync } from 'child_process';
4
+ import { resolve } from 'path';
3
5
 
4
6
 
5
7
 
6
8
 
7
9
 
8
10
 
11
+ const description = `Next.js(复杂项目):\`coze init \${COZE_WORKSPACE_PATH} --template nextjs\`
12
+ - 适用:全栈应用、复杂多页面等复杂项目
13
+ - 使用默认nextjs项目规范
14
+ - **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。
15
+ - **项目理解加速**:初始可以依赖项目下 \`package.json\` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。
16
+ - **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,\`shadcn/ui\`组件默认完整的预装在\`src/components/ui/\`目录下`;
17
+
9
18
  export const paramsSchema = {
10
19
  type: 'object',
11
20
  properties: {
@@ -29,6 +38,7 @@ export const paramsSchema = {
29
38
  };
30
39
 
31
40
  const config = {
41
+ description: description,
32
42
  paramsSchema,
33
43
 
34
44
  // 显式定义默认参数,确保在渲染时可用
@@ -49,6 +59,20 @@ const config = {
49
59
  console.log(' - TypeScript: enabled');
50
60
  console.log(' - App Router: enabled');
51
61
  console.log(` - Port: ${context.port}`);
62
+
63
+ // Update coze-coding-dev-sdk to ^0.5.2
64
+ console.log('\nUpdating coze-coding-dev-sdk to ^0.5.2...');
65
+ try {
66
+ const projectRoot = resolve(outputPath);
67
+ execSync('pnpm add coze-coding-dev-sdk@^0.5.2', {
68
+ cwd: projectRoot,
69
+ stdio: 'inherit',
70
+ });
71
+ console.log('✓ coze-coding-dev-sdk updated successfully');
72
+ } catch (error) {
73
+ console.error('✗ Failed to update coze-coding-dev-sdk:', error);
74
+ throw error;
75
+ }
52
76
  },
53
77
  };
54
78
 
@@ -3,66 +3,84 @@
3
3
  "templates": [
4
4
  {
5
5
  "name": "expo",
6
- "description": "expo template",
6
+ "description": "Expo template for React Native applications",
7
7
  "location": "./expo",
8
8
  "paramsSchema": {
9
- "appName": {
10
- "type": "string",
11
- "description": "Application name (lowercase, alphanumeric and hyphens only)",
12
- "pattern": "^[a-z0-9-]+$"
9
+ "type": "object",
10
+ "properties": {
11
+ "appName": {
12
+ "type": "string",
13
+ "minLength": 1,
14
+ "pattern": "^[a-z0-9-]+$",
15
+ "description": "Application name (lowercase, alphanumeric and hyphens only)"
16
+ },
17
+ "port": {
18
+ "type": "number",
19
+ "default": 8081,
20
+ "minimum": 1024,
21
+ "maximum": 65535,
22
+ "description": "Metro bundler port"
23
+ }
13
24
  },
14
- "port": {
15
- "type": "number",
16
- "description": "Metro bundler port",
17
- "default": 8081,
18
- "minimum": 1024,
19
- "maximum": 65535
20
- }
25
+ "required": [],
26
+ "additionalProperties": false
21
27
  }
22
28
  },
23
29
  {
24
30
  "name": "nextjs",
25
- "description": "nextjs template",
31
+ "description": "Next.js(复杂项目):`coze init ${COZE_WORKSPACE_PATH} --template nextjs`\n- 适用:全栈应用、复杂多页面等复杂项目\n- 使用默认nextjs项目规范\n - **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。\n - **项目理解加速**:初始可以依赖项目下 `package.json` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。\n - **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,`shadcn/ui`组件默认完整的预装在`src/components/ui/`目录下",
26
32
  "location": "./nextjs",
27
33
  "paramsSchema": {
28
- "appName": {
29
- "type": "string",
30
- "description": "Application name (lowercase, alphanumeric and hyphens only)",
31
- "pattern": "^[a-z0-9-]+$"
34
+ "type": "object",
35
+ "properties": {
36
+ "appName": {
37
+ "type": "string",
38
+ "minLength": 1,
39
+ "pattern": "^[a-z0-9-]+$",
40
+ "description": "Application name (lowercase, alphanumeric and hyphens only)"
41
+ },
42
+ "port": {
43
+ "type": "number",
44
+ "default": 5000,
45
+ "minimum": 1024,
46
+ "maximum": 65535,
47
+ "description": "Development server port (for Next.js dev server)"
48
+ }
32
49
  },
33
- "port": {
34
- "type": "number",
35
- "description": "Development server port (for Next.js dev server)",
36
- "default": 5000,
37
- "minimum": 1024,
38
- "maximum": 65535
39
- }
50
+ "required": [],
51
+ "additionalProperties": false
40
52
  }
41
53
  },
42
54
  {
43
55
  "name": "vite",
44
- "description": "vite template",
56
+ "description": "Vite(简单项目):`coze init ${COZE_WORKSPACE_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
45
57
  "location": "./vite",
46
58
  "paramsSchema": {
47
- "appName": {
48
- "type": "string",
49
- "description": "Application name (lowercase, alphanumeric and hyphens only)",
50
- "pattern": "^[a-z0-9-]+$"
59
+ "type": "object",
60
+ "properties": {
61
+ "appName": {
62
+ "type": "string",
63
+ "minLength": 1,
64
+ "pattern": "^[a-z0-9-]+$",
65
+ "description": "Application name (lowercase, alphanumeric and hyphens only)"
66
+ },
67
+ "port": {
68
+ "type": "number",
69
+ "default": 5000,
70
+ "minimum": 1024,
71
+ "maximum": 65535,
72
+ "description": "Development server port"
73
+ },
74
+ "hmrPort": {
75
+ "type": "number",
76
+ "default": 6000,
77
+ "minimum": 1024,
78
+ "maximum": 65535,
79
+ "description": "Development HMR server port"
80
+ }
51
81
  },
52
- "port": {
53
- "type": "number",
54
- "description": "Development server port",
55
- "default": 5000,
56
- "minimum": 1024,
57
- "maximum": 65535
58
- },
59
- "hmrPort": {
60
- "type": "number",
61
- "description": "Development HMR server port",
62
- "default": 6000,
63
- "minimum": 1024,
64
- "maximum": 65535
65
- }
82
+ "required": [],
83
+ "additionalProperties": false
66
84
  }
67
85
  }
68
86
  ]
@@ -2,6 +2,7 @@
2
2
  requires = ["nodejs-24"]
3
3
 
4
4
  [dev]
5
+ build = ["bash", "./scripts/prepare.sh"]
5
6
  run = ["bash", "./scripts/dev.sh"]
6
7
  deps = ["git"] # -> apt install git
7
8
 
@@ -0,0 +1,9 @@
1
+ import eslint from '@eslint/js';
2
+ import tseslint from 'typescript-eslint';
3
+ import { defineConfig, globalIgnores } from 'eslint/config';
4
+
5
+ export default defineConfig([
6
+ eslint.configs.recommended,
7
+ ...tseslint.configs.recommended,
8
+ globalIgnores(['dist/**', 'node_modules/**']),
9
+ ]);
@@ -5,17 +5,20 @@
5
5
  "scripts": {
6
6
  "build": "bash ./scripts/build.sh",
7
7
  "dev": "bash ./scripts/dev.sh",
8
- "preinstall": "npx only-allow pnpm",
9
8
  "lint": "eslint",
10
- "start": "bash ./scripts/start.sh"
9
+ "preinstall": "npx only-allow pnpm",
10
+ "start": "bash ./scripts/start.sh",
11
+ "ts-check": "tsc -p tsconfig.json"
11
12
  },
12
13
  "devDependencies": {
13
14
  "autoprefixer": "^10.4.20",
15
+ "eslint": "^9",
14
16
  "only-allow": "^1.2.2",
15
17
  "postcss": "^8.4.49",
16
18
  "tailwindcss": "^3.4.17",
17
19
  "typescript": "^5.6.0",
18
- "vite": "^6.0.0"
20
+ "typescript-eslint": "^8",
21
+ "vite": "^7.2.4"
19
22
  },
20
23
  "packageManager": "pnpm@9.0.0",
21
24
  "engines": {