@coze-arch/cli 0.0.1-alpha.f9be02 → 0.0.1-alpha.fd3d56

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 (84) hide show
  1. package/lib/__templates__/expo/.coze +1 -1
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +19 -82
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +75 -86
  4. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
  5. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +2 -2
  6. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +45 -0
  7. package/lib/__templates__/expo/README.md +68 -7
  8. package/lib/__templates__/expo/client/app/+not-found.tsx +30 -0
  9. package/lib/__templates__/expo/client/{src/app → app}/_layout.tsx +15 -12
  10. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  11. package/lib/__templates__/expo/client/app.config.ts +65 -60
  12. package/lib/__templates__/expo/client/{src/components → components}/Screen.tsx +1 -17
  13. package/lib/__templates__/expo/client/{src/components → components}/ThemedView.tsx +1 -2
  14. package/lib/__templates__/expo/client/constants/theme.ts +177 -0
  15. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  16. package/lib/__templates__/expo/client/eslint.config.mjs +30 -10
  17. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
  18. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  19. package/lib/__templates__/expo/client/hooks/useTheme.ts +33 -0
  20. package/lib/__templates__/expo/client/package.json +6 -3
  21. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  22. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  23. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +1 -0
  24. package/lib/__templates__/expo/client/tsconfig.json +1 -1
  25. package/lib/__templates__/expo/client/{src/utils → utils}/index.ts +22 -0
  26. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  27. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  28. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  29. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  30. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  31. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  32. package/lib/__templates__/expo/package.json +7 -98
  33. package/lib/__templates__/expo/patches/expo@54.0.32.patch +44 -0
  34. package/lib/__templates__/expo/pnpm-lock.yaml +2001 -2124
  35. package/lib/__templates__/expo/server/build.js +21 -0
  36. package/lib/__templates__/expo/server/package.json +19 -4
  37. package/lib/__templates__/expo/server/src/index.ts +9 -2
  38. package/lib/__templates__/expo/server/tsconfig.json +24 -0
  39. package/lib/__templates__/expo/template.config.js +1 -0
  40. package/lib/__templates__/nextjs/.babelrc +15 -0
  41. package/lib/__templates__/nextjs/.coze +1 -0
  42. package/lib/__templates__/nextjs/_npmrc +1 -0
  43. package/lib/__templates__/nextjs/next.config.ts +12 -0
  44. package/lib/__templates__/nextjs/package.json +10 -11
  45. package/lib/__templates__/nextjs/pnpm-lock.yaml +2543 -1747
  46. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  47. package/lib/__templates__/nextjs/src/app/globals.css +10 -2
  48. package/lib/__templates__/nextjs/src/app/layout.tsx +5 -14
  49. package/lib/__templates__/nextjs/src/app/page.tsx +35 -23
  50. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  51. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  52. package/lib/__templates__/nextjs/template.config.js +30 -0
  53. package/lib/__templates__/templates.json +61 -43
  54. package/lib/__templates__/vite/.coze +1 -0
  55. package/lib/__templates__/vite/_npmrc +1 -0
  56. package/lib/__templates__/vite/eslint.config.mjs +9 -0
  57. package/lib/__templates__/vite/package.json +10 -1
  58. package/lib/__templates__/vite/pnpm-lock.yaml +3115 -126
  59. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  60. package/lib/__templates__/vite/src/main.ts +1 -2
  61. package/lib/__templates__/vite/template.config.js +30 -4
  62. package/lib/cli.js +691 -130
  63. package/package.json +5 -3
  64. package/lib/__templates__/expo/client/src/app/index.ts +0 -1
  65. package/lib/__templates__/expo/client/src/constants/theme.ts +0 -850
  66. package/lib/__templates__/expo/client/src/hooks/useColorScheme.ts +0 -1
  67. package/lib/__templates__/expo/client/src/hooks/useTheme.ts +0 -13
  68. package/lib/__templates__/expo/client/src/screens/home/index.tsx +0 -50
  69. package/lib/__templates__/expo/client/src/screens/home/styles.ts +0 -60
  70. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  71. package/lib/__templates__/vite/.vscode/settings.json +0 -7
  72. /package/lib/__templates__/expo/client/{src/assets → assets}/fonts/SpaceMono-Regular.ttf +0 -0
  73. /package/lib/__templates__/expo/client/{src/assets → assets}/images/adaptive-icon.png +0 -0
  74. /package/lib/__templates__/expo/client/{src/assets → assets}/images/default-avatar.png +0 -0
  75. /package/lib/__templates__/expo/client/{src/assets → assets}/images/favicon.png +0 -0
  76. /package/lib/__templates__/expo/client/{src/assets → assets}/images/icon.png +0 -0
  77. /package/lib/__templates__/expo/client/{src/assets → assets}/images/partial-react-logo.png +0 -0
  78. /package/lib/__templates__/expo/client/{src/assets → assets}/images/react-logo.png +0 -0
  79. /package/lib/__templates__/expo/client/{src/assets → assets}/images/react-logo@2x.png +0 -0
  80. /package/lib/__templates__/expo/client/{src/assets → assets}/images/react-logo@3x.png +0 -0
  81. /package/lib/__templates__/expo/client/{src/assets → assets}/images/splash-icon.png +0 -0
  82. /package/lib/__templates__/expo/client/{src/components → components}/SmartDateInput.tsx +0 -0
  83. /package/lib/__templates__/expo/client/{src/components → components}/ThemedText.tsx +0 -0
  84. /package/lib/__templates__/expo/client/{src/contexts → contexts}/AuthContext.tsx +0 -0
