@coze-arch/cli 0.0.1-alpha.9f719c → 0.0.1-alpha.a166f2

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 (136) hide show
  1. package/lib/__templates__/expo/.coze +3 -3
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +229 -0
  4. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
  5. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +3 -4
  6. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
  7. package/lib/__templates__/expo/README.md +68 -7
  8. package/lib/__templates__/expo/_gitignore +1 -1
  9. package/lib/__templates__/expo/_npmrc +2 -4
  10. package/lib/__templates__/expo/client/app/+not-found.tsx +15 -64
  11. package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
  12. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  13. package/lib/__templates__/expo/client/app.config.ts +76 -0
  14. package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
  15. package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
  16. package/lib/__templates__/expo/client/components/ThemedView.tsx +37 -0
  17. package/lib/__templates__/expo/client/constants/theme.ts +116 -67
  18. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  19. package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +33 -10
  20. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
  21. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  22. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  23. package/lib/__templates__/expo/client/metro.config.js +124 -0
  24. package/lib/__templates__/expo/client/package.json +95 -0
  25. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  26. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  27. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +1 -0
  28. package/lib/__templates__/expo/client/tsconfig.json +24 -0
  29. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  30. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  31. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  32. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  33. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  34. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  35. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  36. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  37. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  38. package/lib/__templates__/expo/package.json +16 -107
  39. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  40. package/lib/__templates__/expo/pnpm-lock.yaml +1437 -3171
  41. package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
  42. package/lib/__templates__/expo/server/build.js +21 -0
  43. package/lib/__templates__/expo/server/package.json +34 -0
  44. package/lib/__templates__/expo/server/src/index.ts +20 -0
  45. package/lib/__templates__/expo/server/tsconfig.json +24 -0
  46. package/lib/__templates__/expo/template.config.js +57 -0
  47. package/lib/__templates__/expo/tsconfig.json +1 -24
  48. package/lib/__templates__/native-static/.coze +11 -0
  49. package/lib/__templates__/native-static/index.html +33 -0
  50. package/lib/__templates__/native-static/styles/main.css +136 -0
  51. package/lib/__templates__/native-static/template.config.js +22 -0
  52. package/lib/__templates__/nextjs/.babelrc +15 -0
  53. package/lib/__templates__/nextjs/.coze +1 -0
  54. package/lib/__templates__/nextjs/_npmrc +1 -0
  55. package/lib/__templates__/nextjs/next.config.ts +12 -0
  56. package/lib/__templates__/nextjs/package.json +13 -2
  57. package/lib/__templates__/nextjs/pnpm-lock.yaml +2682 -1786
  58. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  59. package/lib/__templates__/nextjs/src/app/globals.css +109 -89
  60. package/lib/__templates__/nextjs/src/app/layout.tsx +5 -14
  61. package/lib/__templates__/nextjs/src/app/page.tsx +18 -48
  62. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  63. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  64. package/lib/__templates__/nextjs/template.config.js +67 -2
  65. package/lib/__templates__/taro/.coze +14 -0
  66. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  67. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  68. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  69. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
  70. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  71. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
  72. package/lib/__templates__/taro/README.md +749 -0
  73. package/lib/__templates__/taro/_gitignore +40 -0
  74. package/lib/__templates__/taro/_npmrc +18 -0
  75. package/lib/__templates__/taro/babel.config.js +12 -0
  76. package/lib/__templates__/taro/config/dev.ts +9 -0
  77. package/lib/__templates__/taro/config/index.ts +173 -0
  78. package/lib/__templates__/taro/config/prod.ts +35 -0
  79. package/lib/__templates__/taro/eslint.config.mjs +79 -0
  80. package/lib/__templates__/taro/key/private.appid.key +0 -0
  81. package/lib/__templates__/taro/package.json +97 -0
  82. package/lib/__templates__/taro/pnpm-lock.yaml +22694 -0
  83. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  84. package/lib/__templates__/taro/project.config.json +15 -0
  85. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  86. package/lib/__templates__/taro/server/package.json +40 -0
  87. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  88. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  89. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  90. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  91. package/lib/__templates__/taro/server/src/main.ts +49 -0
  92. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  93. package/lib/__templates__/taro/src/app.config.ts +11 -0
  94. package/lib/__templates__/taro/src/app.css +52 -0
  95. package/lib/__templates__/taro/src/app.tsx +9 -0
  96. package/lib/__templates__/taro/src/index.html +39 -0
  97. package/lib/__templates__/taro/src/network.ts +39 -0
  98. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  99. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  100. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  101. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +171 -0
  102. package/lib/__templates__/taro/src/presets/h5-styles.ts +33 -0
  103. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  104. package/lib/__templates__/taro/src/presets/wx-debug.ts +23 -0
  105. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  106. package/lib/__templates__/taro/template.config.js +68 -0
  107. package/lib/__templates__/taro/tsconfig.json +29 -0
  108. package/lib/__templates__/taro/types/global.d.ts +32 -0
  109. package/lib/__templates__/templates.json +104 -43
  110. package/lib/__templates__/vite/.coze +1 -0
  111. package/lib/__templates__/vite/_npmrc +1 -0
  112. package/lib/__templates__/vite/eslint.config.mjs +9 -0
  113. package/lib/__templates__/vite/package.json +14 -1
  114. package/lib/__templates__/vite/pnpm-lock.yaml +1581 -105
  115. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  116. package/lib/__templates__/vite/src/main.ts +17 -48
  117. package/lib/__templates__/vite/template.config.js +67 -6
  118. package/lib/__templates__/vite/vite.config.ts +1 -0
  119. package/lib/cli.js +1006 -154
  120. package/package.json +9 -3
  121. package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +0 -109
  122. package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +0 -232
  123. package/lib/__templates__/expo/app.json +0 -63
  124. package/lib/__templates__/expo/babel.config.js +0 -19
  125. package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
  126. package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
  127. package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
  128. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
  129. package/lib/__templates__/expo/client/index.js +0 -12
  130. package/lib/__templates__/expo/client/screens/home/index.tsx +0 -51
  131. package/lib/__templates__/expo/client/screens/home/styles.ts +0 -60
  132. package/lib/__templates__/expo/metro.config.js +0 -51
  133. package/lib/__templates__/expo/src/index.ts +0 -12
  134. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  135. package/lib/__templates__/vite/.vscode/settings.json +0 -7
  136. /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
