@coze-arch/cli 0.0.1-alpha.8f2811 → 0.0.1-alpha.904498

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 (66) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +12 -13
  2. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +8 -9
  3. package/lib/__templates__/expo/README.md +13 -16
  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/global.css +78 -0
  7. package/lib/__templates__/expo/client/metro.config.js +8 -1
  8. package/lib/__templates__/expo/client/package.json +9 -7
  9. package/lib/__templates__/expo/client/screens/demo/index.tsx +7 -13
  10. package/lib/__templates__/expo/client/styles.css +263 -0
  11. package/lib/__templates__/expo/client/uniwind-types.d.ts +10 -0
  12. package/lib/__templates__/expo/patches/expo@54.0.32.patch +2 -3
  13. package/lib/__templates__/expo/pnpm-lock.yaml +1732 -163
  14. package/lib/__templates__/expo/server/package.json +1 -1
  15. package/lib/__templates__/nextjs/src/app/page.tsx +61 -17
  16. package/lib/__templates__/templates.json +0 -32
  17. package/lib/__templates__/vite/src/main.ts +47 -17
  18. package/lib/cli.js +1 -1
  19. package/package.json +1 -1
  20. package/lib/__templates__/expo/client/components/ThemedText.tsx +0 -33
  21. package/lib/__templates__/expo/client/components/ThemedView.tsx +0 -37
  22. package/lib/__templates__/expo/client/constants/theme.ts +0 -177
  23. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +0 -48
  24. package/lib/__templates__/expo/client/hooks/useTheme.ts +0 -33
  25. package/lib/__templates__/taro/.coze +0 -14
  26. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +0 -19
  27. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +0 -14
  28. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +0 -16
  29. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +0 -74
  30. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +0 -5
  31. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +0 -1
  32. package/lib/__templates__/taro/README.md +0 -687
  33. package/lib/__templates__/taro/_gitignore +0 -40
  34. package/lib/__templates__/taro/_npmrc +0 -18
  35. package/lib/__templates__/taro/babel.config.js +0 -12
  36. package/lib/__templates__/taro/config/dev.ts +0 -9
  37. package/lib/__templates__/taro/config/index.ts +0 -173
  38. package/lib/__templates__/taro/config/prod.ts +0 -35
  39. package/lib/__templates__/taro/eslint.config.mjs +0 -57
  40. package/lib/__templates__/taro/key/private.appid.key +0 -0
  41. package/lib/__templates__/taro/package.json +0 -95
  42. package/lib/__templates__/taro/pnpm-lock.yaml +0 -22430
  43. package/lib/__templates__/taro/pnpm-workspace.yaml +0 -2
  44. package/lib/__templates__/taro/project.config.json +0 -15
  45. package/lib/__templates__/taro/server/nest-cli.json +0 -10
  46. package/lib/__templates__/taro/server/package.json +0 -38
  47. package/lib/__templates__/taro/server/src/app.controller.ts +0 -23
  48. package/lib/__templates__/taro/server/src/app.module.ts +0 -10
  49. package/lib/__templates__/taro/server/src/app.service.ts +0 -8
  50. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +0 -23
  51. package/lib/__templates__/taro/server/src/main.ts +0 -49
  52. package/lib/__templates__/taro/server/tsconfig.json +0 -24
  53. package/lib/__templates__/taro/src/app.config.ts +0 -11
  54. package/lib/__templates__/taro/src/app.css +0 -52
  55. package/lib/__templates__/taro/src/app.ts +0 -14
  56. package/lib/__templates__/taro/src/index.html +0 -50
  57. package/lib/__templates__/taro/src/network.ts +0 -39
  58. package/lib/__templates__/taro/src/pages/index/index.config.ts +0 -3
  59. package/lib/__templates__/taro/src/pages/index/index.css +0 -1
  60. package/lib/__templates__/taro/src/pages/index/index.tsx +0 -33
  61. package/lib/__templates__/taro/src/utils/h5-styles.ts +0 -22
  62. package/lib/__templates__/taro/src/utils/wx-debug.ts +0 -23
  63. package/lib/__templates__/taro/stylelint.config.mjs +0 -4
  64. package/lib/__templates__/taro/template.config.js +0 -68
  65. package/lib/__templates__/taro/tsconfig.json +0 -29
  66. package/lib/__templates__/taro/types/global.d.ts +0 -32
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "express": "^4.22.1",
13
13
  "cors": "^2.8.5",
