@coze-arch/cli 0.0.1-alpha.bcc7d9 → 0.0.1-alpha.bd5b49

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 (78) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +15 -14
  2. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +9 -8
  3. package/lib/__templates__/expo/README.md +14 -17
  4. package/lib/__templates__/expo/client/app/+not-found.tsx +4 -19
  5. package/lib/__templates__/expo/client/app/_layout.tsx +16 -17
  6. package/lib/__templates__/expo/client/eslint.config.mjs +17 -1
  7. package/lib/__templates__/expo/client/global.css +78 -0
  8. package/lib/__templates__/expo/client/metro.config.js +8 -1
  9. package/lib/__templates__/expo/client/package.json +37 -34
  10. package/lib/__templates__/expo/client/screens/demo/index.tsx +6 -12
  11. package/lib/__templates__/expo/client/styles.css +263 -0
  12. package/lib/__templates__/expo/client/uniwind-types.d.ts +10 -0
  13. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  14. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  15. package/lib/__templates__/expo/package.json +1 -1
  16. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  17. package/lib/__templates__/expo/pnpm-lock.yaml +338 -1735
  18. package/lib/__templates__/expo/server/package.json +9 -7
  19. package/lib/__templates__/expo/server/src/index.ts +1 -0
  20. package/lib/__templates__/expo/template.config.js +56 -0
  21. package/lib/__templates__/nextjs/package.json +3 -1
  22. package/lib/__templates__/nextjs/pnpm-lock.yaml +1051 -934
  23. package/lib/__templates__/nextjs/src/app/page.tsx +18 -60
  24. package/lib/__templates__/nextjs/template.config.js +49 -14
  25. package/lib/__templates__/taro/.coze +14 -0
  26. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  27. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  28. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  29. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +80 -0
  30. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  31. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +1 -0
  32. package/lib/__templates__/taro/README.md +747 -0
  33. package/lib/__templates__/taro/_gitignore +40 -0
  34. package/lib/__templates__/taro/_npmrc +18 -0
  35. package/lib/__templates__/taro/babel.config.js +12 -0
  36. package/lib/__templates__/taro/config/dev.ts +9 -0
  37. package/lib/__templates__/taro/config/index.ts +173 -0
  38. package/lib/__templates__/taro/config/prod.ts +35 -0
  39. package/lib/__templates__/taro/eslint.config.mjs +57 -0
  40. package/lib/__templates__/taro/key/private.appid.key +0 -0
  41. package/lib/__templates__/taro/package.json +97 -0
  42. package/lib/__templates__/taro/pnpm-lock.yaml +22708 -0
  43. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  44. package/lib/__templates__/taro/project.config.json +15 -0
  45. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  46. package/lib/__templates__/taro/server/package.json +41 -0
  47. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  48. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  49. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  50. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  51. package/lib/__templates__/taro/server/src/main.ts +49 -0
  52. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  53. package/lib/__templates__/taro/src/app.config.ts +11 -0
  54. package/lib/__templates__/taro/src/app.css +52 -0
  55. package/lib/__templates__/taro/src/app.ts +14 -0
  56. package/lib/__templates__/taro/src/index.html +39 -0
  57. package/lib/__templates__/taro/src/network.ts +39 -0
  58. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  59. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  60. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  61. package/lib/__templates__/taro/src/utils/h5-styles.ts +33 -0
  62. package/lib/__templates__/taro/src/utils/wx-debug.ts +23 -0
  63. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  64. package/lib/__templates__/taro/template.config.js +68 -0
  65. package/lib/__templates__/taro/tsconfig.json +29 -0
  66. package/lib/__templates__/taro/types/global.d.ts +32 -0
  67. package/lib/__templates__/templates.json +32 -0
  68. package/lib/__templates__/vite/package.json +5 -1
  69. package/lib/__templates__/vite/pnpm-lock.yaml +146 -1659
  70. package/lib/__templates__/vite/src/main.ts +17 -47
  71. package/lib/__templates__/vite/template.config.js +49 -14
  72. package/lib/cli.js +353 -76
  73. package/package.json +1 -1
  74. package/lib/__templates__/expo/client/constants/theme.ts +0 -177
  75. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +0 -48
  76. package/lib/__templates__/expo/client/hooks/useTheme.ts +0 -33
  77. package/lib/__templates__/expo/client/screens/demo/styles.ts +0 -28
  78. package/lib/__templates__/expo/patches/expo@54.0.32.patch +0 -28
