@coze-arch/cli 0.0.1-alpha.81a3cf → 0.0.1-alpha.8389e1

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 (91) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +30 -21
  2. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
  3. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +2 -2
  4. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +21 -2
  5. package/lib/__templates__/expo/README.md +4 -2
  6. package/lib/__templates__/expo/client/app/+not-found.tsx +30 -0
  7. package/lib/__templates__/expo/client/app/_layout.tsx +11 -8
  8. package/lib/__templates__/expo/client/app.config.ts +4 -3
  9. package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
  10. package/lib/__templates__/expo/client/components/ThemedView.tsx +1 -2
  11. package/lib/__templates__/expo/client/constants/theme.ts +21 -698
  12. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  13. package/lib/__templates__/expo/client/eslint.config.mjs +33 -10
  14. package/lib/__templates__/expo/client/hooks/{useColorScheme.ts → useColorScheme.tsx} +20 -6
  15. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  16. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  17. package/lib/__templates__/expo/client/package.json +3 -1
  18. package/lib/__templates__/expo/client/screens/demo/index.tsx +3 -3
  19. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +1 -0
  20. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  21. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  22. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  23. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  24. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  25. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  26. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  27. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  28. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  29. package/lib/__templates__/expo/package.json +3 -0
  30. package/lib/__templates__/expo/patches/expo@54.0.32.patch +45 -0
  31. package/lib/__templates__/expo/pnpm-lock.yaml +1211 -2702
  32. package/lib/__templates__/expo/server/build.js +21 -0
  33. package/lib/__templates__/expo/server/package.json +2 -2
  34. package/lib/__templates__/expo/server/src/index.ts +2 -1
  35. package/lib/__templates__/nextjs/.babelrc +15 -0
  36. package/lib/__templates__/nextjs/next.config.ts +2 -2
  37. package/lib/__templates__/nextjs/package.json +9 -1
  38. package/lib/__templates__/nextjs/pnpm-lock.yaml +2603 -1728
  39. package/lib/__templates__/nextjs/src/app/layout.tsx +5 -3
  40. package/lib/__templates__/nextjs/src/app/page.tsx +17 -61
  41. package/lib/__templates__/nextjs/template.config.js +5 -5
  42. package/lib/__templates__/taro/.coze +14 -0
  43. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  44. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +13 -0
  45. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +17 -0
  46. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +58 -0
  47. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  48. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +1 -0
  49. package/lib/__templates__/taro/README.md +687 -0
  50. package/lib/__templates__/taro/_gitignore +40 -0
  51. package/lib/__templates__/taro/_npmrc +18 -0
  52. package/lib/__templates__/taro/babel.config.js +12 -0
  53. package/lib/__templates__/taro/config/dev.ts +9 -0
  54. package/lib/__templates__/taro/config/index.ts +173 -0
  55. package/lib/__templates__/taro/config/prod.ts +35 -0
  56. package/lib/__templates__/taro/eslint.config.mjs +57 -0
  57. package/lib/__templates__/taro/key/private.appid.key +0 -0
  58. package/lib/__templates__/taro/package.json +95 -0
  59. package/lib/__templates__/taro/pnpm-lock.yaml +22430 -0
  60. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  61. package/lib/__templates__/taro/project.config.json +15 -0
  62. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  63. package/lib/__templates__/taro/server/package.json +38 -0
  64. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  65. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  66. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  67. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  68. package/lib/__templates__/taro/server/src/main.ts +37 -0
  69. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  70. package/lib/__templates__/taro/src/app.config.ts +11 -0
  71. package/lib/__templates__/taro/src/app.css +52 -0
  72. package/lib/__templates__/taro/src/app.ts +14 -0
  73. package/lib/__templates__/taro/src/index.html +20 -0
  74. package/lib/__templates__/taro/src/network.ts +39 -0
  75. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  76. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  77. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  78. package/lib/__templates__/taro/src/utils/h5-styles.ts +22 -0
  79. package/lib/__templates__/taro/src/utils/wx-debug.ts +23 -0
  80. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  81. package/lib/__templates__/taro/template.config.js +68 -0
  82. package/lib/__templates__/taro/tsconfig.json +29 -0
  83. package/lib/__templates__/taro/types/global.d.ts +32 -0
  84. package/lib/__templates__/templates.json +10 -15
  85. package/lib/__templates__/vite/package.json +6 -1
  86. package/lib/__templates__/vite/pnpm-lock.yaml +504 -982
  87. package/lib/__templates__/vite/src/main.ts +17 -48
  88. package/lib/__templates__/vite/template.config.js +6 -4
  89. package/lib/cli.js +819 -105
  90. package/package.json +1 -1
  91. package/lib/__templates__/expo/client/app/demo.tsx +0 -1
@@ -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
+ };
@@ -17,6 +17,9 @@
17
17
  "pnpm": {
18
18
  "overrides": {
19
19
  "esbuild": "0.27.2"
20
+ },
21
+ "patchedDependencies": {
22
+ "expo@54.0.32": "patches/expo@54.0.32.patch"
20
23
  }
21
24
  }
22
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 }) => {