@@ -0,0 +1,68 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+ const description = `Taro(小程序 + H5):\`coze init \${COZE_WORKSPACE_PATH} --template taro\`
11
+ - 适用:微信小程序、H5 跨端应用
12
+ - 前后端分离架构:Taro 4 + NestJS
13
+ - 支持微信小程序和 H5 双端构建
14
+ - 使用 TailwindCSS + weapp-tailwindcss 实现跨端样式`;
15
+
16
+ export const paramsSchema = {
17
+ type: 'object',
18
+ properties: {
19
+ appName: {
20
+ type: 'string',
21
+ minLength: 1,
22
+ pattern: '^[a-z0-9-]+$',
23
+ description:
24
+ 'Application name (lowercase, alphanumeric and hyphens only)',
25
+ },
26
+ port: {
27
+ type: 'number',
28
+ default: 5000,
29
+ minimum: 1024,
30
+ maximum: 65535,
31
+ description: 'H5 development server port',
32
+ },
33
+ serverPort: {
34
+ type: 'number',
35
+ default: 3000,
36
+ minimum: 1024,
37
+ maximum: 65535,
38
+ description: 'NestJS backend server port',
39
+ },
40
+ },
41
+ required: [],
42
+ additionalProperties: false,
43
+ };
44
+
45
+ const config = {
46
+ description: description,
47
+ paramsSchema,
48
+ defaultParams: {
49
+ port: 5000,
50
+ serverPort: 3000,
51
+ appName: 'coze-mini-program',
52
+ },
53
+ onBeforeRender: async context => {
54
+ console.log(`Creating Taro project: ${context.appName}`);
55
+ return context;
56
+ },
57
+ onAfterRender: async (context, outputPath) => {
58
+ console.log(`\nProject created at: ${outputPath}`);
59
+ console.log('\nConfiguration:');
60
+ console.log(' - Framework: Taro 4 + NestJS');
61
+ console.log(' - TypeScript: enabled');
62
+ console.log(' - Platforms: H5, WeChat Mini Program');
63
+ console.log(` - H5 Port: ${context.port}`);
64
+ console.log(` - Server Port: ${context.serverPort}`);
65
+ },
66
+ };
67
+
68
+ export default config;
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2017",
4
+ "module": "ESNext",
5
+ "removeComments": false,
6
+ "preserveConstEnums": true,
7
+ "moduleResolution": "bundler",
8
+ "experimentalDecorators": true,
9
+ "noImplicitAny": false,
10
+ "allowSyntheticDefaultImports": true,
11
+ "outDir": "lib",
12
+ "noUnusedLocals": true,
13
+ "noUnusedParameters": true,
14
+ "strictNullChecks": true,
15
+ "sourceMap": true,
16
+ "rootDir": ".",
17
+ "jsx": "react-jsx",
18
+ "allowJs": true,
19
+ "resolveJsonModule": true,
20
+ "typeRoots": [
21
+ "node_modules/@types"
22
+ ],
23
+ "paths": {
24
+ "@/*": ["./src/*"]
25
+ }
26
+ },
27
+ "include": ["./src", "./types", "./config"],
28
+ "compileOnSave": false
29
+ }
@@ -0,0 +1,32 @@
1
+ /// <reference types="@tarojs/taro" />
2
+
3
+ declare const PROJECT_DOMAIN: string | undefined;
4
+ declare const TARO_ENV: "weapp" | "h5" | undefined;
5
+
6
+ declare module '*.png';
7
+ declare module '*.gif';
8
+ declare module '*.jpg';
9
+ declare module '*.jpeg';
10
+ declare module '*.svg';
11
+ declare module '*.css';
12
+ declare module '*.less';
13
+ declare module '*.scss';
14
+ declare module '*.sass';
15
+ declare module '*.styl';
16
+
17
+ declare namespace NodeJS {
18
+ interface ProcessEnv {
19
+ /** NODE 内置环境变量, 会影响到最终构建生成产物 */
20
+ NODE_ENV: 'development' | 'production',
21
+ /** 当前构建的平台 */
22
+ TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'qq' | 'jd' | 'harmony' | 'jdrn'
23
+ /**
24
+ * 当前构建的小程序 appid
25
+ * @description 若不同环境有不同的小程序,可通过在 env 文件中配置环境变量`TARO_APP_ID`来方便快速切换 appid, 而不必手动去修改 dist/project.config.json 文件
26
+ * @see https://taro-docs.jd.com/docs/next/env-mode-config#特殊环境变量-taro_app_id
27
+ */
28
+ TARO_APP_ID: string
29
+ }
30
+ }
31
+
32
+
@@ -3,66 +3,127 @@
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
27
+ }
28
+ },
29
+ {
30
+ "name": "native-static",
31
+ "description": "Native Static(纯静态):`coze init ${COZE_WORKSPACE_PATH} --template native-static`\n- 适用:纯静态 HTML/CSS/JS 项目、静态网站\n- 使用 Python http.server 作为开发服务器\n- 不需要 Node.js 环境,适合简单静态内容",
32
+ "location": "./native-static",
33
+ "paramsSchema": {
34
+ "type": "object",
35
+ "properties": {},
36
+ "required": [],
37
+ "additionalProperties": false
21
38
  }
22
39
  },
