diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2023-08-06 16:39:00 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-08-06 19:37:12 +0200 |
commit | 64100db9045ec712afbd8fa1becee14f7109921c (patch) | |
tree | fc80dd5f2006c278abcc74c77c84c865579a9f10 /utils/lib_sxng_node.sh | |
parent | 1d0abb7157a24fd2c43afe30a35527cba3d6967a (diff) | |
download | searxng-64100db9045ec712afbd8fa1becee14f7109921c.tar.gz searxng-64100db9045ec712afbd8fa1becee14f7109921c.zip |
[doc] improve documentation of make targets and ./manage script
BTW force modularization of the ./mange script into sub modules:
- utils/lib_sxng_data.sh
- utils/lib_sxng_node.sh
- utils/lib_sxng_static.sh
- utils/lib_sxng_test.sh
- utils/lib_sxng_themes.sh
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils/lib_sxng_node.sh')
-rwxr-xr-x | utils/lib_sxng_node.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/utils/lib_sxng_node.sh b/utils/lib_sxng_node.sh new file mode 100755 index 000000000..eac5bb16b --- /dev/null +++ b/utils/lib_sxng_node.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: AGPL-3.0-or-later + +export NODE_MINIMUM_VERSION="16.13.0" + +node.help(){ + cat <<EOF +node.: + env : download & install SearXNG's npm dependencies locally + env.dev : download & install developer and CI tools + clean : drop locally npm installations +EOF +} + +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/simple/package.json" + npm --prefix searx/static/themes/simple install + ) + dump_return $? +} + +node.env.dev() { + nodejs.ensure + build_msg INSTALL "./package.json: developer and CI tools" + npm install +} + +node.clean() { + if ! required_commands npm 2>/dev/null; then + build_msg CLEAN "npm is not installed / ignore npm dependencies" + return 0 + fi + build_msg CLEAN "themes -- locally installed npm dependencies" + ( set -e + npm --prefix searx/static/themes/simple run clean + ) + build_msg CLEAN "locally installed developer and CI tools" + ( set -e + npm --prefix . run clean + ) + dump_return $? +} |