@coze-arch/cli 0.0.1-alpha.c53937 → 0.0.1-alpha.c9a2ba

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 (87) hide show
  1. package/lib/__templates__/expo/.coze +3 -3
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +226 -0
  4. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
  5. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +3 -4
  6. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
  7. package/lib/__templates__/expo/README.md +68 -7
  8. package/lib/__templates__/expo/_gitignore +1 -1
  9. package/lib/__templates__/expo/_npmrc +2 -4
  10. package/lib/__templates__/expo/client/app/+not-found.tsx +15 -64
  11. package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
  12. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  13. package/lib/__templates__/expo/client/app.config.ts +76 -0
  14. package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
  15. package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
  16. package/lib/__templates__/expo/client/components/ThemedView.tsx +37 -0
  17. package/lib/__templates__/expo/client/constants/theme.ts +116 -67
  18. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  19. package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +33 -10
  20. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
  21. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  22. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  23. package/lib/__templates__/expo/client/metro.config.js +121 -0
  24. package/lib/__templates__/expo/client/package.json +95 -0
  25. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  26. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  27. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +1 -0
  28. package/lib/__templates__/expo/client/tsconfig.json +24 -0
  29. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  30. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  31. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  32. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  33. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  34. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  35. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  36. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  37. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  38. package/lib/__templates__/expo/package.json +11 -107
  39. package/lib/__templates__/expo/patches/expo@54.0.32.patch +45 -0
  40. package/lib/__templates__/expo/pnpm-lock.yaml +1470 -3377
  41. package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
  42. package/lib/__templates__/expo/server/build.js +21 -0
  43. package/lib/__templates__/expo/server/package.json +32 -0
  44. package/lib/__templates__/expo/server/src/index.ts +19 -0
  45. package/lib/__templates__/expo/server/tsconfig.json +24 -0
  46. package/lib/__templates__/expo/template.config.js +1 -0
  47. package/lib/__templates__/expo/tsconfig.json +1 -24
  48. package/lib/__templates__/nextjs/.babelrc +15 -0
  49. package/lib/__templates__/nextjs/.coze +1 -0
  50. package/lib/__templates__/nextjs/_npmrc +1 -0
  51. package/lib/__templates__/nextjs/next.config.ts +12 -0
  52. package/lib/__templates__/nextjs/package.json +11 -2
  53. package/lib/__templates__/nextjs/pnpm-lock.yaml +2606 -1723
  54. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  55. package/lib/__templates__/nextjs/src/app/globals.css +109 -89
  56. package/lib/__templates__/nextjs/src/app/layout.tsx +5 -14
  57. package/lib/__templates__/nextjs/src/app/page.tsx +35 -23
  58. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  59. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  60. package/lib/__templates__/nextjs/template.config.js +30 -0
  61. package/lib/__templates__/templates.json +61 -43
  62. package/lib/__templates__/vite/.coze +1 -0
  63. package/lib/__templates__/vite/_npmrc +1 -0
  64. package/lib/__templates__/vite/eslint.config.mjs +9 -0
  65. package/lib/__templates__/vite/package.json +10 -1
  66. package/lib/__templates__/vite/pnpm-lock.yaml +3115 -126
  67. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  68. package/lib/__templates__/vite/src/main.ts +1 -2
  69. package/lib/__templates__/vite/template.config.js +30 -4
  70. package/lib/cli.js +989 -131
  71. package/package.json +8 -3
  72. package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +0 -109
  73. package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +0 -235
  74. package/lib/__templates__/expo/app.json +0 -63
  75. package/lib/__templates__/expo/babel.config.js +0 -19
  76. package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
  77. package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
  78. package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
  79. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
  80. package/lib/__templates__/expo/client/index.js +0 -12
  81. package/lib/__templates__/expo/client/screens/home/index.tsx +0 -51
  82. package/lib/__templates__/expo/client/screens/home/styles.ts +0 -60
  83. package/lib/__templates__/expo/metro.config.js +0 -51
  84. package/lib/__templates__/expo/src/index.ts +0 -12
  85. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  86. package/lib/__templates__/vite/.vscode/settings.json +0 -7
  87. /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