23
40
  {
24
41
  "name": "nextjs",
25
- "description": "nextjs template",
42
+ "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
43
  "location": "./nextjs",
27
44
  "paramsSchema": {
28
- "appName": {
29
- "type": "string",
30
- "description": "Application name (lowercase, alphanumeric and hyphens only)",
31
- "pattern": "^[a-z0-9-]+$"
45
+ "type": "object",
46
+ "properties": {
47
+ "appName": {
48
+ "type": "string",
49
+ "minLength": 1,
50
+ "pattern": "^[a-z0-9-]+$",
51
+ "description": "Application name (lowercase, alphanumeric and hyphens only)"
52
+ },
53
+ "port": {
54
+ "type": "number",
55
+ "default": 5000,
56
+ "minimum": 1024,
57
+ "maximum": 65535,
58
+ "description": "Development server port (for Next.js dev server)"
59
+ }
60
+ },
61
+ "required": [],
62
+ "additionalProperties": false
63
+ }
64
+ },
65
+ {
66
+ "name": "taro",
67
+ "description": "Taro(小程序 + H5):`coze init ${COZE_WORKSPACE_PATH} --template taro`\n- 适用:微信小程序、H5 跨端应用\n- 前后端分离架构:Taro 4 + NestJS\n- 支持微信小程序和 H5 双端构建\n- 使用 TailwindCSS + weapp-tailwindcss 实现跨端样式",
68
+ "location": "./taro",
69
+ "paramsSchema": {
70
+ "type": "object",
71
+ "properties": {
72
+ "appName": {
73
+ "type": "string",
74
+ "minLength": 1,
75
+ "pattern": "^[a-z0-9-]+$",
76
+ "description": "Application name (lowercase, alphanumeric and hyphens only)"
77
+ },
78
+ "port": {
79
+ "type": "number",
80
+ "default": 5000,
81
+ "minimum": 1024,
82
+ "maximum": 65535,
83
+ "description": "H5 development server port"
84
+ },
85
+ "serverPort": {
86
+ "type": "number",
87
+ "default": 3000,
88
+ "minimum": 1024,
89
+ "maximum": 65535,
90
+ "description": "NestJS backend server port"
91
+ }
32
92
  },
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
- }
93
+ "required": [],
94
+ "additionalProperties": false
40
95
  }
41
96
  },
