@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
@@ -24,22 +24,23 @@
24
24
  "@react-native-picker/picker": "^2.11.0",
25
25
  "@react-navigation/bottom-tabs": "^7.2.0",
26
26
  "@react-navigation/native": "^7.0.14",
27
- "babel-plugin-module-resolver": "^5.0.2",
28
- "babel-preset-expo": "^54.0.9",
29
27
  "dayjs": "^1.11.19",
30
- "expo": "^54.0.7",
28
+ "expo": "54.0.32",
31
29
  "expo-auth-session": "^7.0.9",
32
30
  "expo-av": "~16.0.6",
33
31
  "expo-blur": "~15.0.6",
34
32
  "expo-camera": "~17.0.10",
35
33
  "expo-constants": "~18.0.8",
36
34
  "expo-crypto": "^15.0.7",
35
+ "expo-file-system": "~19.0.21",
37
36
  "expo-font": "~14.0.7",
38
37
  "expo-haptics": "~15.0.6",
39
38
  "expo-image-picker": "~17.0.7",
40
39
  "expo-linear-gradient": "~15.0.6",
41
40
  "expo-linking": "~8.0.7",
42
41
  "expo-location": "~19.0.7",
42
+ "expo-image": "^3.0.11",
43
+ "js-base64": "^3.7.7",
43
44
  "expo-router": "~6.0.0",
44
45
  "expo-splash-screen": "~31.0.8",
45
46
  "expo-status-bar": "~3.0.7",
@@ -65,6 +66,8 @@
65
66
  },
66
67
  "devDependencies": {
67
68
  "@babel/core": "^7.25.2",
69
+ "babel-plugin-module-resolver": "^5.0.2",
70
+ "babel-preset-expo": "^54.0.9",
68
71
  "@eslint/js": "^9.27.0",
69
72
  "@types/jest": "^29.5.12",
70
73
  "@types/react": "~19.1.0",
@@ -0,0 +1,25 @@
1
+ import { View, Text } from 'react-native';
2
+ import { Image } from 'expo-image';
3
+
4
+ import { useTheme } from '@/hooks/useTheme';
5
+ import { Screen } from '@/components/Screen';
6
+ import { styles } from './styles';
7
+
8
+ export default function DemoPage() {
9
+ const { theme, isDark } = useTheme();
10
+
11
+ return (
12
+ <Screen backgroundColor={theme.backgroundRoot} statusBarStyle={isDark ? 'light' : 'dark'}>
13
+ <View
14
+ style={styles.container}
15
+ >
16
+ <Image
17
+ style={styles.logo}
18
+ source="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/expo/coze-loading.gif"
19
+ ></Image>
20
+ <Text style={{...styles.title, color: theme.textPrimary}}>APP 开发中</Text>
21
+ <Text style={{...styles.description, color: theme.textSecondary}}>即将为您呈现应用界面</Text>
22
+ </View>
23
+ </Screen>
24
+ );
25
+ }
@@ -0,0 +1,28 @@
1
+ import { Spacing } from '@/constants/theme';
2
+ import { StyleSheet } from 'react-native';
3
+
4
+ export const styles = StyleSheet.create({
5
+ container: {
6
+ position: 'absolute',
7
+ top: 0,
8
+ left: 0,
9
+ width: '100%',
10
+ height: '100%',
11
+ display: 'flex',
12
+ flexDirection: 'column',
13
+ alignItems: 'center',
14
+ justifyContent: 'center',
15
+ },
16
+ logo: {
17
+ width: 130,
18
+ height: 109,
19
+ },
20
+ title: {
21
+ fontSize: 16,
22
+ fontWeight: 'bold',
23
+ },
24
+ description: {
25
+ fontSize: 14,
26
+ marginTop: Spacing.sm,
27
+ },
28
+ });
@@ -38,6 +38,7 @@ try {
38
38
  const ignoreFilePatterns = [
39
39
  /template\.config\.(ts|js)$/, // 模板配置文件
40
40
  /\.template\./, // 其他模板文件
41
+ /declarations\.d\.ts$/, // 项目配置文件
41
42
  ];
42
43
 
43
44
  // 过滤包:排除内部别名和只被模板文件引用的包
@@ -7,7 +7,7 @@
7
7
  "strict": true,
8
8
  "noEmit": true,
9
9
  "paths": {
10
- "@/*": ["./src/*"]
10
+ "@/*": ["./*"]
11
11
  }
12
12
  },
13
13
  "include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"],
@@ -1,9 +1,31 @@
1
+ import { Platform } from 'react-native';
1
2
  import dayjs from 'dayjs';
2
3
  import utc from 'dayjs/plugin/utc';
3
4
  dayjs.extend(utc);
4
5
 
5
6
  const API_BASE = (process.env.EXPO_PUBLIC_API_BASE ?? '').replace(/\/$/, '');
6
7
 
8
+ /**
9
+ * 创建跨平台兼容的文件对象,用于 FormData.append()
10
+ * - Web 端返回 File 对象
11
+ * - 移动端返回 { uri, type, name } 对象(RN fetch 会自动处理)
12
+ * @param fileUri Expo 媒体库(如 expo-image-picker、expo-camera)返回的 uri
13
+ * @param fileName 上传时的文件名,如 'photo.jpg'
14
+ * @param mimeType 文件 MIME 类型,如 'image/jpeg'、'audio/mpeg'
15
+ */
16
+ export async function createFormDataFile(
17
+ fileUri: string,
18
+ fileName: string,
19
+ mimeType: string
20
+ ): Promise<File | { uri: string; type: string; name: string }> {
21
+ if (Platform.OS === 'web') {
22
+ const response = await fetch(fileUri);
23
+ const blob = await response.blob();
24
+ return new File([blob], fileName, { type: mimeType });
25
+ }
26
+ return { uri: fileUri, type: mimeType, name: fileName };
27
+ }
28
+
7
29
  /**
8
30
  * 构建文件或图片完整的URL
9
31
  * @param url 相对或绝对路径
@@ -0,0 +1,9 @@
1
+ const validName = require('./rule')
2
+
3
+ const plugin = {
4
+ rules: {
5
+ 'valid-name': validName,
6
+ },
7
+ };
8
+
9
+ module.exports = plugin