@coze-arch/cli 0.0.7 → 0.0.8-alpha.fe3c0f

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 +46 -17
  2. package/lib/__templates__/expo/README.md +46 -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 +15 -4
  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
@@ -1,24 +1,18 @@
1
1
  import { View, Text } from 'react-native';
2
2
  import { Image } from 'expo-image';
3
3
 
4
- import { useTheme } from '@/hooks/useTheme';
5
4
  import { Screen } from '@/components/Screen';
6
- import { styles } from './styles';
7
5
 
8
6
  export default function DemoPage() {
9
- const { theme, isDark } = useTheme();
10
-
11
7
  return (
12
- <Screen backgroundColor={theme.backgroundRoot} statusBarStyle={isDark ? 'light' : 'dark'}>
13
- <View
14
- style={styles.container}
15
- >
8
+ <Screen statusBarStyle="auto">
9
+ <View className="absolute top-0 left-0 w-full h-full flex flex-col items-center justify-center">
16
10
  <Image
17
- style={styles.logo}
18
- source="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
19
- ></Image>
20
- <Text style={{...styles.title, color: theme.textPrimary}}>应用开发中</Text>
21
- <Text style={{...styles.description, color: theme.textSecondary}}>请稍候,界面即将呈现</Text>
11
+ className="w-[130px] h-[109px]"
12
+ source="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/expo/coze-loading.gif"
13
+ />
14
+ <Text className="text-base font-bold text-foreground">APP 开发中</Text>
15
+ <Text className="text-sm mt-2 text-muted">即将为您呈现应用界面</Text>
22
16
  </View>
23
17
  </Screen>
24
18
  );
@@ -0,0 +1,78 @@
1
+ import axios from 'axios'
2
+ import stylishFormatter from './stylish-formatter.mjs'
3
+ import { createMinimalClient, CustomPlugin } from './reporter.mjs'
4
+
5
+ const client = createMinimalClient()
6
+ const projectId = process.env.COZE_PROJECT_ID ?? ''
7
+
8
+ CustomPlugin(client);
9
+
10
+ client.init({
11
+ bid: 'coze_vibe_app',
12
+ transport: {
13
+ get: ({
14
+ success,
15
+ fail,
16
+ ...otherOptions
17
+ }) => {
18
+ axios({
19
+ method: 'get',
20
+ ...otherOptions,
21
+ }).then((res) => {
22
+ success && success(res.data)
23
+ }).catch(fail)
24
+ },
25
+ post: options => {
26
+ axios({
27
+ method: 'post',
28
+ ...options,
29
+ }).finally(() => {
30
+ console.log('\n')
31
+ })
32
+ },
33
+ }
34
+ })
35
+
36
+ client.start()
37
+
38
+ function normalizeESLintRuleId(ruleId) {
39
+ return ruleId?.replace(/[/-]/g, '_')
40
+ }
41
+
42
+ function reportESLintRulesMetrics(results) {
43
+ const metrics = {}
44
+ for (const { messages } of results) {
45
+ for (const message of messages) {
46
+ if (message.severity !== 2) {
47
+ continue
48
+ }
49
+
50
+ const normalizedRuleId = normalizeESLintRuleId(message.ruleId)
51
+ if (!normalizedRuleId) {
52
+ continue
53
+ }
54
+ metrics[normalizedRuleId] = (metrics[normalizedRuleId] ?? 0) + 1
55
+ }
56
+ }
57
+ try {
58
+ client.sendEvent({
59
+ name: 'eslint_rules',
60
+ metrics,
61
+ categories: {
62
+ project_id: projectId,
63
+ },
64
+ })
65
+ } catch (e) {
66
+
67
+ }
68
+ }
69
+
70
+ function formatter(results, data) {
71
+ if (projectId) {
72
+ reportESLintRulesMetrics(results)
73
+ }
74
+
75
+ return stylishFormatter(results, data)
76
+ }
77
+
78
+ export default formatter