@coze-arch/cli 0.0.7 → 0.0.8-alpha.9a0dda

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 (36) hide show
  1. package/lib/__templates__/expo/AGENTS.md +194 -17
  2. package/lib/__templates__/expo/README.md +194 -17
  3. package/lib/__templates__/expo/client/app/+not-found.tsx +4 -19
  4. package/lib/__templates__/expo/client/app/_layout.tsx +16 -22
  5. package/lib/__templates__/expo/client/components/ColorSchemeUpdater.tsx +43 -0
  6. package/lib/__templates__/expo/client/components/Provider.tsx +18 -0
  7. package/lib/__templates__/expo/client/components/Screen.tsx +1 -1
  8. package/lib/__templates__/expo/client/eslint.config.mjs +1 -0
  9. package/lib/__templates__/expo/client/global.css +267 -0
  10. package/lib/__templates__/expo/client/metro.config.js +8 -1
  11. package/lib/__templates__/expo/client/package.json +5 -2
  12. package/lib/__templates__/expo/client/screens/demo/index.tsx +7 -13
  13. package/lib/__templates__/expo/client/scripts/formatter.mjs +78 -0
  14. package/lib/__templates__/expo/client/scripts/reporter.mjs +1358 -0
  15. package/lib/__templates__/expo/client/scripts/stylish-formatter.mjs +153 -0
  16. package/lib/__templates__/expo/client/scripts/text-table.mjs +68 -0
  17. package/lib/__templates__/expo/client/uniwind-types.d.ts +10 -0
  18. package/lib/__templates__/expo/package.json +4 -1
  19. package/lib/__templates__/expo/pnpm-lock.yaml +510 -51
  20. package/lib/__templates__/expo/server/package.json +2 -1
  21. package/lib/__templates__/nextjs/scripts/build.sh +2 -2
  22. package/lib/__templates__/nextjs/scripts/dev.sh +1 -1
  23. package/lib/__templates__/nuxt-vue/nuxt.config.ts +13 -0
  24. package/lib/__templates__/nuxt-vue/scripts/build.sh +1 -1
  25. package/lib/__templates__/nuxt-vue/scripts/dev.sh +1 -1
  26. package/lib/__templates__/taro/eslint.config.mjs +132 -123
  27. package/lib/__templates__/vite/scripts/build.sh +2 -2
  28. package/lib/__templates__/vite/scripts/dev.sh +1 -1
  29. package/lib/cli.js +4236 -488
  30. package/package.json +3 -1
  31. package/lib/__templates__/expo/client/components/ThemedText.tsx +0 -33
  32. package/lib/__templates__/expo/client/components/ThemedView.tsx +0 -37
  33. package/lib/__templates__/expo/client/constants/theme.ts +0 -177
  34. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +0 -48
  35. package/lib/__templates__/expo/client/hooks/useTheme.ts +0 -33
  36. package/lib/__templates__/expo/client/screens/demo/styles.ts +0 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.0.7",
3
+ "version": "0.0.8-alpha.9a0dda",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",
@@ -40,6 +40,7 @@
40
40
  "commander": "~12.1.0",
41
41
  "debug": "^4.3.7",
42
42
  "ejs": "^3.1.10",
43
+ "fast-glob": "^3.3.3",
43
44
  "js-yaml": "^4.1.0",
44
45
  "minimist": "^1.2.5",
45
46
  "shelljs": "^0.10.0"
@@ -48,6 +49,7 @@
48
49
  "@coze-arch/cli-logger": "workspace:*",
49
50
  "@coze-arch/cli-slardar": "workspace:*",
50
51
  "@coze-arch/eslint-config": "workspace:*",
52
+ "@coze-arch/fs-enhance": "workspace:*",
51
53
  "@coze-arch/monorepo-kits": "workspace:*",
52
54
  "@coze-arch/rollup-config": "workspace:*",
53
55
  "@coze-arch/ts-config": "workspace:*",
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import { Text, TextProps, TextStyle } from 'react-native';
3
- import { useTheme } from '@/hooks/useTheme';
4
- import { Typography } from '@/constants/theme';
5
-
6
- type TypographyVariant = keyof typeof Typography;
7
-
8
- interface ThemedTextProps extends TextProps {
9
- variant?: TypographyVariant;
10
- color?: string;
11
- }
12
-
13
- export function ThemedText({
14
- variant = 'body',
15
- color,
16
- style,
17
- children,
18
- ...props
19
- }: ThemedTextProps) {
20
- const { theme } = useTheme();
21
- const typographyStyle = Typography[variant];
22
-
23
- const textStyle: TextStyle = {
24
- ...typographyStyle,
25
- color: color ?? theme.textPrimary,
26
- };
27
-
28
- return (
29
- <Text style={[textStyle, style]} {...props}>
30
- {children}
31
- </Text>
32
- );
33
- }
@@ -1,37 +0,0 @@
1
- import React from 'react';
2
- import { View, ViewProps, ViewStyle } from 'react-native';
3
- import { useTheme } from '@/hooks/useTheme';
4
-
5
- type BackgroundLevel = 'root' | 'default' | 'tertiary';
6
-
7
- interface ThemedViewProps extends ViewProps {
8
- level?: BackgroundLevel;
9
- backgroundColor?: string;
10
- }
11
-
12
- const backgroundMap: Record<BackgroundLevel, string> = {
13
- root: 'backgroundRoot',
14
- default: 'backgroundDefault',
15
- tertiary: 'backgroundTertiary',
16
- };
17
-
18
- export function ThemedView({
19
- level = 'root',
20
- backgroundColor,
21
- style,
22
- children,
23
- ...props
24
- }: ThemedViewProps) {
25
- const { theme } = useTheme();
26
- const bgColor = backgroundColor ?? (theme as any)[backgroundMap[level]];
27
-
28
- const viewStyle: ViewStyle = {
29
- backgroundColor: bgColor,
30
- };
31
-
32
- return (
33
- <View style={[viewStyle, style]} {...props}>
34
- {children}
35
- </View>
36
- );
37
- }
@@ -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
- });