@coze-arch/cli 0.0.10-alpha.b1a3b0 → 0.0.11-alpha.47b93c
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/AGENTS.md +3 -3
- package/lib/__templates__/expo/README.md +3 -3
- package/lib/__templates__/expo/client/eslint.config.mjs +2 -0
- package/lib/__templates__/expo/client/heroui/components/button/button.tsx +2 -2
- package/lib/__templates__/expo/client/heroui/components/chip/chip.tsx +2 -2
- package/lib/__templates__/expo/client/heroui/components/list-group/list-group.types.ts +3 -3
- package/lib/__templates__/expo/client/heroui/components/pressable-feedback/index.ts +0 -1
- package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.animation.ts +1 -0
- package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.styles.ts +0 -1
- package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.animation.ts +1 -0
- package/lib/__templates__/expo/client/heroui/components/toast/toast.tsx +4 -4
- package/lib/__templates__/expo/client/heroui/helpers/external/utils/color-kit/index.ts +5 -2
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-controllable-state.ts +1 -1
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-dev-info.ts +1 -1
- package/lib/__templates__/expo/client/heroui/primitives/slider/slider.tsx +1 -0
- package/lib/__templates__/expo/client/heroui/primitives/slot/slot.tsx +1 -0
- package/lib/__templates__/expo/package.json +1 -1
- package/lib/__templates__/nextjs/AGENTS.md +6 -4
- package/lib/__templates__/nextjs/eslint.config.mjs +9 -0
- package/lib/__templates__/taro/.coze +2 -0
- package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +1 -2
- package/lib/__templates__/taro/AGENTS.md +514 -0
- package/lib/__templates__/taro/config/index.ts +1 -1
- package/lib/__templates__/taro/package.json +1 -0
- package/lib/__templates__/taro/project.config.json +1 -1
- package/lib/cli.js +920 -691
- package/package.json +2 -2
|
@@ -54,13 +54,13 @@ Uniwind 官方文档:https://docs.uniwind.dev/llms.txt
|
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
56
|
# 对 client 和 server 目录同时进行校验
|
|
57
|
-
|
|
57
|
+
pnpm -w lint:all
|
|
58
58
|
|
|
59
59
|
# 对 client 目录进行校验
|
|
60
|
-
|
|
60
|
+
pnpm -w lint:client
|
|
61
61
|
|
|
62
62
|
# 对 server 目录进行校验
|
|
63
|
-
|
|
63
|
+
pnpm -w lint:server
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## 如何修改主题模式(跟随系统、固定暗色、固定亮色)
|
|
@@ -54,13 +54,13 @@ Uniwind 官方文档:https://docs.uniwind.dev/llms.txt
|
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
56
|
# 对 client 和 server 目录同时进行校验
|
|
57
|
-
|
|
57
|
+
pnpm -w lint:all
|
|
58
58
|
|
|
59
59
|
# 对 client 目录进行校验
|
|
60
|
-
|
|
60
|
+
pnpm -w lint:client
|
|
61
61
|
|
|
62
62
|
# 对 server 目录进行校验
|
|
63
|
-
|
|
63
|
+
pnpm -w lint:server
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## 如何修改主题模式(跟随系统、固定暗色、固定亮色)
|
|
@@ -84,6 +84,8 @@ export default [
|
|
|
84
84
|
'no-prototype-builtins': 'off',
|
|
85
85
|
'react/react-in-jsx-scope': 'off',
|
|
86
86
|
'react/jsx-uses-react': 'off',
|
|
87
|
+
'react/display-name': 'off',
|
|
88
|
+
'react/prop-types': 'off',
|
|
87
89
|
'fontawesome6/valid-name': 'error',
|
|
88
90
|
'reanimated/ban-mix-use': 'error',
|
|
89
91
|
'forbidEmoji/no-emoji': 'error',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef, useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Text as RNText } from 'react-native';
|
|
3
3
|
import { useThemeColor } from '../../helpers/external/hooks';
|
|
4
4
|
import { colorKit } from '../../helpers/external/utils';
|
|
5
5
|
import { HeroText } from '../../helpers/internal/components';
|
|
@@ -236,7 +236,7 @@ const ButtonRoot = forwardRef<PressableRef, ButtonRootProps>((props, ref) => {
|
|
|
236
236
|
|
|
237
237
|
// --------------------------------------------------
|
|
238
238
|
|
|
239
|
-
const ButtonLabel = forwardRef<
|
|
239
|
+
const ButtonLabel = forwardRef<RNText, ButtonLabelProps>((props, ref) => {
|
|
240
240
|
const { children, className, ...restProps } = props;
|
|
241
241
|
|
|
242
242
|
const { size, variant } = useButton();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef, useMemo } from 'react';
|
|
2
|
-
import { Pressable,
|
|
2
|
+
import { Pressable, Text as RNText, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
3
|
import { HeroText } from '../../helpers/internal/components';
|
|
4
4
|
import { AnimationSettingsProvider } from '../../helpers/internal/contexts';
|
|
5
5
|
import type { PressableRef } from '../../helpers/internal/types';
|
|
@@ -78,7 +78,7 @@ const Chip = forwardRef<PressableRef, ChipProps>((props, ref) => {
|
|
|
78
78
|
|
|
79
79
|
// --------------------------------------------------
|
|
80
80
|
|
|
81
|
-
const ChipLabel = forwardRef<
|
|
81
|
+
const ChipLabel = forwardRef<RNText, ChipLabelProps>((props, ref) => {
|
|
82
82
|
const { children, className, ...restProps } = props;
|
|
83
83
|
|
|
84
84
|
const { size, variant, color } = useChip();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PressableProps, ViewProps } from 'react-native';
|
|
1
|
+
import type { PressableProps, TextProps, ViewProps } from 'react-native';
|
|
2
2
|
import type { SurfaceVariant } from '../surface/surface.types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -85,7 +85,7 @@ export interface ListGroupItemContentProps extends ViewProps {
|
|
|
85
85
|
* Props for the ListGroup.ItemTitle component.
|
|
86
86
|
* Renders the primary text label for an item.
|
|
87
87
|
*/
|
|
88
|
-
export interface ListGroupItemTitleProps extends
|
|
88
|
+
export interface ListGroupItemTitleProps extends TextProps {
|
|
89
89
|
/**
|
|
90
90
|
* Title text or custom content
|
|
91
91
|
*/
|
|
@@ -100,7 +100,7 @@ export interface ListGroupItemTitleProps extends ViewProps {
|
|
|
100
100
|
* Props for the ListGroup.ItemDescription component.
|
|
101
101
|
* Renders secondary descriptive text below the title.
|
|
102
102
|
*/
|
|
103
|
-
export interface ListGroupItemDescriptionProps extends
|
|
103
|
+
export interface ListGroupItemDescriptionProps extends TextProps {
|
|
104
104
|
/**
|
|
105
105
|
* Description text or custom content
|
|
106
106
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef, useMemo } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { View, Text as RNText } from 'react-native';
|
|
3
3
|
import { GestureDetector } from 'react-native-gesture-handler';
|
|
4
4
|
import Animated from 'react-native-reanimated';
|
|
5
5
|
import { useThemeColor } from '../../helpers/external/hooks';
|
|
@@ -134,7 +134,7 @@ const ToastRoot = forwardRef<ViewRef, ToastRootProps>((props, ref) => {
|
|
|
134
134
|
{...restProps}
|
|
135
135
|
>
|
|
136
136
|
{children}
|
|
137
|
-
{/*
|
|
137
|
+
{/*
|
|
138
138
|
When visible toasts have different heights, the toast adapts to the last visible toast height.
|
|
139
139
|
In cases where a toast originally has one height and gets smaller when a new toast comes to stack,
|
|
140
140
|
content might be visible behind the last toast without proper padding.
|
|
@@ -174,7 +174,7 @@ const ToastRoot = forwardRef<ViewRef, ToastRootProps>((props, ref) => {
|
|
|
174
174
|
|
|
175
175
|
// --------------------------------------------------
|
|
176
176
|
|
|
177
|
-
const ToastTitle = forwardRef<
|
|
177
|
+
const ToastTitle = forwardRef<RNText, ToastTitleProps>((props, ref) => {
|
|
178
178
|
const { children, className, ...restProps } = props;
|
|
179
179
|
|
|
180
180
|
const { variant } = useToast();
|
|
@@ -193,7 +193,7 @@ const ToastTitle = forwardRef<View, ToastTitleProps>((props, ref) => {
|
|
|
193
193
|
|
|
194
194
|
// --------------------------------------------------
|
|
195
195
|
|
|
196
|
-
const ToastDescription = forwardRef<
|
|
196
|
+
const ToastDescription = forwardRef<RNText, ToastDescriptionProps>(
|
|
197
197
|
(props, ref) => {
|
|
198
198
|
const { children, className, ...restProps } = props;
|
|
199
199
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* eslint-disable regexp/use-ignore-case */
|
|
2
|
+
/* eslint-disable regexp/optimal-quantifier-concatenation */
|
|
3
|
+
/* eslint-disable regexp/no-useless-quantifier */
|
|
1
4
|
/**
|
|
2
5
|
* Color manipulation utilities adapted from reanimated-color-picker
|
|
3
6
|
*
|
|
@@ -293,7 +296,7 @@ export const colorKitUI = () => {
|
|
|
293
296
|
): ColorFormats | null => {
|
|
294
297
|
// color int
|
|
295
298
|
if (typeof color === 'number') {
|
|
296
|
-
|
|
299
|
+
|
|
297
300
|
if (color >>> 0 === color && color >= 0 && color <= 0xffffffff)
|
|
298
301
|
return 'hex8';
|
|
299
302
|
return null;
|
|
@@ -1491,7 +1494,7 @@ export const colorKitUI = () => {
|
|
|
1491
1494
|
): ColorFormats | 'named' | null => {
|
|
1492
1495
|
// color int
|
|
1493
1496
|
if (typeof color === 'number') {
|
|
1494
|
-
|
|
1497
|
+
|
|
1495
1498
|
if (color >>> 0 === color && color >= 0 && color <= 0xffffffff)
|
|
1496
1499
|
return 'hex8';
|
|
1497
1500
|
return null;
|
package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-controllable-state.ts
CHANGED
|
@@ -39,7 +39,7 @@ type SetStateFn<T> = (prevState?: T) => T;
|
|
|
39
39
|
function useControllableState<T>({
|
|
40
40
|
prop,
|
|
41
41
|
defaultProp,
|
|
42
|
-
onChange = () => {},
|
|
42
|
+
onChange = () => {}, // eslint-disable-line @typescript-eslint/no-empty-function
|
|
43
43
|
}: UseControllableStateParams<T>) {
|
|
44
44
|
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({
|
|
45
45
|
defaultProp,
|
|
@@ -31,7 +31,7 @@ export function useDevInfo(devInfo?: DevInfoConfig): void {
|
|
|
31
31
|
` - Check component documentation - Each component page includes a link to the component's style source\n` +
|
|
32
32
|
`• If styles are occupied by animation, modify them via the animation prop on components that support it.\n` +
|
|
33
33
|
`• To deactivate animated style completely and apply your own styles, use isAnimatedStyleActive prop.\n` +
|
|
34
|
-
`${LOG_COLOR.YELLOW}
|
|
34
|
+
`${LOG_COLOR.YELLOW} To disable this message, set config.devInfo.stylingPrinciples to false${LOG_COLOR.RESET}`
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
}, [stylingPrinciples]);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"preinstall": "npx only-allow pnpm",
|
|
10
10
|
"lint:client": "npm run lint --prefix ./client",
|
|
11
11
|
"lint:server": "npm run lint --prefix ./server",
|
|
12
|
-
"lint": "npm run lint --prefix ./client; npm run lint --prefix ./server"
|
|
12
|
+
"lint:all": "npm run lint --prefix ./client; npm run lint --prefix ./server"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {},
|
|
15
15
|
"devDependencies": {},
|
|
@@ -42,13 +42,15 @@
|
|
|
42
42
|
|
|
43
43
|
## 开发规范
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
- **Hydration 错误预防**:严禁在 JSX 渲染逻辑中直接使用 typeof window、Date.now()、Math.random() 等动态数据。必须使用 'use client' 并配合 useEffect + useState 确保动态内容仅在客户端挂载后渲染;同时严禁非法 HTML 嵌套(如 <p> 嵌套 <div>)。
|
|
45
|
+
### Hydration 问题防范
|
|
47
46
|
|
|
47
|
+
1. 严禁在 JSX 渲染逻辑中直接使用 typeof window、Date.now()、Math.random() 等动态数据。**必须使用 'use client' 并配合 useEffect + useState 确保动态内容仅在客户端挂载后渲染**;同时严禁非法 HTML 嵌套(如 <p> 嵌套 <div>)。
|
|
48
|
+
2. **禁止使用 head 标签**,优先使用 metadata,详见文档:https://nextjs.org/docs/app/api-reference/functions/generate-metadata
|
|
49
|
+
1. 三方 CSS、字体等资源可在 `globals.css` 中顶部通过 `@import` 引入或使用 next/font
|
|
50
|
+
2. preload, preconnect, dns-prefetch 通过 ReactDOM 的 preload、preconnect、dns-prefetch 方法引入
|
|
51
|
+
3. json-ld 可阅读 https://nextjs.org/docs/app/guides/json-ld
|
|
48
52
|
|
|
49
53
|
## UI 设计与组件规范 (UI & Styling Standards)
|
|
50
54
|
|
|
51
55
|
- 模板默认预装核心组件库 `shadcn/ui`,位于`src/components/ui/`目录下
|
|
52
56
|
- Next.js 项目**必须默认**采用 shadcn/ui 组件、风格和规范,**除非用户指定用其他的组件和规范。**
|
|
53
|
-
|
|
54
|
-
|
|
@@ -2,12 +2,21 @@ import nextTs from 'eslint-config-next/typescript';
|
|
|
2
2
|
import nextVitals from 'eslint-config-next/core-web-vitals';
|
|
3
3
|
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
4
4
|
|
|
5
|
+
const syntaxRules = [
|
|
6
|
+
{
|
|
7
|
+
selector: 'JSXOpeningElement[name.name="head"]',
|
|
8
|
+
message:
|
|
9
|
+
'禁止使用 head 标签,优先使用 metadata。三方 CSS、字体等资源可以在 globals.css 中顶部通过 @import 引入或者使用 next/font;preload, preconnect, dns-prefetch 通过 ReactDOM 的 preload、preconnect、dns-prefetch 方法引入;json-ld 可阅读 https://nextjs.org/docs/app/guides/json-ld',
|
|
10
|
+
},
|
|
11
|
+
];
|
|
12
|
+
|
|
5
13
|
const eslintConfig = defineConfig([
|
|
6
14
|
...nextVitals,
|
|
7
15
|
...nextTs,
|
|
8
16
|
{
|
|
9
17
|
rules: {
|
|
10
18
|
'react-hooks/set-state-in-effect': 'off',
|
|
19
|
+
'no-restricted-syntax': ['error', ...syntaxRules],
|
|
11
20
|
},
|
|
12
21
|
},
|
|
13
22
|
// Override default ignores of eslint-config-next.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# build_weapp.sh - 通过 PID 文件精确杀掉自己上次的构建进程
|
|
2
|
-
export OUTPUT_ROOT=dist
|
|
3
2
|
PID_FILE="/tmp/coze-build_weapp.pid"
|
|
4
3
|
|
|
5
4
|
# 杀掉上次的构建进程组
|
|
@@ -15,7 +14,7 @@ if [ -f "$PID_FILE" ]; then
|
|
|
15
14
|
fi
|
|
16
15
|
|
|
17
16
|
# 用 setsid 创建新的进程组,方便下次整组杀掉
|
|
18
|
-
setsid pnpm
|
|
17
|
+
setsid pnpm pack &
|
|
19
18
|
echo $! > "$PID_FILE"
|
|
20
19
|
|
|
21
20
|
echo "构建已启动 (PID: $(cat $PID_FILE))"
|