42
97
  {
43
98
  "name": "vite",
44
- "description": "vite template",
99
+ "description": "Vite(简单项目):`coze init ${COZE_WORKSPACE_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
45
100
  "location": "./vite",
46
101
  "paramsSchema": {
47
- "appName": {
48
- "type": "string",
49
- "description": "Application name (lowercase, alphanumeric and hyphens only)",
50
- "pattern": "^[a-z0-9-]+$"
51
- },
52
- "port": {
53
- "type": "number",
54
- "description": "Development server port",
55
- "default": 5000,
56
- "minimum": 1024,
57
- "maximum": 65535
102
+ "type": "object",
103
+ "properties": {
104
+ "appName": {
105
+ "type": "string",
106
+ "minLength": 1,
107
+ "pattern": "^[a-z0-9-]+$",
108
+ "description": "Application name (lowercase, alphanumeric and hyphens only)"
109
+ },
110
+ "port": {
111
+ "type": "number",
112
+ "default": 5000,
113
+ "minimum": 1024,
114
+ "maximum": 65535,
115
+ "description": "Development server port"
116
+ },
117
+ "hmrPort": {
118
+ "type": "number",
119
+ "default": 6000,
120
+ "minimum": 1024,
121
+ "maximum": 65535,
122
+ "description": "Development HMR server port"
123
+ }
58
124
  },
59
- "hmrPort": {
60
- "type": "number",
61
- "description": "Development HMR server port",
62
- "default": 6000,
63
- "minimum": 1024,
64
- "maximum": 65535
65
- }
125
+ "required": [],
126
+ "additionalProperties": false
66
127
  }
67
128
  }
68
129
  ]
@@ -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,31 @@
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"
12
+ },
13
+ "dependencies": {
14
+ "@supabase/supabase-js": "2.95.3",
15
+ "dotenv": "^17.2.3"
11
16
  },
12
17
  "devDependencies": {
13
18
  "autoprefixer": "^10.4.20",
19
+ "coze-coding-dev-sdk": "^0.7.16",
20
+ "eslint": "^9",
14
21
  "only-allow": "^1.2.2",
15
22
  "postcss": "^8.4.49",
16
23
  "tailwindcss": "^3.4.17",
17
24
  "typescript": "^5.6.0",
25
+ "typescript-eslint": "^8",
18
26
  "vite": "^7.2.4"
19
27
  },
20
28
  "packageManager": "pnpm@9.0.0",
21
29
  "engines": {
22
30
  "pnpm": ">=9.0.0"
31
+ },
32
+ "pnpm": {
33
+ "overrides": {
34
+ "esbuild": "^0.27.2"
35
+ }
23
36
  }
24
37
  }