@@ -0,0 +1,88 @@
1
+ module.exports = {
2
+ meta: {
3
+ type: 'problem',
4
+ docs: {
5
+ description:
6
+ 'Disallow passing useAnimatedScrollHandler return value to ScrollView',
7
+ recommended: 'error',
8
+ },
9
+ schema: [],
10
+ messages: {
11
+ noUseAnimatedScrollHandlerOnScroll:
12
+ 'Do not pass useAnimatedScrollHandler return value to ScrollView, pass to Animated.ScrollView instead.',
13
+ },
14
+ },
15
+
16
+ create(context) {
17
+ // 记录 useAnimatedScrollHandler 的本地名字
18
+ let useAnimatedScrollHandlerImportName = null;
19
+ // 记录 ScrollView 的本地名字
20
+ let scrollViewImportName = null;
21
+ // 记录调用 useAnimatedScrollHandler 返回值的变量名
22
+ const animatedScrollHandlerVars = new Set();
23
+
24
+ return {
25
+ ImportDeclaration(node) {
26
+ if (node.source.value === 'react-native-reanimated') {
27
+ for (const specifier of node.specifiers) {
28
+ if (
29
+ specifier.type === 'ImportSpecifier' &&
30
+ specifier.imported.name === 'useAnimatedScrollHandler'
31
+ ) {
32
+ useAnimatedScrollHandlerImportName = specifier.local.name;
33
+ }
34
+ }
35
+ }
36
+
37
+ if (node.source.value === 'react-native') {
38
+ for (const specifier of node.specifiers) {
39
+ if (
40
+ specifier.type === 'ImportSpecifier' &&
41
+ specifier.imported.name === 'ScrollView'
42
+ ) {
43
+ scrollViewImportName = specifier.local.name;
44
+ }
45
+ }
46
+ }
47
+ },
48
+
49
+ VariableDeclarator(node) {
50
+ if (
51
+ node.init &&
52
+ node.init.type === 'CallExpression' &&
53
+ node.init.callee.type === 'Identifier' &&
54
+ node.init.callee.name === useAnimatedScrollHandlerImportName
55
+ ) {
56
+ if (node.id.type === 'Identifier') {
57
+ animatedScrollHandlerVars.add(node.id.name);
58
+ }
59
+ }
60
+ },
61
+
62
+ JSXOpeningElement(node) {
63
+ if (
64
+ node.name.type === 'JSXIdentifier' &&
65
+ node.name.name === scrollViewImportName
66
+ ) {
67
+ for (const attr of node.attributes) {
68
+ if (
69
+ attr.type === 'JSXAttribute' &&
70
+ attr.name.name === 'onScroll' &&
71
+ attr.value &&
72
+ attr.value.type === 'JSXExpressionContainer' &&
73
+ attr.value.expression.type === 'Identifier'
74
+ ) {
75
+ const varName = attr.value.expression.name;
76
+ if (animatedScrollHandlerVars.has(varName)) {
77
+ context.report({
78
+ node: attr,
79
+ messageId: 'noUseAnimatedScrollHandlerOnScroll',
80
+ });
81
+ }
82
+ }
83
+ }
84
+ }
85
+ },
86
+ };
87
+ },
88
+ };
@@ -1,114 +1,15 @@
1
1
  {
2
- "name": "<%= appName %>",
3
- "version": "1.0.0",
2
+ "name": "expo-express-monorepo",
4
3
  "private": true,
5
- "main": "client/index.js",
4
+ "version": "0.0.0",
6
5
  "scripts": {
7
- "build": "bash .cozeproj/scripts/deploy_build.sh",
8
- "check-deps": "npx depcheck",
9
- "dev": "bash .cozeproj/scripts/deploy_run.sh",
10
- "preinstall": "npx only-allow pnpm",
11
- "postinstall": "node ./client/scripts/install-missing-deps.js",
12
- "install-missing": "node ./client/scripts/install-missing-deps.js",
13
- "lint": "expo lint",
14
- "server": "NODE_ENV=development tsx ./src/index.ts",
15
- "server:build": "pnpm exec esbuild src/index.ts --platform=node --packages=external --bundle --format=esm --outdir=src_dist",
16
- "server:prod": "NODE_ENV=production PORT=${PORT:-5000} node src_dist/index.js",
17
- "start": "expo start --web",
18
- "test": "jest --watchAll"
19
- },
20
- "jest": {
21
- "preset": "jest-expo"
22
- },
23
- "dependencies": {
24
- "@aws-sdk/client-s3": "^3.958.0",
25
- "@aws-sdk/lib-storage": "^3.958.0",
26
- "@expo/metro-runtime": "^6.1.2",
27
- "@expo/vector-icons": "^15.0.0",
28
- "@react-native-async-storage/async-storage": "^2.2.0",
29
- "@react-native-community/datetimepicker": "^8.5.0",
30
- "@react-native-community/slider": "^5.0.1",
31
- "@react-native-masked-view/masked-view": "^0.3.2",
32
- "@react-native-picker/picker": "^2.11.0",
33
- "@react-navigation/bottom-tabs": "^7.2.0",
34
- "@react-navigation/native": "^7.0.14",
35
- "ajv": "^8.17.1",
36
- "ajv-formats": "^3.0.1",
37
- "connect": "^3.7.0",
38
- "coze-coding-dev-sdk": "^0.5.5",
39
- "dayjs": "^1.11.19",
40
- "drizzle-kit": "^0.31.8",
41
- "drizzle-orm": "^0.45.1",
42
- "drizzle-zod": "^0.8.3",
43
- "expo": "^54.0.7",
44
- "expo-auth-session": "^7.0.9",
45
- "expo-av": "~16.0.6",
46
- "expo-blur": "~15.0.6",
47
- "expo-camera": "~17.0.10",
48
- "expo-constants": "~18.0.8",
49
- "expo-crypto": "^15.0.7",
50
- "expo-font": "~14.0.7",
51
- "expo-haptics": "~15.0.6",
52
- "expo-image-picker": "~17.0.7",
53
- "expo-linear-gradient": "~15.0.6",
54
- "expo-linking": "~8.0.7",
55
- "expo-location": "~19.0.7",
56
- "expo-router": "~6.0.0",
57
- "expo-splash-screen": "~31.0.8",
58
- "expo-status-bar": "~3.0.7",
59
- "expo-symbols": "~1.0.6",
60
- "expo-system-ui": "~6.0.9",
61
- "expo-web-browser": "~15.0.10",
62
- "express": "^4.22.1",
63
- "http-proxy-middleware": "^3.0.5",
64
- "multer": "^2.0.2",
65
- "pg": "^8.16.3",
66
- "react": "19.1.0",
67
- "react-dom": "19.1.0",
68
- "react-native": "0.81.5",
69
- "react-native-chart-kit": "^6.12.0",
70
- "react-native-gesture-handler": "~2.28.0",
71
- "react-native-keyboard-aware-scroll-view": "^0.9.5",
72
- "react-native-modal-datetime-picker": "18.0.0",
73
- "react-native-reanimated": "~4.1.0",
74
- "react-native-safe-area-context": "~5.6.0",
75
- "react-native-screens": "~4.16.0",
76
- "react-native-svg": "15.15.0",
77
- "react-native-toast-message": "^2.3.3",
78
- "react-native-web": "^0.21.2",
79
- "react-native-webview": "~13.15.0",
80
- "react-native-worklets": "0.5.1",
81
- "zod": "^4.2.1"
82
- },
83
- "devDependencies": {
84
- "@babel/core": "^7.25.2",
85
- "@eslint/js": "^9.27.0",
86
- "@types/express": "^5.0.6",
87
- "@types/jest": "^29.5.12",
88
- "@types/multer": "^2.0.0",
89
- "@types/pg": "^8.16.0",
90
- "@types/react": "~19.1.0",
91
- "@types/react-test-renderer": "19.1.0",
92
- "babel-plugin-module-resolver": "^5.0.2",
93
- "babel-preset-expo": "^54.0.9",
94
- "chalk": "^4.1.2",
95
- "depcheck": "^1.4.7",
96
- "esbuild": "0.27.2",
97
- "eslint": "^9.39.2",
98
- "eslint-formatter-compact": "^9.0.1",
99
- "eslint-import-resolver-typescript": "^4.4.4",
100
- "eslint-plugin-import": "^2.32.0",
101
- "eslint-plugin-react": "^7.37.5",
102
- "eslint-plugin-react-hooks": "^7.0.1",
103
- "eslint-plugin-regexp": "^2.10.0",
104
- "globals": "^16.1.0",
105
- "jest": "^29.2.1",
106
- "jest-expo": "~54.0.10",
107
- "react-test-renderer": "19.1.0",
108
- "tsx": "^4.21.0",
109
- "typescript": "^5.8.3",
110
- "typescript-eslint": "^8.32.1"
6
+ "dev": "bash .cozeproj/scripts/dev_run.sh",
7
+ "build": "bash .cozeproj/scripts/prod_build.sh",
8
+ "start": "bash .cozeproj/scripts/prod_run.sh",
9
+ "preinstall": "npx only-allow pnpm"
111
10
  },
11
+ "dependencies": {},
12
+ "devDependencies": {},
112
13
  "packageManager": "pnpm@9.0.0",
113
14
  "engines": {
114
15
  "pnpm": ">=9.0.0"
@@ -116,6 +17,9 @@
116
17
  "pnpm": {
117
18
  "overrides": {
118
19
  "esbuild": "0.27.2"
20
+ },
21
+ "patchedDependencies": {
22
+ "expo@54.0.32": "patches/expo@54.0.32.patch"
119
23
  }
120
24
  }
121
25
  }
@@ -0,0 +1,45 @@
1
+ diff --git a/src/async-require/hmr.ts b/src/async-require/hmr.ts
2
+ index 33ce50ee2950c40d2b0553b148710f1e24e44f3d..3d78cb02dd7e96ac9727a2935d8178f2c7e95982 100644
3
+ --- a/src/async-require/hmr.ts
4
+ +++ b/src/async-require/hmr.ts
5
+ @@ -216,6 +216,40 @@ const HMRClient: HMRClientNativeInterface = {
6
+
7
+ client.on('update-done', () => {
8
+ hideLoading();
9
+ + if (process.env.EXPO_PUBLIC_COZE_PROJECT_ID && typeof window !== 'undefined' && window.location) {
10
+ + if((window as any).__updateTimeoutId) {
11
+ + clearTimeout((window as any).__updateTimeoutId);
12
+ + }
13
+ + const updateDoneTime = Date.now();
14
+ + (window as any).__updateDoneTime = updateDoneTime;
15
+ + (window as any).__updateTimeoutId = setTimeout(() => {
16
+ + const lastUpdateTime = (window as any).__updateDoneTime;
17
+ + if (lastUpdateTime !== updateDoneTime) return;
18
+ + const checkServerAndReload = (retriesLeft: number) => {
19
+ + if ((window as any).__updateDoneTime !== updateDoneTime) return;
20
+ + fetch(`/favicon.ico?_t=${Date.now()}`)
21
+ + .then((response) => {
22
+ + if (response.status === 200) {
23
+ + console.warn('[HMR] Server is ready (200), reloading now.');
24
+ + window.location.reload();
25
+ + } else {
26
+ + throw new Error(`Server status: ${response.status}`);
27
+ + }
28
+ + }).catch((error) => {
29
+ + console.warn(`[HMR] Check failed (${error.message}). Retries left: ${retriesLeft}`);
30
+ + if (retriesLeft > 0) {
31
+ + setTimeout(() => {
32
+ + checkServerAndReload(retriesLeft - 1);
33
+ + }, 5000);
34
+ + } else {
35
+ + console.error('[HMR] Server unreachable after 6 attempts. Abort reload.');
36
+ + }
37
+ + });
38
+ + };
39
+ + checkServerAndReload(6);
40
+ + }, 35_000);
41
+ + }
42
+ + console.log('[HMR] Update done.');
43
+ });
44
+
45
+ client.on('error', (data: { type: string; message: string }) => {