-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstep02_vsf_front.sh
executable file
·143 lines (136 loc) · 4.18 KB
/
step02_vsf_front.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/usr/bin/env/bash
## ************************************************************************
# Script to configure and build 'vue-storefront' app.
## ************************************************************************
# shellcheck disable=SC1090
# root directory (set before or relative to the current shell script)
DIR_ROOT=${DIR_ROOT:=$(cd "$(dirname "$0")/../" && pwd)}
# Exit immediately if a command exits with a non-zero status.
set -e -x
echo "========================================================================"
echo "Read local configuration."
echo "========================================================================"
. "${DIR_ROOT}/cfg.local.sh"
# check external vars used in this script (see cfg.[work|live].sh)
: "${ES_INDEX_NAME=:?}"
: "${REDIS_DB:?}"
: "${REDIS_HOST:?}"
: "${REDIS_PORT:?}"
: "${VSF_API_SERVER_IP:?}"
: "${VSF_API_SERVER_PORT:?}"
: "${VSF_API_WEB_HOST:?}"
: "${VSF_API_WEB_PROTOCOL:?}"
: "${VSF_FRONT_SERVER_IP:?}"
: "${VSF_FRONT_SERVER_PORT:?}"
: "${VSF_FRONT_WEB_HOST:?}"
: "${VSF_FRONT_WEB_PROTOCOL:?}"
# local context vars
DIR_APPS="/home/${USER}"
DIR_VSF="${DIR_APPS}/vue-storefront"
echo "========================================================================"
echo "Clone 'vue-storefront' application."
echo "========================================================================"
cd "${DIR_APPS}" || exit 255
git clone https://github.com/DivanteLtd/vue-storefront.git "${DIR_VSF}"
echo "========================================================================"
echo "Configure 'vue-storefront' application."
echo "========================================================================"
cd "${DIR_VSF}" || exit 255
cat <<EOM | tee "${DIR_VSF}/config/local.json" >/dev/null
{
"server": {
"host": "${VSF_FRONT_SERVER_IP}",
"port": ${VSF_FRONT_SERVER_PORT},
"protocol": "http",
"api": "api-search-query"
},
"redis": {
"host": "${REDIS_HOST}",
"port": ${REDIS_PORT},
"db": ${REDIS_DB}
},
"api": {
"url": "${VSF_API_WEB_PROTOCOL}://${VSF_API_WEB_HOST}"
},
"elasticsearch": {
"index": "${ES_INDEX_NAME}",
"indices": [
"${ES_INDEX_NAME}"
]
},
"images": {
"useExactUrlsNoProxy": false,
"baseUrl": "${VSF_API_WEB_PROTOCOL}://${VSF_API_WEB_HOST}/img/",
"productPlaceholder": "/assets/placeholder.jpg"
},
"install": {
"is_local_backend": true
},
"tax": {
"defaultCountry": "LV"
},
"i18n": {
"defaultCountry": "LV",
"defaultLanguage": "EN",
"availableLocale": ["en-US"],
"defaultLocale": "en-US",
"currencyCode": "EUR",
"currencySign": "€",
"currencySignPlacement": "preppend",
"dateFormat": "l LT",
"fullCountryName": "Latvian Republic",
"fullLanguageName": "Latvia",
"bundleAllStoreviewLanguages": true
},
"theme": "@vue-storefront/theme-capybara",
"products": {
"thumbnails": {
"width": 324,
"height": 489
}
},
"cart": {
"thumbnails": {
"width": 210,
"height": 300
}
},
"entities": {
"category": {
"categoriesDynamicPrefetch": false
},
"attribute": {
"loadByAttributeMetadata": true
}
},
"quicklink": {
"enabled": false
},
"urlModule": {
"enableMapFallbackUrl": true
}
}
EOM
echo "========================================================================"
echo "Install 'capybara' theme."
echo "========================================================================"
cd "${DIR_VSF}"
git submodule add -b master https://github.com/DivanteLtd/vsf-capybara.git src/themes/capybara
git submodule update --init --remote
sed -i 's/themes\/default/themes\/capybara/' tsconfig.json
echo "========================================================================"
echo "Build & start 'vue-storefront' application."
echo "========================================================================"
cd "${DIR_VSF}"
yarn install
# theme activity
node src/themes/capybara/scripts/generate-local-config.js
# front activity
yarn build
# theme activity
lerna bootstrap
# front activity
yarn start
echo "========================================================================"
echo "Process is completed."
echo "========================================================================"