Skip to content

Commit 60a2188

Browse files
committed
chore(scripts): add script for fix-event-type
1 parent 9d97d1f commit 60a2188

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ All of Style Props implementation is write in File:[Chakra__MakeProps.res](https
120120
- [x] Circle
121121
- [x] Container
122122
- [x] Flex
123+
- [ ] Spacer
123124
- [x] Grid
124125
- [ ] GridItem
125126
- [x] SimpleGrid

scripts/fix-event-type

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
refactor(){
4+
local EVENT_LIST=(
5+
"ReactEvent.Clipboard.t"
6+
"ReactEvent.Composition.t"
7+
"ReactEvent.Keyboard.t"
8+
"ReactEvent.Focus.t"
9+
"ReactEvent.Form.t"
10+
"ReactEvent.Generic.t"
11+
"ReactEvent.Mouse.t"
12+
"ReactEvent.Pointer.t"
13+
"ReactEvent.Selection.t"
14+
"ReactEvent.Touch.t"
15+
"ReactEvent.UI.t"
16+
"ReactEvent.Wheel.t"
17+
"ReactEvent.Media.t"
18+
"ReactEvent.Synthetic.t"
19+
"ReactEvent.Animation.t"
20+
)
21+
22+
command -v ack &>/dev/null || {
23+
echo "Error : need ack installed in your system before running this script"
24+
exit 1
25+
}
26+
local dir="$1"
27+
echo "start refactor in $dir"
28+
for event in "${EVENT_LIST[@]}"
29+
do
30+
cd "$dir" && ack "$event" -l | xargs perl -pi -E "s/$event/$event \=\> unit/g"
31+
done
32+
}
33+
34+
# $1 is directory target
35+
refactor $1

0 commit comments

Comments
 (0)