@lowdefy/codemods 0.0.0-experimental-20260318092212
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/LICENSE +201 -0
- package/package.json +20 -0
- package/registry.json +111 -0
- package/v5-0-0/01-rename-areas-to-slots.md +56 -0
- package/v5-0-0/02-migrate-properties-style.md +103 -0
- package/v5-0-0/03-migrate-inline-style-props.md +109 -0
- package/v5-0-0/04-bordered-to-variant.md +73 -0
- package/v5-0-0/05-simple-prop-renames.md +127 -0
- package/v5-0-0/06-tabs-position-to-placement.md +85 -0
- package/v5-0-0/07-notification-message-to-title.md +83 -0
- package/v5-0-0/08-divider-dual-rename.md +108 -0
- package/v5-0-0/09-button-type-to-color-variant.md +131 -0
- package/v5-0-0/10-detect-styles-less.md +105 -0
- package/v5-0-0/11-detect-date-formats.md +78 -0
- package/v5-0-0/12-migrate-meta-styles.md +149 -0
- package/v5-0-0/13-rename-xxl-to-2xl.md +39 -0
- package/v5-0-0/14-rename-gutter-to-gap.md +78 -0
- package/v5-0-0/15-rename-content-prefix.md +67 -0
- package/v5-0-0/16-rename-align-to-selfAlign.md +44 -0
- package/v5-0-0/17-rename-moment-to-dayjs.md +41 -0
- package/v5-0-0/18-report-thresholds-usage.md +37 -0
- package/v5-0-0/19-responsive-style-breakpoints.md +121 -0
- package/v5-0-0/20-comment-block-removal.md +229 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Migration: Replace Comment Blocks
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
|
|
5
|
+
The Comment component was removed from antd v6. Lowdefy blocks that use `type: Comment` must be replaced with equivalent compositions using available blocks (Card, Flex, Avatar, Title, Paragraph, Button).
|
|
6
|
+
|
|
7
|
+
## What to Do
|
|
8
|
+
|
|
9
|
+
For each Comment block:
|
|
10
|
+
|
|
11
|
+
1. Read the full block and understand what it displays (author, avatar, content, actions, datetime, nested comments)
|
|
12
|
+
2. Build an equivalent layout using available blocks
|
|
13
|
+
3. Preserve all data bindings, event handlers, and operator expressions
|
|
14
|
+
|
|
15
|
+
There is no 1:1 mapping — each replacement depends on how the Comment was used.
|
|
16
|
+
|
|
17
|
+
### Replacement Pattern
|
|
18
|
+
|
|
19
|
+
The typical Comment block maps to a horizontal Flex (avatar + content column):
|
|
20
|
+
|
|
21
|
+
```yaml
|
|
22
|
+
# Comment equivalent
|
|
23
|
+
- id: {comment_id}
|
|
24
|
+
type: Flex
|
|
25
|
+
properties:
|
|
26
|
+
gap: 12
|
|
27
|
+
align: start
|
|
28
|
+
slots:
|
|
29
|
+
content:
|
|
30
|
+
blocks:
|
|
31
|
+
- id: {comment_id}_avatar
|
|
32
|
+
type: Avatar
|
|
33
|
+
properties:
|
|
34
|
+
src: {avatar_value}
|
|
35
|
+
size: 32
|
|
36
|
+
- id: {comment_id}_body
|
|
37
|
+
type: Flex
|
|
38
|
+
properties:
|
|
39
|
+
vertical: true
|
|
40
|
+
gap: 4
|
|
41
|
+
slots:
|
|
42
|
+
content:
|
|
43
|
+
blocks:
|
|
44
|
+
- id: {comment_id}_header
|
|
45
|
+
type: Flex
|
|
46
|
+
properties:
|
|
47
|
+
gap: 8
|
|
48
|
+
align: center
|
|
49
|
+
slots:
|
|
50
|
+
content:
|
|
51
|
+
blocks:
|
|
52
|
+
- id: {comment_id}_author
|
|
53
|
+
type: Title
|
|
54
|
+
properties:
|
|
55
|
+
level: 5
|
|
56
|
+
content: {author_value}
|
|
57
|
+
- id: {comment_id}_time
|
|
58
|
+
type: Paragraph
|
|
59
|
+
properties:
|
|
60
|
+
content: {datetime_value}
|
|
61
|
+
type: secondary
|
|
62
|
+
- id: {comment_id}_text
|
|
63
|
+
type: Paragraph
|
|
64
|
+
properties:
|
|
65
|
+
content: {content_value}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Files to Check
|
|
69
|
+
|
|
70
|
+
Glob: `**/*.{yaml,yml}`
|
|
71
|
+
Grep: `type: Comment`
|
|
72
|
+
|
|
73
|
+
## Examples
|
|
74
|
+
|
|
75
|
+
### Before — simple comment
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
- id: user_comment
|
|
79
|
+
type: Comment
|
|
80
|
+
properties:
|
|
81
|
+
author: John Doe
|
|
82
|
+
content: This looks great!
|
|
83
|
+
avatar: /images/john.png
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### After
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
- id: user_comment
|
|
90
|
+
type: Flex
|
|
91
|
+
properties:
|
|
92
|
+
gap: 12
|
|
93
|
+
align: start
|
|
94
|
+
slots:
|
|
95
|
+
content:
|
|
96
|
+
blocks:
|
|
97
|
+
- id: user_comment_avatar
|
|
98
|
+
type: Avatar
|
|
99
|
+
properties:
|
|
100
|
+
src: /images/john.png
|
|
101
|
+
size: 32
|
|
102
|
+
- id: user_comment_body
|
|
103
|
+
type: Flex
|
|
104
|
+
properties:
|
|
105
|
+
vertical: true
|
|
106
|
+
gap: 4
|
|
107
|
+
slots:
|
|
108
|
+
content:
|
|
109
|
+
blocks:
|
|
110
|
+
- id: user_comment_author
|
|
111
|
+
type: Title
|
|
112
|
+
properties:
|
|
113
|
+
level: 5
|
|
114
|
+
content: John Doe
|
|
115
|
+
- id: user_comment_text
|
|
116
|
+
type: Paragraph
|
|
117
|
+
properties:
|
|
118
|
+
content: This looks great!
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Before — comment with actions and datetime
|
|
122
|
+
|
|
123
|
+
```yaml
|
|
124
|
+
- id: review_comment
|
|
125
|
+
type: Comment
|
|
126
|
+
properties:
|
|
127
|
+
author:
|
|
128
|
+
_state: comment.author
|
|
129
|
+
content:
|
|
130
|
+
_state: comment.text
|
|
131
|
+
avatar:
|
|
132
|
+
_state: comment.avatarUrl
|
|
133
|
+
datetime:
|
|
134
|
+
_dayjs.fromNow:
|
|
135
|
+
on:
|
|
136
|
+
_state: comment.createdAt
|
|
137
|
+
actions:
|
|
138
|
+
- Reply
|
|
139
|
+
- Like
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### After
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
- id: review_comment
|
|
146
|
+
type: Flex
|
|
147
|
+
properties:
|
|
148
|
+
gap: 12
|
|
149
|
+
align: start
|
|
150
|
+
slots:
|
|
151
|
+
content:
|
|
152
|
+
blocks:
|
|
153
|
+
- id: review_comment_avatar
|
|
154
|
+
type: Avatar
|
|
155
|
+
properties:
|
|
156
|
+
src:
|
|
157
|
+
_state: comment.avatarUrl
|
|
158
|
+
size: 32
|
|
159
|
+
- id: review_comment_body
|
|
160
|
+
type: Flex
|
|
161
|
+
properties:
|
|
162
|
+
vertical: true
|
|
163
|
+
gap: 4
|
|
164
|
+
slots:
|
|
165
|
+
content:
|
|
166
|
+
blocks:
|
|
167
|
+
- id: review_comment_header
|
|
168
|
+
type: Flex
|
|
169
|
+
properties:
|
|
170
|
+
gap: 8
|
|
171
|
+
align: center
|
|
172
|
+
slots:
|
|
173
|
+
content:
|
|
174
|
+
blocks:
|
|
175
|
+
- id: review_comment_author
|
|
176
|
+
type: Title
|
|
177
|
+
properties:
|
|
178
|
+
level: 5
|
|
179
|
+
content:
|
|
180
|
+
_state: comment.author
|
|
181
|
+
- id: review_comment_time
|
|
182
|
+
type: Paragraph
|
|
183
|
+
properties:
|
|
184
|
+
content:
|
|
185
|
+
_dayjs.fromNow:
|
|
186
|
+
on:
|
|
187
|
+
_state: comment.createdAt
|
|
188
|
+
type: secondary
|
|
189
|
+
- id: review_comment_text
|
|
190
|
+
type: Paragraph
|
|
191
|
+
properties:
|
|
192
|
+
content:
|
|
193
|
+
_state: comment.text
|
|
194
|
+
- id: review_comment_actions
|
|
195
|
+
type: Flex
|
|
196
|
+
properties:
|
|
197
|
+
gap: 8
|
|
198
|
+
slots:
|
|
199
|
+
content:
|
|
200
|
+
blocks:
|
|
201
|
+
- id: review_comment_reply
|
|
202
|
+
type: Button
|
|
203
|
+
properties:
|
|
204
|
+
title: Reply
|
|
205
|
+
variant: text
|
|
206
|
+
size: small
|
|
207
|
+
- id: review_comment_like
|
|
208
|
+
type: Button
|
|
209
|
+
properties:
|
|
210
|
+
title: Like
|
|
211
|
+
variant: text
|
|
212
|
+
size: small
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Edge Cases
|
|
216
|
+
|
|
217
|
+
- **Nested comments** (comments inside comments) need recursive Flex layouts — each child comment is another Flex group indented with left margin/padding
|
|
218
|
+
- **Comment `actions`** were antd React nodes — in Lowdefy they're typically string labels. Convert to Button blocks with `variant: text` and `size: small`
|
|
219
|
+
- **`datetime`** formatting should use `_dayjs` operators, not `_moment` (see prompt 01 of dayjs-migration codemod)
|
|
220
|
+
- **Events on Comment** (e.g., `onClick` on action buttons) must be moved to the replacement Button blocks
|
|
221
|
+
- If the Comment block used `areas`/`slots` for custom content, preserve the child blocks in the appropriate position within the Flex layout
|
|
222
|
+
|
|
223
|
+
## Verification
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
grep -rn 'type: Comment' --include='*.yaml' --include='*.yml' .
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Should return zero matches after migration.
|