forked from karrot-dev/karrot-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codemod.sh
executable file
·72 lines (66 loc) · 2.95 KB
/
codemod.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
function mod() {
from=$1
to=$2
dir=${3:-"src test"}
for d in $dir; do
codemod -m --accept-all -d $d --extensions js,vue "$from" "$to"
done
}
if [ -d src/stores ]; then
if [ -d src/places ]; then
echo "Have both src/stores and src/places"
exit 1
fi
mv src/stores src/places
fi
mv src/maps/components/StoreMarker.vue src/maps/components/PlaceMarker.vue
mv src/history/pages/StoreHistory.vue src/history/pages/PlaceHistory.vue
mv src/pickups/components/StorePickups.vue src/pickups/components/PlacePickups.vue
mv src/places/pages/Stores.vue src/places/pages/Places.vue
mv src/places/storeStatus.js src/places/placeStatus.js
mv src/places/api/stores.js src/places/api/places.js
mv src/places/components/Store.story.js src/places/components/Place.story.js
mv src/places/components/StoreEdit.vue src/places/components/PlaceEdit.vue
mv src/places/components/StoreList.vue src/places/components/PlaceList.vue
mv src/places/datastore/stores.spec.js src/places/datastore/places.spec.js
mv src/places/datastore/index.js src/places/datastore/index.js
mv src/places/datastore/stores.js src/places/datastore/places.js
mv src/sidenav/components/StoreOptions.vue src/sidenav/components/PlaceOptions.vue
mv src/sidenav/components/StoreOptionsUI.vue src/sidenav/components/PlaceOptionsUI.vue
mv src/feedback/components/StoreFeedback.vue src/feedback/components/PlaceFeedback.vue
mv src/sidenav/components/SidenavStore.vue src/sidenav/components/SidenavPlace.vue
mv src/sidenav/components/SidenavStores.vue src/sidenav/components/SidenavPlaces.vue
mv src/sidenav/components/SidenavStoreUI.vue src/sidenav/components/SidenavPlaceUI.vue
mv src/sidenav/components/SidenavStoresUI.vue src/sidenav/components/SidenavPlacesUI.vue
mod '_store_' '_place_'
mod '_stores_' '_places_'
mod '\bstore_' 'place_'
mod '_store\b' '_place'
mod '_stores\b' '_places'
mod '\bStore\b' 'Place'
mod '([a-z])Store([A-Z])' '\1Place\2'
mod '([a-z])Store\b' '\1Place'
mod '\bStore([A-Z])' 'Place\1'
mod '\bstore([A-Z])' 'place\1'
mod '\bstores([A-Z])' 'places\1'
mod '([a-z])Stores([A-Z])' '\1Places\2'
mod '\bStores([A-Z])' 'Places\1'
mod '([a-z])Stores\b' '\1Places'
mod '\bstore\b' 'place'
mod '\bstoreStatus\b' 'placeStatus'
mod '\bstore2\b' 'place2'
mod '\bstores\b' 'places'
mod '\bStores\b' 'Places'
# Undo some over converting
mod 'Vuex.Place' 'Vuex.Store'
mod 'place: datastore' 'store: datastore'
mod '\$place' '$store'
mod 'place: createDatastore' 'store: createDatastore'
mod 'placeHelpers' 'storeHelpers' # TODO: should really be datastoreHelpers
mod '{ placeName: place.name' '{ storeName: place.name'
mod "type = 'new_place'" "type = 'new_store'"
# Some more manual single changes
sed -i 's/place\/plugins\/i18n/base\/datastore\/i18nPlugin/g' src/base/i18n.js
sed -i 's/cancel: \(place, groupId\)/cancel: \(_, groupId\)/g' src/applications/pages/ApplicationForm.vue
sed -i 's/So we just place whether we want them removed/So we just remember whether we want them removed/g' src/subscriptions/firebase.js