on master help sign in
manage.sh : no error when npm is not found and not required
commitd19a0f469c0ebcead08fd9e02dbf7b1e4e5e444c authordalf <alex@al-f.net> dateSun 26 Aug 2018, 10:32 (8 years ago) parent052a71d
1 file changed+11−2
manage.sh+11−2
manage.sh+11−2
@@ -5,8 +5,6 @@ BASE_DIR="$(dirname -- "`readlink -f -- "$0"`")"
55cd -- "$BASE_DIR"
66set -e
77
8−export PATH="$(npm bin)":$PATH
9−
108# subshell
119PYTHONPATH="$BASE_DIR"
1210SEARX_DIR="$BASE_DIR/searx"
@@ -111,7 +109,14 @@ tests() {
111109# Web
112110#
113111
112+npm_path_setup() {
113+ which npm || (printf 'Error: npm is not found\n'; exit 1)
114+ export PATH="$(npm bin)":$PATH
115+}
116+
114117npm_packages() {
118+ npm_path_setup
119+
115120 echo '[!] install NPM packages'
116121 cd -- "$BASE_DIR"
117122 npm install less@2.7 less-plugin-clean-css grunt-cli
@@ -126,10 +131,14 @@ npm_packages() {
126131}
127132
128133build_style() {
134+ npm_path_setup
135+
129136 lessc --clean-css="--s1 --advanced --compatibility=ie9" "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
130137}
131138
132139styles() {
140+ npm_path_setup
141+
133142 echo '[!] Building legacy style'
134143 build_style themes/legacy/less/style.less themes/legacy/css/style.css
135144 build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css