14
- "coze-coding-dev-sdk": "^0.7.10",
14
+ "coze-coding-dev-sdk": "^0.7.2",
15
15
  "dayjs": "^1.11.19",
16
16
  "drizzle-orm": "^0.45.1",
17
17
  "drizzle-zod": "^0.8.3",
@@ -1,4 +1,6 @@
1
1
  import type { Metadata } from 'next';
2
+ import Image from 'next/image';
3
+ import { Button } from '@/components/ui/button';
2
4
 
3
5
  export const metadata: Metadata = {
4
6
  title: '扣子编程 - AI 开发伙伴',
@@ -7,26 +9,68 @@ export const metadata: Metadata = {
7
9
 
8
10
  export default function Home() {
9
11
  return (
10
- <div className="flex h-full items-center justify-center bg-background text-foreground transition-colors duration-300 dark:bg-background dark:text-foreground overflow-hidden">
12
+ <div className="flex min-h-screen items-center justify-center bg-background text-foreground transition-colors duration-300 dark:bg-background dark:text-foreground">
11
13
  {/* 主容器 */}
12
- <main className="flex w-full h-full max-w-3xl flex-col items-center justify-center px-16 py-32 sm:items-center">
13
- <div className="flex flex-col items-center justify-between gap-4">
14
- <img
15
- src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
14
+ <main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between px-16 py-32 sm:items-start">
15
+ {/* 头部:Logo 产品名称 */}
16
+ <div className="flex items-center gap-3">
17
+ <Image
18
+ src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/favicon.svg"
16
19
  alt="扣子编程 Logo"
17
- width={156}
18
- height={130}
20
+ width={40}
21
+ height={40}
22
+ unoptimized
19
23
  />
20
- <div>
21
- <div className="flex flex-col items-center gap-2 text-center sm:items-center sm:text-center">
22
- <h1 className="max-w-xl text-base font-semibold leading-tight tracking-tight text-foreground dark:text-foreground">
23
- 应用开发中
24
- </h1>
25
- <p className="max-w-2xl text-sm-14 leading-8 text-muted-foreground dark:text-muted-foreground">
26
- 请稍后,页面即将呈现
27
- </p>
28
- </div>
29
- </div>
24
+ <span className="text-xl font-bold tracking-tight text-foreground dark:text-foreground">
25
+ 扣子编程
26
+ </span>
27
+ </div>
28
+
29
+ {/* 中间内容区:主标题和副标题 */}
30
+ <div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
31
+ <h1 className="max-w-xl text-4xl font-semibold leading-tight tracking-tight text-foreground dark:text-foreground">
32
+ 扣子编程,你的 AI 开发伙伴已就位
33
+ </h1>
34
+ <p className="max-w-2xl text-lg leading-8 text-muted-foreground dark:text-muted-foreground">
35
+ 当前是空白入口文件,项目正在开发中,请稍候...
36
+ <br />
37
+ 开发完成后界面将自动更新。如未自动更新成功,可以手动点击右上角刷新或重启按钮查看效果。
38
+ </p>
39
+ </div>
40
+
41
+ {/* 底部按钮区 */}
42
+ <div className="flex w-full flex-col gap-4 text-base font-medium sm:w-auto sm:flex-row">
43
+ {/* 按钮 1:前往首页 */}
44
+ <Button
45
+ asChild
46
+ variant="default"
47
+ size="lg"
48
+ className="h-12 min-w-[160px] rounded-full px-8"
49
+ >
50
+ <a
51
+ href="https://code.coze.cn/"
52
+ target="_blank"
53
+ rel="noopener noreferrer"
54
+ >
55
+ 前往首页
56
+ </a>
57
+ </Button>
58
+
59
+ {/* 按钮 2:查看文档 */}
60
+ <Button
61
+ asChild
62
+ variant="outline"
63
+ size="lg"
64
+ className="h-12 min-w-[160px] rounded-full px-8"
65
+ >
66
+ <a
67
+ href="https://docs.coze.cn/"
68
+ target="_blank"
69
+ rel="noopener noreferrer"
70
+ >
71
+ 查看文档
72
+ </a>
73
+ </Button>
30
74
  </div>
31
75
  </main>
32
76
  </div>
@@ -51,38 +51,6 @@
51
51
  "additionalProperties": false
52
52
  }
53
53
  },
54
- {
55
- "name": "taro",
56
- "description": "Taro(小程序 + H5):`coze init ${COZE_WORKSPACE_PATH} --template taro`\n- 适用:微信小程序、H5 跨端应用\n- 前后端分离架构:Taro 4 + NestJS\n- 支持微信小程序和 H5 双端构建\n- 使用 TailwindCSS + weapp-tailwindcss 实现跨端样式",
57
- "location": "./taro",
58
- "paramsSchema": {
59
- "type": "object",
60
- "properties": {
61
- "appName": {
62
- "type": "string",
63
- "minLength": 1,
64
- "pattern": "^[a-z0-9-]+$",
65
- "description": "Application name (lowercase, alphanumeric and hyphens only)"
66
- },
67
- "port": {
68
- "type": "number",
69
- "default": 5000,
70
- "minimum": 1024,
71
- "maximum": 65535,
72
- "description": "H5 development server port"
73
- },
74
- "serverPort": {
75
- "type": "number",
76
- "default": 3000,
77
- "minimum": 1024,
78
- "maximum": 65535,
79
- "description": "NestJS backend server port"
80
- }
81
- },
82
- "required": [],
83
- "additionalProperties": false
84
- }
85
- },
86
54
  {
87
55
  "name": "vite",
88
56
  "description": "Vite(简单项目):`coze init ${COZE_WORKSPACE_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
@@ -7,26 +7,56 @@ export function initApp(): void {
7
7
  }
8
8
 
9
9
  app.innerHTML = `
10
- <div class="flex h-full items-center justify-center bg-background text-foreground transition-colors duration-300 dark:bg-background dark:text-foreground overflow-hidden">
11
- {/* 主容器 */}
12
- <main class="flex w-full h-full max-w-3xl flex-col items-center justify-center px-16 py-32 sm:items-center">
13
- <div class="flex flex-col items-center justify-between gap-4">
10
+ <div class="flex min-h-screen items-center justify-center bg-white text-black transition-colors duration-300 dark:bg-black dark:text-white">
11
+ <!-- 主容器 -->
12
+ <main class="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between px-16 py-32 sm:items-start">
13
+ <!-- 头部:Logo 产品名称 -->
14
+ <div class="flex items-center gap-3">
14
15
  <img
15
- src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
16
+ src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/favicon.svg"
16
17
  alt="扣子编程 Logo"
17
- width={156}
18
- height={130}
18
+ width="40"
19
+ height="40"
20
+ style="width: 40px; height: 40px; object-fit: contain;"
19
21
  />
20
- <div>
21
- <div class="flex flex-col items-center gap-2 text-center sm:items-center sm:text-center">
22
- <h1 class="max-w-xl text-base font-semibold leading-tight tracking-tight text-foreground dark:text-foreground">
23
- 应用开发中
24
- </h1>
25
- <p class="max-w-2xl text-sm-14 leading-8 text-muted-foreground dark:text-muted-foreground">
26
- 请稍后,页面即将呈现
27
- </p>
28
- </div>
29
- </div>
22
+ <span class="text-xl font-bold tracking-tight text-black dark:text-zinc-50">
23
+ 扣子编程
24
+ </span>
25
+ </div>
26
+
27
+ <!-- 中间内容区:主标题和副标题 -->
28
+ <div class="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
29
+ <h1 class="max-w-xl text-4xl font-semibold leading-tight tracking-tight text-black dark:text-zinc-50">
30
+ 扣子编程,你的 AI 开发伙伴已就位
31
+ </h1>
32
+ <p class="max-w-2xl text-lg leading-8 text-zinc-600 dark:text-zinc-400">
33
+ 当前是空白入口文件,项目正在开发中,请稍候...
34
+ <br />
35
+ 开发完成后界面将自动更新。如未自动更新成功,可以手动点击右上角刷新或重启按钮查看效果。
36
+ </p>
37
+ </div>
38
+
39
+ <!-- 底部按钮区 -->
40
+ <div class="flex w-full flex-col gap-4 text-base font-medium sm:w-auto sm:flex-row">
41
+ <!-- 按钮 1:前往首页 -->
42
+ <a
43
+ class="flex h-12 w-full min-w-[160px] items-center justify-center gap-2 rounded-full bg-black px-8 text-white transition-colors hover:bg-zinc-800 dark:bg-white dark:text-black dark:hover:bg-zinc-200 md:w-auto"
44
+ href="https://code.coze.cn/"
45
+ target="_blank"
46
+ rel="noopener noreferrer"
47
+ >
48
+ 前往首页
49
+ </a>
50
+
51
+ <!-- 按钮 2:查看文档 -->
52
+ <a
53
+ class="flex h-12 w-full min-w-[160px] items-center justify-center rounded-full border border-solid border-black/[.08] px-8 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-auto"
54
+ href="https://docs.coze.cn/"
55
+ target="_blank"
56
+ rel="noopener noreferrer"
57
+ >
58
+ 查看文档
59
+ </a>
30
60
  </div>
31
61
  </main>
32
62
  </div>
package/lib/cli.js CHANGED
@@ -2597,7 +2597,7 @@ const registerCommand = program => {
2597
2597
  });
2598
2598
  };
2599
2599
 
2600
- var version = "0.0.1-alpha.8f2811";
2600
+ var version = "0.0.1-alpha.904498";
2601
2601
  var packageJson = {
2602
2602
  version: version};
2603
2603
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.0.1-alpha.8f2811",
3
+ "version": "0.0.1-alpha.904498",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",
@@ -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,14 +0,0 @@
1
- [project]
2
- entrypoint = "server.js"
3
- requires = ["nodejs-24"]
4
-
5
- [dev]
6
- build = ["bash", ".cozeproj/scripts/dev_build.sh"]
7
- run = ["bash", ".cozeproj/scripts/dev_run.sh"]
8
- deps = ["git"] # -> apt install git
9
- pack = ["bash", ".cozeproj/scripts/pack.sh"]
10
-
11
- [deploy]
12
- build = ["bash", ".cozeproj/scripts/deploy_build.sh"]
13
- run = ["bash", ".cozeproj/scripts/deploy_run.sh"]
14
- deps = ["git"] # -> apt install git
@@ -1,19 +0,0 @@
1
- #!/bin/bash
2
- set -Eeuo pipefail
3
-
4
- cd "${COZE_WORKSPACE_PATH}"
5
- if [ -f "./.cozeproj/scripts/init_env.sh" ]; then
6
- echo "⚙️ Initializing environment..."
7
- # 使用 bash 执行,确保即使没有 x 权限也能跑
8
- bash ./.cozeproj/scripts/init_env.sh
9
- else
10
- echo "⚠️ Warning: init_env.sh not found, skipping environment init."
11
- fi
12
- echo "Installing dependencies..."
13
- # 安装所有依赖(包含 Taro 核心和 React)
14
- pnpm install
15
-
16
- echo "Building the Taro project..."
17
- pnpm build
18
-
19
- echo "Build completed successfully! Assets are in /dist"
@@ -1,14 +0,0 @@
1
- #!/bin/bash
2
- set -Eeuo pipefail
3
-
4
- start_service() {
5
- cd "${COZE_WORKSPACE_PATH}/server/dist"
6
-
7
- local port="${DEPLOY_RUN_PORT:-3000}"
8
- echo "Starting Static File Server on port ${port} for deploy..."
9
-
10
- node ./main.js -p "${port}"
11
- }
12
-
13
- echo "Starting HTTP service for deploy..."
14
- start_service
@@ -1,16 +0,0 @@
1
- #!/bin/bash
2
- set -Eeuo pipefail
3
-
4
- cd "${COZE_WORKSPACE_PATH}"
5
- if [ -f "./.cozeproj/scripts/init_env.sh" ]; then
6
- echo "⚙️ Initializing environment..."
7
- # 使用 bash 执行,确保即使没有 x 权限也能跑
8
- bash ./.cozeproj/scripts/init_env.sh
9
- else
10
- echo "⚠️ Warning: init_env.sh not found, skipping environment init."
11
- fi
12
-
13
- echo "Installing dependencies..."
14
- pnpm install
15
-
16
- echo "Dependencies installed successfully!"