@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,63 +0,0 @@
1
- {
2
- "expo": {
3
- "name": "${app_name}",
4
- "slug": "${slug}",
5
- "version": "1.0.0",
6
- "orientation": "portrait",
7
- "icon": "./client/assets/images/icon.png",
8
- "scheme": "myapp",
9
- "userInterfaceStyle": "automatic",
10
- "newArchEnabled": true,
11
- "ios": {
12
- "supportsTablet": true
13
- },
14
- "android": {
15
- "adaptiveIcon": {
16
- "foregroundImage": "./client/assets/images/adaptive-icon.png",
17
- "backgroundColor": "#ffffff"
18
- }
19
- },
20
- "web": {
21
- "bundler": "metro",
22
- "output": "single",
23
- "favicon": "./client/assets/images/favicon.png"
24
- },
25
- "plugins": [
26
- "expo-router",
27
- [
28
- "expo-splash-screen",
29
- {
30
- "image": "./client/assets/images/splash-icon.png",
31
- "imageWidth": 200,
32
- "resizeMode": "contain",
33
- "backgroundColor": "#ffffff"
34
- }
35
- ],
36
- [
37
- "expo-image-picker",
38
- {
39
- "photosPermission": "允许${app_name}访问您的相册,以便您上传或保存图片。",
40
- "cameraPermission": "允许${app_name}使用您的相机,以便您直接拍摄照片上传。",
41
- "microphonePermission": "允许${app_name}访问您的麦克风,以便您拍摄带有声音的视频。"
42
- }
43
- ],
44
- [
45
- "expo-location",
46
- {
47
- "locationWhenInUsePermission": "${app_name}需要访问您的位置以提供周边服务及导航功能。"
48
- }
49
- ],
50
- [
51
- "expo-camera",
52
- {
53
- "cameraPermission": "${app_name}需要访问相机以拍摄照片和视频。",
54
- "microphonePermission": "${app_name}需要访问麦克风以录制视频声音。",
55
- "recordAudioAndroid": true
56
- }
57
- ]
58
- ],
59
- "experiments": {
60
- "typedRoutes": true
61
- }
62
- }
63
- }
@@ -1,9 +0,0 @@
1
- module.exports = function (api) {
2
- api.cache(true);
3
- return {
4
- presets: ["babel-preset-expo"],
5
- plugins: [
6
- "react-native-reanimated/plugin",
7
- ],
8
- };
9
- };
@@ -1,43 +0,0 @@
1
- import { Tabs } from 'expo-router';
2
- import { FontAwesome6 } from '@expo/vector-icons';
3
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
- import { useTheme } from '@/hooks/useTheme';
5
-
6
- export default function TabLayout() {
7
- const insets = useSafeAreaInsets();
8
- const { theme } = useTheme();
9
- const tabBarHeight = 56 + Math.max(insets.bottom, 8);
10
-
11
- return (
12
- <Tabs
13
- backBehavior='history'
14
- screenOptions={{
15
- headerShown: false,
16
- tabBarActiveTintColor: theme.tabIconSelected,
17
- tabBarInactiveTintColor: theme.tabIconDefault,
18
- tabBarStyle: {
19
- backgroundColor: theme.backgroundRoot,
20
- borderTopColor: theme.backgroundSecondary,
21
- borderTopWidth: 1,
22
- height: tabBarHeight,
23
- paddingBottom: Math.max(insets.bottom, 8),
24
- paddingTop: 6,
25
- },
26
- }}
27
- >
28
- <Tabs.Screen
29
- name='index'
30
- options={{ href: null }}
31
- />
32
- <Tabs.Screen
33
- name='home'
34
- options={{
35
- title: '首页',
36
- tabBarIcon: ({ color }) => (
37
- <FontAwesome6 name='house' size={20} color={color} />
38
- ),
39
- }}
40
- />
41
- </Tabs>
42
- );
43
- }
@@ -1 +0,0 @@
1
- export { default } from "@/screens/home";
@@ -1,7 +0,0 @@
1
- import { Redirect } from 'expo-router';
2
-
3
- const Index = () => {
4
- return <Redirect href="./home" relativeToDirectory />;
5
- };
6
-
7
- export default Index;
@@ -1,79 +0,0 @@
1
- import { useRouter } from 'expo-router';
2
- import { StyleSheet, View, Text, Pressable, Platform } from 'react-native';
3
-
4
- export default function NotFoundScreen() {
5
- const router = useRouter();
6
-
7
- const goBack = () => {
8
- if (router.canGoBack()) {
9
- router.back();
10
- }
11
- };
12
-
13
- return (
14
- <View style={styles.container}>
15
- <Text style={styles.heading}>404</Text>
16
- <Text style={styles.textStyle}>页面未找到</Text>
17
- <Text style={styles.subTextStyle}>
18
- 抱歉!您访问的页面不存在,当前页面功能待完善。
19
- </Text>
20
- <Pressable onPress={goBack} style={styles.button}>
21
- <Text style={styles.buttonText}>返回上一页</Text>
22
- </Pressable>
23
- </View>
24
- );
25
- }
26
-
27
- const styles = StyleSheet.create({
28
- container: {
29
- flex: 1,
30
- alignItems: 'center',
31
- justifyContent: 'center',
32
- backgroundColor: '#f3f5ff',
33
- padding: 16,
34
- },
35
- heading: {
36
- fontSize: 120,
37
- fontWeight: '900',
38
- color: '#4a5568',
39
- textShadowColor: 'rgba(0, 0, 0, 0.05)',
40
- textShadowOffset: { width: 0, height: 4 },
41
- textShadowRadius: 8,
42
- },
43
- textStyle: {
44
- fontSize: 24,
45
- fontWeight: '500',
46
- marginTop: -16,
47
- marginBottom: 16,
48
- color: '#4a5568',
49
- },
50
- subTextStyle: {
51
- fontSize: 16,
52
- color: '#718096',
53
- marginBottom: 32,
54
- maxWidth: 400,
55
- textAlign: 'center',
56
- },
57
- button: {
58
- paddingVertical: 12,
59
- paddingHorizontal: 24,
60
- backgroundColor: '#6366f1',
61
- borderRadius: 9999,
62
- ...Platform.select({
63
- ios: {
64
- shadowColor: 'rgba(0, 0, 0, 0.1)',
65
- shadowOffset: { width: 0, height: 10 },
66
- shadowOpacity: 1,
67
- shadowRadius: 15,
68
- },
69
- android: {
70
- elevation: 5,
71
- },
72
- }),
73
- },
74
- buttonText: {
75
- fontSize: 16,
76
- fontWeight: '600',
77
- color: '#ffffff',
78
- },
79
- });
@@ -1,12 +0,0 @@
1
- import '@expo/metro-runtime';
2
- import { registerRootComponent } from 'expo';
3
- import { ExpoRoot } from 'expo-router';
4
-
5
- // 显式定义 App 组件
6
- export function App() {
7
- // eslint-disable-next-line no-undef
8
- const ctx = require.context('./app');
9
- return <ExpoRoot context={ctx} />;
10
- }
11
-
12
- registerRootComponent(App);
@@ -1,53 +0,0 @@
1
- const { getDefaultConfig } = require('expo/metro-config');
2
- // const { createProxyMiddleware } = require('http-proxy-middleware');
3
- const connect = require('connect');
4
-
5
- const config = getDefaultConfig(__dirname);
6
-
7
- // 安全地获取 Expo 的默认排除列表
8
- const existingBlockList = [].concat(config.resolver.blockList || []);
9
-
10
- config.resolver.blockList = [
11
- ...existingBlockList,
12
- /.*\/\.expo\/.*/, // Expo 的缓存和构建产物目录
13
-
14
- // 1. 原生代码 (Java/C++/Objective-C)
15
- /.*\/react-native\/ReactAndroid\/.*/,
16
- /.*\/react-native\/ReactCommon\/.*/,
17
-
18
- // 2. 纯开发和调试工具
19
- // 这些工具只在开发电脑上运行,不会被打包到应用中
20
- /.*\/@typescript-eslint\/eslint-plugin\/.*/,
21
-
22
- // 3. 构建时数据
23
- // 这个数据库只在打包过程中使用,应用运行时不需要
24
- /.*\/caniuse-lite\/data\/.*/,
25
-
26
- // 4. 通用规则
27
- /.*\/__tests__\/.*/, // 排除所有测试目录
28
- /.*\.git\/.*/, // 排除 Git 目录
29
- ];
30
-
31
- /*
32
- const apiProxy = createProxyMiddleware({
33
- target: 'http://localhost:5000',
34
- logLevel: 'debug',
35
- });
36
-
37
- config.server = {
38
- ...config.server,
39
- enhanceMiddleware: (metroMiddleware, metroServer) => {
40
- return connect()
41
- .use((req, res, next) => {
42
- if (req.url && req.url.startsWith('/api')) {
43
- console.log(`[Metro Proxy] Forwarding ${req.method} ${req.url}`);
44
- return apiProxy(req, res, next);
45
- }
46
- next();
47
- })
48
- .use(metroMiddleware);
49
- },
50
- }
51
- */
52
-
53
- module.exports = config;
@@ -1,121 +0,0 @@
1
- {
2
- "[css]": {
3
- "editor.defaultFormatter": "esbenp.prettier-vscode"
4
- },
5
- "[dotenv]": {
6
- "editor.defaultFormatter": "foxundermoon.shell-format"
7
- },
8
- "[html]": {
9
- "editor.defaultFormatter": "esbenp.prettier-vscode"
10
- },
11
- "[ignore]": {
12
- "editor.defaultFormatter": "foxundermoon.shell-format"
13
- },
14
- "[javascript]": {
15
- "editor.defaultFormatter": "esbenp.prettier-vscode"
16
- },
17
- "[javascriptreact]": {
18
- "editor.defaultFormatter": "esbenp.prettier-vscode"
19
- },
20
- "[json]": {
21
- "editor.defaultFormatter": "esbenp.prettier-vscode"
22
- },
23
- "[jsonc]": {
24
- "editor.defaultFormatter": "esbenp.prettier-vscode"
25
- },
26
- "[less]": {
27
- "editor.defaultFormatter": "stylelint.vscode-stylelint"
28
- },
29
- "[scss]": {
30
- "editor.defaultFormatter": "esbenp.prettier-vscode"
31
- },
32
- "[shellscript]": {
33
- "editor.defaultFormatter": "foxundermoon.shell-format"
34
- },
35
- "[sql]": {
36
- "editor.defaultFormatter": "adpyke.vscode-sql-formatter"
37
- },
38
- "[svg]": {
39
- "editor.defaultFormatter": "jock.svg"
40
- },
41
- "[typescript]": {
42
- "editor.defaultFormatter": "esbenp.prettier-vscode"
43
- },
44
- "[typescriptreact]": {
45
- "editor.defaultFormatter": "esbenp.prettier-vscode"
46
- },
47
- "[xml]": {
48
- "editor.defaultFormatter": "mblode.pretty-formatter"
49
- },
50
- "[yaml]": {
51
- "editor.defaultFormatter": "esbenp.prettier-vscode"
52
- },
53
- "cSpell.diagnosticLevel": "Warning",
54
- "css.validate": false,
55
- "editor.codeActionsOnSave": {
56
- "source.fixAll": "never",
57
- "source.fixAll.eslint": "explicit",
58
- "source.organizeImports": "never",
59
- "source.removeUnused": "never",
60
- "source.removeUnused.ts": "never",
61
- "source.removeUnusedImports": "never",
62
- "source.sort.json": "never"
63
- // "source.sortImports": "always"
64
- },
65
- "editor.defaultFormatter": "esbenp.prettier-vscode",
66
- "editor.formatOnPaste": false,
67
- "editor.formatOnSave": true,
68
- "editor.formatOnType": false,
69
- "editor.insertSpaces": true,
70
- "editor.minimap.enabled": true,
71
- //
72
- "editor.rulers": [80, 120],
73
- "editor.semanticHighlighting.enabled": false,
74
- "editor.tabSize": 2,
75
- "emmet.triggerExpansionOnTab": true,
76
- "files.associations": {
77
- ".babelrc": "json",
78
- ".code-workspace": "jsonc",
79
- ".eslintrc": "jsonc",
80
- ".eslintrc*.json": "jsonc",
81
- ".htmlhintrc": "jsonc",
82
- ".stylelintrc": "javascript",
83
- "*.json": "jsonc",
84
- "*.log": "plaintext",
85
- "*.map": "plaintext",
86
- "**/coverage/**/*.*": "plaintext",
87
- "**/pnpm-lock.yaml": "plaintext",
88
- "htmlhintrc": "jsonc",
89
- "package.json": "json",
90
- "README": "markdown",
91
- "stylelintrc": "jsonc",
92
- ".coze": "toml"
93
- },
94
- "files.defaultLanguage": "plaintext",
95
- "files.eol": "\n",
96
- "files.exclude": {
97
- "**/.DS_Store": true,
98
- "**/.git": true,
99
- "**/.hg": true,
100
- "**/.svn": true,
101
- // "**/.lintcache": true,
102
- "**/.swc": true,
103
- "**/CVS": true,
104
- "**/Thumbs.db": true
105
- },
106
- "files.insertFinalNewline": true,
107
- "files.trimTrailingWhitespace": true,
108
- "files.watcherExclude": {
109
- "**/.git/objects/**": true,
110
- "**/.git/subtree-cache/**": true,
111
- "**/node_modules/*/**": true
112
- },
113
- "git.openRepositoryInParentFolders": "always",
114
- "search.exclude": {
115
- "**/dist": true,
116
- "**/node_modules": true
117
- },
118
- // "editor.formatOnSaveMode": "modificationsIfAvailable",
119
- "search.followSymlinks": false,
120
- "search.useIgnoreFiles": true
121
- }
@@ -1,7 +0,0 @@
1
- {
2
- "editor.formatOnSave": true,
3
- "editor.codeActionsOnSave": {
4
- "source.fixAll.eslint": "explicit"
5
- },
6
- "typescript.tsdk": "node_modules/typescript/lib"
7
- }