@@ -1,11 +1,20 @@
1
1
 
2
2
 
3
3
 
4
+ import { resolve } from 'path';
4
5
 
5
6
 
6
7
 
7
8
 
8
9
 
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,26 @@ const config = {
49
59
  console.log(' - TypeScript: enabled');
50
60
  console.log(' - App Router: enabled');
51
61
  console.log(` - Port: ${context.port}`);
62
+
63
+ // Skip pnpm add in test environment to avoid monorepo workspace issues
64
+ if (process.env.NODE_ENV === 'test') {
65
+ console.log('⊘ Skipping dependency update in test environment');
66
+ return;
67
+ }
68
+
69
+ const cmd = `pnpm add coze-coding-dev-sdk@"^0.7.0"`;
70
+ console.log(`${cmd}`);
71
+ try {
72
+ const projectRoot = resolve(outputPath);
73
+ // execSync(cmd, {
74
+ // cwd: projectRoot,
75
+ // stdio: 'inherit',
76
+ // });
77
+ console.log('✓ coze-coding-dev-sdk updated successfully');
78
+ } catch (error) {
79
+ console.error('✗ Failed to update coze-coding-dev-sdk:', error);
80
+ throw error;
81
+ }
52
82
  },
53
83
  };
54
84
 
@@ -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
 
@@ -1,3 +1,4 @@
1
+ loglevel=error
1
2
  registry=https://registry.npmmirror.com
2
3
 
3
4
  strictStorePkgContentCheck=false
@@ -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
+ ]);
@@ -7,18 +7,27 @@
7
7
  "dev": "bash ./scripts/dev.sh",
8
8
  "preinstall": "npx only-allow pnpm",
9
9
  "lint": "eslint",
10
- "start": "bash ./scripts/start.sh"
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
+ "coze-coding-dev-sdk": "^0.7.3",
16
+ "eslint": "^9",
14
17
  "only-allow": "^1.2.2",
15
18
  "postcss": "^8.4.49",
16
19
  "tailwindcss": "^3.4.17",
17
20
  "typescript": "^5.6.0",
21
+ "typescript-eslint": "^8",
18
22
  "vite": "^7.2.4"
19
23
  },
20
24
  "packageManager": "pnpm@9.0.0",
21
25
  "engines": {
22
26
  "pnpm": ">=9.0.0"
27
+ },
28
+ "pnpm": {
29
+ "overrides": {
30
+ "esbuild": "^0.27.2"
31
+ }
23
32
  }
24
33
  }