summaryrefslogtreecommitdiff
path: root/manage
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2022-01-04 19:44:51 +0100
committerGitHub <noreply@github.com>2022-01-04 19:44:51 +0100
commit00d3a7477c01981a6ef2d396332670ad5b831fa6 (patch)
treed7002bbc90cdf52c8f65e8f709f6766a6d6d8ef6 /manage
parent8eb3167fba1f7aacbd4eb3da8615a3e58f249eb3 (diff)
parentc7f274041445f12a50204d1920065b58d5a21613 (diff)
Merge pull request #664 from return42/themes.live
[mod] manage: add themes.live command (rebuild on modification)
Diffstat (limited to 'manage')
-rwxr-xr-xmanage46
1 files changed, 40 insertions, 6 deletions
diff --git a/manage b/manage
index bf202cb6..9f99ad4f 100755
--- a/manage
+++ b/manage
@@ -120,6 +120,17 @@ fi
# needed by sphinx-docs
export DOCS_BUILD
+webapp.run() {
+ SEARXNG_DEBUG=1 pyenv.cmd python -m searx.webapp &
+ sleep 3
+ if [ "${LIVE_THEME}" ]; then
+ themes.live "${LIVE_THEME}" &
+ fi
+ xdg-open http://127.0.0.1:8888/
+ wait -n
+ kill 0
+}
+
buildenv() {
# settings file from repository's working tree are used by default
@@ -514,12 +525,15 @@ gecko.driver() {
dump_return $?
}
-node.env() {
+nodejs.ensure() {
if ! nvm.min_node "${NODE_MINIMUM_VERSION}"; then
info_msg "install Node.js by NVM"
nvm.nodejs
fi
+}
+node.env() {
+ nodejs.ensure
( set -e
build_msg INSTALL "searx/static/themes/oscar/package.json"
@@ -701,6 +715,30 @@ themes.all() {
dump_return $?
}
+themes.live() {
+ local LIVE_THEME="${LIVE_THEME:-${1}}"
+ case "${LIVE_THEME}" in
+ simple|oscar)
+ theme="searx/static/themes/${LIVE_THEME}"
+ ;;
+ '')
+ die_caller 42 "missing theme argument"
+ ;;
+ *)
+ die_caller 42 "unknown theme '${LIVE_THEME}' // [simple|oscar]'"
+ ;;
+ esac
+ build_msg GRUNT "theme: $1 (live build)"
+ nodejs.ensure
+ cd "${theme}"
+ {
+ npm install
+ npm run watch
+ } 2>&1 \
+ | prefix_stdout "${_Blue}THEME ${1} ${_creset} " \
+ | grep -E --ignore-case --color 'error[s]?[:]? |warning[s]?[:]? |'
+}
+
themes.oscar() {
build_msg GRUNT "theme: oscar"
npm --prefix searx/static/themes/oscar run build
@@ -708,7 +746,6 @@ themes.oscar() {
}
themes.simple() {
- local static="searx/static/themes/simple"
( set -e
build_msg GRUNT "theme: simple"
npm --prefix searx/static/themes/simple run build
@@ -718,10 +755,7 @@ themes.simple() {
themes.simple.test() {
build_msg TEST "theme: simple"
- if ! nvm.min_node "${NODE_MINIMUM_VERSION}"; then
- info_msg "install Node.js by NVM"
- nvm.nodejs
- fi
+ nodejs.ensure
npm --prefix searx/static/themes/simple install
npm --prefix searx/static/themes/simple run test
dump_return $?