@@ -1,177 +0,0 @@
1
- export const Colors = {
2
- light: {
3
- textPrimary: "#1C1917",
4
- textSecondary: "#78716c",
5
- textMuted: "#9CA3AF",
6
- primary: "#4F46E5", // Indigo-600 - 品牌主色,代表科技与智能
7
- accent: "#8B5CF6", // Violet-500 - 辅助色,代表创造力
8
- success: "#10B981", // Emerald-500
9
- error: "#EF4444",
10
- backgroundRoot: "#FAFAFA",
11
- backgroundDefault: "#FFFFFF",
12
- backgroundTertiary: "#F9FAFB", // 更浅的背景色,用于去线留白
13
- buttonPrimaryText: "#FFFFFF",
14
- tabIconSelected: "#4F46E5",
15
- border: "#E5E7EB",
16
- borderLight: "#F3F4F6",
17
- },
18
- dark: {
19
- textPrimary: "#FAFAF9",
20
- textSecondary: "#A8A29E",
21
- textMuted: "#6F767E",
22
- primary: "#818CF8", // Indigo-400 - 暗色模式品牌主色
23
- accent: "#A78BFA", // Violet-400
24
- success: "#34D399",
25
- error: "#F87171",
26
- backgroundRoot: "#09090B", // 更深的背景色
27
- backgroundDefault: "#1C1C1E",
28
- backgroundTertiary: "#1F1F22", // 暗色模式去线留白背景
29
- buttonPrimaryText: "#09090B",
30
- tabIconSelected: "#818CF8",
31
- border: "#3F3F46",
32
- borderLight: "#27272A",
33
- },
34
- };
35
-
36
- export const Spacing = {
37
- xs: 4,
38
- sm: 8,
39
- md: 12,
40
- lg: 16,
41
- xl: 20,
42
- "2xl": 24,
43
- "3xl": 32,
44
- "4xl": 40,
45
- "5xl": 48,
46
- "6xl": 64,
47
- };
48
-
49
- export const BorderRadius = {
50
- xs: 4,
51
- sm: 8,
52
- md: 12,
53
- lg: 16,
54
- xl: 20,
55
- "2xl": 24,
56
- "3xl": 28,
57
- "4xl": 32,
58
- full: 9999,
59
- };
60
-
61
- export const Typography = {
62
- display: {
63
- fontSize: 112,
64
- lineHeight: 112,
65
- fontWeight: "200" as const,
66
- letterSpacing: -4,
67
- },
68
- displayLarge: {
69
- fontSize: 112,
70
- lineHeight: 112,
71
- fontWeight: "200" as const,
72
- letterSpacing: -2,
73
- },
74
- displayMedium: {
75
- fontSize: 48,
76
- lineHeight: 56,
77
- fontWeight: "200" as const,
78
- },
79
- h1: {
80
- fontSize: 32,
81
- lineHeight: 40,
82
- fontWeight: "700" as const,
83
- },
84
- h2: {
85
- fontSize: 28,
86
- lineHeight: 36,
87
- fontWeight: "700" as const,
88
- },
89
- h3: {
90
- fontSize: 24,
91
- lineHeight: 32,
92
- fontWeight: "300" as const,
93
- },
94
- h4: {
95
- fontSize: 20,
96
- lineHeight: 28,
97
- fontWeight: "600" as const,
98
- },
99
- title: {
100
- fontSize: 18,
101
- lineHeight: 24,
102
- fontWeight: "700" as const,
103
- },
104
- body: {
105
- fontSize: 16,
106
- lineHeight: 24,
107
- fontWeight: "400" as const,
108
- },
109
- bodyMedium: {
110
- fontSize: 16,
111
- lineHeight: 24,
112
- fontWeight: "500" as const,
113
- },
114
- small: {
115
- fontSize: 14,
116
- lineHeight: 20,
117
- fontWeight: "400" as const,
118
- },
119
- smallMedium: {
120
- fontSize: 14,
121
- lineHeight: 20,
122
- fontWeight: "500" as const,
123
- },
124
- caption: {
125
- fontSize: 12,
126
- lineHeight: 16,
127
- fontWeight: "400" as const,
128
- },
129
- captionMedium: {
130
- fontSize: 12,
131
- lineHeight: 16,
132
- fontWeight: "500" as const,
133
- },
134
- label: {
135
- fontSize: 14,
136
- lineHeight: 20,
137
- fontWeight: "500" as const,
138
- letterSpacing: 2,
139
- textTransform: "uppercase" as const,
140
- },
141
- labelSmall: {
142
- fontSize: 12,
143
- lineHeight: 16,
144
- fontWeight: "500" as const,
145
- letterSpacing: 1,
146
- textTransform: "uppercase" as const,
147
- },
148
- labelTitle: {
149
- fontSize: 14,
150
- lineHeight: 20,
151
- fontWeight: "700" as const,
152
- letterSpacing: 2,
153
- textTransform: "uppercase" as const,
154
- },
155
- link: {
156
- fontSize: 16,
157
- lineHeight: 24,
158
- fontWeight: "400" as const,
159
- },
160
- stat: {
161
- fontSize: 30,
162
- lineHeight: 36,
163
- fontWeight: "300" as const,
164
- },
165
- tiny: {
166
- fontSize: 10,
167
- lineHeight: 14,
168
- fontWeight: "400" as const,
169
- },
170
- navLabel: {
171
- fontSize: 10,
172
- lineHeight: 14,
173
- fontWeight: "500" as const,
174
- },
175
- };
176
-
177
- export type Theme = typeof Colors.light;
@@ -1,48 +0,0 @@
1
- import { createContext, Dispatch, ReactNode, SetStateAction, useContext, useEffect, useState } from 'react';
2
- import { ColorSchemeName, useColorScheme as useReactNativeColorScheme, Platform } from 'react-native';
3
-
4
- const ColorSchemeContext = createContext<'light' | 'dark' | null | undefined>(null);
5
-
6
- const ColorSchemeProvider = function ({ children }: { children?: ReactNode }) {
7
- const systemColorScheme = useReactNativeColorScheme();
8
- const [colorScheme, setColorScheme] = useState(systemColorScheme);
9
-
10
- useEffect(() => {
11
- setColorScheme(systemColorScheme);
12
- }, [systemColorScheme]);
13
-
14
- useEffect(() => {
15
- function handleMessage(e: MessageEvent<{ event: string; colorScheme: ColorSchemeName; } | undefined>) {
16
- if (e.data?.event === 'coze.workbench.colorScheme') {
17
- const cs = e.data.colorScheme;
18
- if (typeof cs === 'string' && typeof setColorScheme === 'function') {
19
- setColorScheme(cs);
20
- }
21
- }
22
- }
23
-
24
- if (Platform.OS === 'web') {
25
- window.addEventListener('message', handleMessage, false);
26
- }
27
-
28
- return () => {
29
- if (Platform.OS === 'web') {
30
- window.removeEventListener('message', handleMessage, false);
31
- }
32
- }
33
- }, [setColorScheme]);
34
-
35
- return <ColorSchemeContext.Provider value={colorScheme}>
36
- {children}
37
- </ColorSchemeContext.Provider>
38
- };
39
-
40
- function useColorScheme() {
41
- const colorScheme = useContext(ColorSchemeContext);
42
- return colorScheme;
43
- }
44
-
45
- export {
46
- ColorSchemeProvider,
47
- useColorScheme,
48
- }
@@ -1,33 +0,0 @@
1
- import { Colors } from '@/constants/theme';
2
- import { useColorScheme } from '@/hooks/useColorScheme';
3
-
4
- enum COLOR_SCHEME_CHOICE {
5
- FOLLOW_SYSTEM = 'follow-system', // 跟随系统自动变化
6
- DARK = 'dark', // 固定为 dark 主题,不随系统变化
7
- LIGHT = 'light', // 固定为 light 主题,不随系统变化
8
- };
9
-
10
- const userPreferColorScheme: COLOR_SCHEME_CHOICE = COLOR_SCHEME_CHOICE.FOLLOW_SYSTEM;
11
-
12
- function getTheme(colorScheme?: 'dark' | 'light' | null) {
13
- const isDark = colorScheme === 'dark';
14
- const theme = Colors[colorScheme ?? 'light'];
15
-
16
- return {
17
- theme,
18
- isDark,
19
- };
20
- }
21
-
22
- function useTheme() {
23
- const systemColorScheme = useColorScheme()
24
- const colorScheme = userPreferColorScheme === COLOR_SCHEME_CHOICE.FOLLOW_SYSTEM ?
25
- systemColorScheme :
26
- userPreferColorScheme;
27
-
28
- return getTheme(colorScheme);
29
- }
30
-
31
- export {
32
- useTheme,
33
- }
@@ -1,28 +0,0 @@
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
- });
@@ -1,28 +0,0 @@
1
- diff --git a/src/async-require/hmr.ts b/src/async-require/hmr.ts
2
- index 33ce50ee2950c40d2b0553b148710f1e24e44f3d..ed853b38809866ea8d1b78e5a71342f02dd735ef 100644
3
- --- a/src/async-require/hmr.ts
4
- +++ b/src/async-require/hmr.ts
5
- @@ -216,6 +216,23 @@ const HMRClient: HMRClientNativeInterface = {
6
-
7
- client.on('update-done', () => {
8
- hideLoading();
9
- +
10
- + if (process.env.EXPO_PUBLIC_COZE_PROJECT_ID && typeof window !== 'undefined' && window.location) {
11
- + if((window as any).__updateTimeoutId) {
12
- + clearTimeout((window as any).__updateTimeoutId);
13
- + }
14
- +
15
- + const updateDoneTime = Date.now();
16
- + (window as any).__updateDoneTime = updateDoneTime;
17
- +
18
- + (window as any).__updateTimeoutId = setTimeout(() => {
19
- + const lastUpdateTime = (window as any).__updateDoneTime;
20
- + if (lastUpdateTime === updateDoneTime) {
21
- + console.warn('[HMR] Update timeout, force reload');
22
- + window.location.reload();
23
- + }
24
- + }, 35_000);
25
- + }
26
- });
27
-
28
- client.on('error', (data: { type: string; message: string }) => {