-
Notifications
You must be signed in to change notification settings - Fork 114
/
init.sh
executable file
·60 lines (51 loc) · 1.22 KB
/
init.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
#!/usr/bin/env bash
delete_composition()
{
rm pages/composition-api.vue
sed -i.bak '/@nuxtjs\/composition-api/d' package.json
sed -i.bak '/@nuxtjs\/composition-api/d' nuxt.config.ts
sed -i.bak "s/'Composition API'//" pages/index.vue
}
delete_class()
{
rm pages/class-api.vue
sed -i.bak '/nuxt-property-decorator/d' package.json
sed -i.bak "s/'Class API', //" pages/index.vue
}
delete_options()
{
rm pages/options-api.vue
sed -i.bak "s/'Options API', //" pages/index.vue
}
use_options()
{
delete_composition
delete_class
}
use_class()
{
delete_composition
delete_options
}
use_composition()
{
delete_class
delete_options
}
case $COMPONENT_API in
options ) use_options;;
class ) use_class;;
compositon ) use_composition;;
*)
echo "Which component style do you prefer?"
select choice in "Options API" "Class API" "Composition API"; do
case $choice in
'Options API' ) use_options; break;;
'Class API' ) use_class; break;;
'Composition API' ) use_composition; break;;
esac
done
;;
esac
rm -f package.json.bak nuxt.config.ts.bak pages/index.vue.bak init.sh
echo "Initialized with your choice!\n\nRun npm/yarn install, then commit all changes"