@coze-arch/cli 0.0.1-alpha.f74941 → 0.0.1-alpha.f9be02
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.
- package/lib/__templates__/expo/.coze +7 -2
- package/lib/__templates__/expo/.cozeproj/scripts/{deploy_build.sh → dev_build.sh} +25 -25
- package/lib/__templates__/expo/.cozeproj/scripts/{deploy_run.sh → dev_run.sh} +45 -63
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
- package/lib/__templates__/expo/_gitignore +1 -1
- package/lib/__templates__/expo/_npmrc +3 -5
- package/lib/__templates__/expo/client/app.config.ts +71 -0
- package/lib/__templates__/expo/client/metro.config.js +121 -0
- package/lib/__templates__/expo/client/package.json +92 -0
- package/lib/__templates__/expo/client/scripts/install-missing-deps.js +36 -12
- package/lib/__templates__/expo/client/src/app/index.ts +1 -0
- package/lib/__templates__/expo/client/src/components/ThemedText.tsx +33 -0
- package/lib/__templates__/expo/client/src/components/ThemedView.tsx +38 -0
- package/lib/__templates__/expo/client/src/constants/theme.ts +850 -0
- package/lib/__templates__/expo/client/src/contexts/AuthContext.tsx +49 -0
- package/lib/__templates__/expo/client/{hooks → src/hooks}/useTheme.ts +1 -1
- package/lib/__templates__/expo/client/{screens → src/screens}/home/index.tsx +1 -5
- package/lib/__templates__/expo/client/src/screens/home/styles.ts +60 -0
- package/lib/__templates__/expo/client/{utils → src/utils}/index.ts +1 -2
- package/lib/__templates__/expo/client/tsconfig.json +24 -0
- package/lib/__templates__/expo/package.json +29 -14
- package/lib/__templates__/expo/pnpm-lock.yaml +549 -351
- package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
- package/lib/__templates__/expo/server/package.json +17 -0
- package/lib/__templates__/expo/{src → server/src}/index.ts +2 -2
- package/lib/__templates__/expo/template.config.js +1 -1
- package/lib/__templates__/expo/tsconfig.json +1 -24
- package/lib/__templates__/nextjs/.coze +3 -3
- package/lib/__templates__/nextjs/README.md +341 -19
- package/lib/__templates__/nextjs/_npmrc +1 -1
- package/lib/__templates__/nextjs/components.json +21 -0
- package/lib/__templates__/nextjs/package.json +54 -1
- package/lib/__templates__/nextjs/pnpm-lock.yaml +7947 -1523
- package/lib/__templates__/nextjs/scripts/dev.sh +9 -27
- package/lib/__templates__/nextjs/src/app/globals.css +114 -11
- package/lib/__templates__/nextjs/src/app/layout.tsx +18 -18
- package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
- package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
- package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
- package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
- package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
- package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
- package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
- package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
- package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
- package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
- package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
- package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
- package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
- package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
- package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
- package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
- package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
- package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
- package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
- package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
- package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
- package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
- package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
- package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
- package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
- package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
- package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
- package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
- package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
- package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
- package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
- package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +56 -0
- package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
- package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
- package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
- package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +726 -0
- package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
- package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
- package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
- package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
- package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
- package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
- package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
- package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
- package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
- package/lib/__templates__/nextjs/template.config.js +2 -2
- package/lib/__templates__/templates.json +6 -37
- package/lib/__templates__/vite/.coze +3 -3
- package/lib/__templates__/vite/README.md +204 -26
- package/lib/__templates__/vite/_npmrc +1 -1
- package/lib/__templates__/vite/package.json +1 -1
- package/lib/__templates__/vite/pnpm-lock.yaml +120 -120
- package/lib/__templates__/vite/scripts/dev.sh +7 -26
- package/lib/__templates__/vite/template.config.js +11 -2
- package/lib/__templates__/vite/vite.config.ts +3 -3
- package/lib/cli.js +426 -249
- package/package.json +9 -4
- package/lib/__templates__/expo/app.json +0 -63
- package/lib/__templates__/expo/babel.config.js +0 -9
- package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
- package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
- package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
- package/lib/__templates__/expo/client/app/+not-found.tsx +0 -79
- package/lib/__templates__/expo/client/constants/theme.ts +0 -118
- package/lib/__templates__/expo/client/contexts/AuthContext.tsx +0 -142
- package/lib/__templates__/expo/client/index.js +0 -11
- package/lib/__templates__/expo/client/screens/home/styles.ts +0 -332
- package/lib/__templates__/expo/metro.config.js +0 -53
- package/lib/__templates__/react-rsbuild/.coze +0 -11
- package/lib/__templates__/react-rsbuild/.vscode/settings.json +0 -121
- package/lib/__templates__/react-rsbuild/README.md +0 -61
- package/lib/__templates__/react-rsbuild/_gitignore +0 -97
- package/lib/__templates__/react-rsbuild/_npmrc +0 -22
- package/lib/__templates__/react-rsbuild/package.json +0 -31
- package/lib/__templates__/react-rsbuild/pnpm-lock.yaml +0 -997
- package/lib/__templates__/react-rsbuild/rsbuild.config.ts +0 -13
- package/lib/__templates__/react-rsbuild/scripts/build.sh +0 -14
- package/lib/__templates__/react-rsbuild/scripts/dev.sh +0 -51
- package/lib/__templates__/react-rsbuild/scripts/start.sh +0 -15
- package/lib/__templates__/react-rsbuild/src/App.tsx +0 -60
- package/lib/__templates__/react-rsbuild/src/index.css +0 -21
- package/lib/__templates__/react-rsbuild/src/index.html +0 -12
- package/lib/__templates__/react-rsbuild/src/index.tsx +0 -16
- package/lib/__templates__/react-rsbuild/tailwind.config.js +0 -9
- package/lib/__templates__/react-rsbuild/template.config.js +0 -54
- package/lib/__templates__/react-rsbuild/tsconfig.json +0 -17
- package/lib/__templates__/rsbuild/.coze +0 -11
- package/lib/__templates__/rsbuild/.vscode/settings.json +0 -7
- package/lib/__templates__/rsbuild/README.md +0 -61
- package/lib/__templates__/rsbuild/_gitignore +0 -97
- package/lib/__templates__/rsbuild/_npmrc +0 -22
- package/lib/__templates__/rsbuild/package.json +0 -24
- package/lib/__templates__/rsbuild/pnpm-lock.yaml +0 -888
- package/lib/__templates__/rsbuild/rsbuild.config.ts +0 -12
- package/lib/__templates__/rsbuild/scripts/build.sh +0 -14
- package/lib/__templates__/rsbuild/scripts/dev.sh +0 -51
- package/lib/__templates__/rsbuild/scripts/start.sh +0 -15
- package/lib/__templates__/rsbuild/src/index.css +0 -21
- package/lib/__templates__/rsbuild/src/index.html +0 -12
- package/lib/__templates__/rsbuild/src/index.ts +0 -5
- package/lib/__templates__/rsbuild/src/main.ts +0 -65
- package/lib/__templates__/rsbuild/tailwind.config.js +0 -9
- package/lib/__templates__/rsbuild/template.config.js +0 -56
- package/lib/__templates__/rsbuild/tsconfig.json +0 -16
- /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
- /package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +0 -0
- /package/lib/__templates__/expo/client/{app → src/app}/_layout.tsx +0 -0
- /package/lib/__templates__/expo/client/{assets → src/assets}/fonts/SpaceMono-Regular.ttf +0 -0
- /package/lib/__templates__/expo/client/{assets → src/assets}/images/adaptive-icon.png +0 -0
- /package/lib/__templates__/expo/client/{assets → src/assets}/images/default-avatar.png +0 -0
- /package/lib/__templates__/expo/client/{assets → src/assets}/images/favicon.png +0 -0
- /package/lib/__templates__/expo/client/{assets → src/assets}/images/icon.png +0 -0
- /package/lib/__templates__/expo/client/{assets → src/assets}/images/partial-react-logo.png +0 -0
- /package/lib/__templates__/expo/client/{assets → src/assets}/images/react-logo.png +0 -0
- /package/lib/__templates__/expo/client/{assets → src/assets}/images/react-logo@2x.png +0 -0
- /package/lib/__templates__/expo/client/{assets → src/assets}/images/react-logo@3x.png +0 -0
- /package/lib/__templates__/expo/client/{assets → src/assets}/images/splash-icon.png +0 -0
- /package/lib/__templates__/expo/client/{components → src/components}/Screen.tsx +0 -0
- /package/lib/__templates__/expo/client/{components → src/components}/SmartDateInput.tsx +0 -0
- /package/lib/__templates__/expo/client/{hooks → src/hooks}/useColorScheme.ts +0 -0
|
@@ -18,7 +18,7 @@ try {
|
|
|
18
18
|
try {
|
|
19
19
|
depcheckOutput = execSync('npx depcheck --json', {
|
|
20
20
|
encoding: 'utf-8',
|
|
21
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
21
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
22
22
|
});
|
|
23
23
|
} catch (execError) {
|
|
24
24
|
// depcheck 返回非零退出码时仍然有输出
|
|
@@ -30,10 +30,34 @@ try {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const result = JSON.parse(depcheckOutput);
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
// 获取缺失的依赖
|
|
35
35
|
const missing = result.missing || {};
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
// 需要忽略的文件模式
|
|
38
|
+
const ignoreFilePatterns = [
|
|
39
|
+
/template\.config\.(ts|js)$/, // 模板配置文件
|
|
40
|
+
/\.template\./, // 其他模板文件
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
// 过滤包:排除内部别名和只被模板文件引用的包
|
|
44
|
+
const missingPackages = Object.keys(missing).filter(pkg => {
|
|
45
|
+
// 排除内部路径别名
|
|
46
|
+
if (pkg.startsWith('@api/') || pkg.startsWith('@/') || pkg === '@api') {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 获取引用该包的文件列表
|
|
51
|
+
const referencingFiles = missing[pkg] || [];
|
|
52
|
+
|
|
53
|
+
// 过滤掉模板配置文件
|
|
54
|
+
const nonTemplateFiles = referencingFiles.filter(file => {
|
|
55
|
+
return !ignoreFilePatterns.some(pattern => pattern.test(file));
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// 只有当存在非模板文件引用时才保留该包
|
|
59
|
+
return nonTemplateFiles.length > 0;
|
|
60
|
+
});
|
|
37
61
|
|
|
38
62
|
if (missingPackages.length === 0) {
|
|
39
63
|
console.log('✅ 没有发现缺失的依赖!');
|
|
@@ -44,30 +68,31 @@ try {
|
|
|
44
68
|
missingPackages.forEach((pkg, index) => {
|
|
45
69
|
const files = missing[pkg];
|
|
46
70
|
console.log(` ${index + 1}. ${pkg}`);
|
|
47
|
-
console.log(
|
|
71
|
+
console.log(
|
|
72
|
+
` 被引用于: ${files.slice(0, 2).join(', ')}${files.length > 2 ? ' ...' : ''}`,
|
|
73
|
+
);
|
|
48
74
|
});
|
|
49
75
|
|
|
50
76
|
console.log('\n🚀 开始安装...\n');
|
|
51
77
|
|
|
52
78
|
// 使用 expo install 安装所有缺失的包
|
|
53
79
|
const packagesToInstall = missingPackages.join(' ');
|
|
54
|
-
|
|
80
|
+
|
|
55
81
|
try {
|
|
56
82
|
execSync(`pnpm expo install ${packagesToInstall}`, {
|
|
57
|
-
stdio: 'inherit'
|
|
83
|
+
stdio: 'inherit',
|
|
58
84
|
});
|
|
59
|
-
|
|
85
|
+
|
|
60
86
|
console.log('\n✅ 所有缺失的依赖已安装完成!');
|
|
61
87
|
} catch (installError) {
|
|
62
88
|
console.log('\n⚠️ expo install 失败,尝试使用 npm install...\n');
|
|
63
|
-
|
|
89
|
+
|
|
64
90
|
execSync(`npm install ${packagesToInstall}`, {
|
|
65
|
-
stdio: 'inherit'
|
|
91
|
+
stdio: 'inherit',
|
|
66
92
|
});
|
|
67
|
-
|
|
93
|
+
|
|
68
94
|
console.log('\n✅ 所有缺失的依赖已通过 npm 安装完成!');
|
|
69
95
|
}
|
|
70
|
-
|
|
71
96
|
} catch (error) {
|
|
72
97
|
if (error.message.includes('depcheck')) {
|
|
73
98
|
console.error('❌ depcheck 未安装或运行失败');
|
|
@@ -77,4 +102,3 @@ try {
|
|
|
77
102
|
}
|
|
78
103
|
process.exit(1);
|
|
79
104
|
}
|
|
80
|
-
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@/screens/home'
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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' | 'secondary' | '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
|
+
secondary: 'backgroundSecondary',
|
|
16
|
+
tertiary: 'backgroundTertiary',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function ThemedView({
|
|
20
|
+
level = 'root',
|
|
21
|
+
backgroundColor,
|
|
22
|
+
style,
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}: ThemedViewProps) {
|
|
26
|
+
const { theme } = useTheme();
|
|
27
|
+
const bgColor = backgroundColor ?? (theme as any)[backgroundMap[level]];
|
|
28
|
+
|
|
29
|
+
const viewStyle: ViewStyle = {
|
|
30
|
+
backgroundColor: bgColor,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View style={[viewStyle, style]} {...props}>
|
|
35
|
+
{children}
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
}
|