diff options
| -rw-r--r-- | .dir-locals.el | 9 | ||||
| -rw-r--r-- | .nvm_packages | 8 | ||||
| -rw-r--r-- | .nvmrc | 1 | ||||
| -rw-r--r-- | docs/admin/filtron.rst | 4 | ||||
| -rw-r--r-- | docs/build-templates/filtron.rst | 2 | ||||
| -rw-r--r-- | docs/utils/filtron.sh.rst | 6 | ||||
| -rwxr-xr-x | utils/filtron.sh | 7 | ||||
| -rwxr-xr-x | utils/lib_nvm.sh | 16 | ||||
| -rwxr-xr-x | utils/morty.sh | 3 |
9 files changed, 39 insertions, 17 deletions
diff --git a/.dir-locals.el b/.dir-locals.el index b8f7ecc76..f67ab4714 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -19,6 +19,7 @@ ;; Some buffer locals are referencing the project environment: ;; ;; - prj-root --> <repo>/ +;; - nvm-dir --> <repo>/.nvm ;; - python-environment-directory --> <repo>/local ;; - python-environment-default-root-name --> py3 ;; - python-shell-virtualenv-root --> <repo>/local/py3 @@ -57,6 +58,9 @@ (setq-local python-environment-directory (expand-file-name "./local" prj-root)) + ;; to get in use of NVM enviroment, install https://github.com/rejeep/nvm.el + (setq-local nvm-dir (expand-file-name "./.nvm" prj-root)) + ;; use 'py3' enviroment as default (setq-local python-environment-default-root-name "py3") @@ -90,10 +94,9 @@ (js-mode . ((eval . (progn + ;; use nodejs from the (local) NVM environment (see nvm-dir) + (nvm-use-for-buffer) (setq-local js-indent-level 2) - ;; flycheck should use the eslint checker from simple theme - (setq-local flycheck-javascript-eslint-executable - (expand-file-name "searx/static/themes/simple/node_modules/.bin/eslint" prj-root)) (flycheck-mode) )))) diff --git a/.nvm_packages b/.nvm_packages new file mode 100644 index 000000000..13eabc5c2 --- /dev/null +++ b/.nvm_packages @@ -0,0 +1,8 @@ +# -*- coding: utf-8; mode: conf-unix -*- +# +# Developement tools pre-installed in NVM's node installation [1] +# +# [1] https://github.com/nvm-sh/nvm#default-global-packages-from-file-while-installing + +eslint + @@ -0,0 +1 @@ +v16.13.0
\ No newline at end of file diff --git a/docs/admin/filtron.rst b/docs/admin/filtron.rst index 1c32c1b37..9587d76cb 100644 --- a/docs/admin/filtron.rst +++ b/docs/admin/filtron.rst @@ -16,7 +16,7 @@ How to protect an instance :local: :backlinks: entry -.. _filtron: https://github.com/asciimoo/filtron +.. _filtron: https://github.com/searxng/filtron SearXNG depends on external search services. To avoid the abuse of these services it is advised to limit the number of requests processed by SearXNG. @@ -30,7 +30,7 @@ filtron & go ============ .. _Go: https://golang.org/ -.. _filtron README: https://github.com/asciimoo/filtron/blob/master/README.md +.. _filtron README: https://github.com/searxng/filtron/blob/master/README.md Filtron needs Go_ installed. If Go_ is preinstalled, filtron_ is simply installed by ``go get`` package management (see `filtron README`_). If you use diff --git a/docs/build-templates/filtron.rst b/docs/build-templates/filtron.rst index 6a39d1f58..a858f7ddd 100644 --- a/docs/build-templates/filtron.rst +++ b/docs/build-templates/filtron.rst @@ -48,6 +48,6 @@ .. code-block:: bash $ sudo -i -u \"${SERVICE_USER}\" - (${SERVICE_USER}) $ go get -v -u github.com/asciimoo/filtron + (${SERVICE_USER}) $ go get -v -u github.com/searxng/filtron .. END install filtron diff --git a/docs/utils/filtron.sh.rst b/docs/utils/filtron.sh.rst index f4a85282a..1f7302392 100644 --- a/docs/utils/filtron.sh.rst +++ b/docs/utils/filtron.sh.rst @@ -13,8 +13,8 @@ <installation apache>`) .. _Go: https://golang.org/ -.. _filtron: https://github.com/asciimoo/filtron -.. _filtron README: https://github.com/asciimoo/filtron/blob/master/README.md +.. _filtron: https://github.com/searxng/filtron +.. _filtron README: https://github.com/searxng/filtron/blob/master/README.md To simplify installation and maintenance of a filtron instance you can use the script :origin:`utils/filtron.sh`. In most cases you will install filtron_ @@ -30,7 +30,7 @@ into this user account: #. Create a separated user account (``filtron``). #. Download and install Go_ binary in user's $HOME (``~filtron``). #. Install filtron with the package management from Go_ (``go get -v -u - github.com/asciimoo/filtron``) + github.com/searxng/filtron``) #. Setup a proper rule configuration :origin:`[ref] <utils/templates/etc/filtron/rules.json>` (``/etc/filtron/rules.json``). #. Setup a systemd service unit :origin:`[ref] diff --git a/utils/filtron.sh b/utils/filtron.sh index ff380a327..2536214e4 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -337,7 +337,8 @@ EOF echo "export SERVICE_HOME=$SERVICE_HOME" tee_stderr <<EOF | sudo -i -u "$SERVICE_USER" -grep -qFs -- 'source $GO_ENV' ~/.profile || echo 'source $GO_ENV' >> ~/.profile +touch "$GO_ENV" +grep -qFs -- 'source "$GO_ENV"' ~/.profile || echo 'source "$GO_ENV"' >> ~/.profile EOF } @@ -348,13 +349,13 @@ filtron_is_installed() { install_filtron() { rst_title "Install filtron in user's ~/go-apps" section echo - go.install github.com/asciimoo/filtron@latest "${SERVICE_USER}" + go.install github.com/searxng/filtron@latest "${SERVICE_USER}" } update_filtron() { rst_title "Update filtron" section echo - go.install github.com/asciimoo/filtron@latest "${SERVICE_USER}" + go.install github.com/searxng/filtron@latest "${SERVICE_USER}" } install_rules() { diff --git a/utils/lib_nvm.sh b/utils/lib_nvm.sh index d35abef2a..267ba8a4a 100755 --- a/utils/lib_nvm.sh +++ b/utils/lib_nvm.sh @@ -94,6 +94,7 @@ nvm.: use nvm (without dot) to execute nvm commands directly clean : remove NVM installation status : prompt some status informations about nvm & node nodejs : install Node.js latest LTS + cmd ... : run command ... in NVM environment bash : start bash interpreter with NVM environment sourced EOF } @@ -115,6 +116,8 @@ nvm.install() { NVM_VERSION_TAG="$(git describe --abbrev=0 --tags --match "v[0-9]*" "${NVM_VERSION_TAG}")" info_msg "checkout ${NVM_VERSION_TAG}" git checkout "${NVM_VERSION_TAG}" 2>&1 | prefix_stdout " ${_Yellow}||${_creset} " + popd &> /dev/null + cp "${REPO_ROOT}/.nvm_packages" "${NVM_DIR}/default-packages" nvm.env } @@ -133,7 +136,7 @@ nvm.clean() { fi } -nvm.status(){ +nvm.status() { if command -v node >/dev/null; then info_msg "Node.js is installed at $(command -v node)" info_msg "Node.js is version $(node --version)" @@ -153,12 +156,12 @@ nvm.status(){ info_msg "NVM is installed at ${NVM_DIR}" else warn_msg "NVM is not installed" - info_msg "to install NVM and Node.js (LTS) use: ${main_cmd} nvm install --lts" + info_msg "to install NVM and Node.js (LTS) use: ${main_cmd} nvm.nodejs" fi } -nvm.nodejs(){ - nvm install --lts +nvm.nodejs() { + nvm install nvm.status } @@ -167,6 +170,11 @@ nvm.bash() { bash --init-file <(cat "${NVM_DIR}/nvm.sh" "${NVM_DIR}/bash_completion") } +nvm.cmd() { + nvm.ensure + "$@" +} + nvm.ensure() { if ! nvm.is_installed; then nvm.install diff --git a/utils/morty.sh b/utils/morty.sh index c1f2bc968..25263a3d4 100755 --- a/utils/morty.sh +++ b/utils/morty.sh @@ -337,7 +337,8 @@ EOF echo "export SERVICE_HOME=$SERVICE_HOME" tee_stderr <<EOF | sudo -i -u "$SERVICE_USER" -grep -qFs -- 'source $GO_ENV' ~/.profile || echo 'source $GO_ENV' >> ~/.profile +touch $GO_ENV +grep -qFs -- 'source "$GO_ENV"' ~/.profile || echo 'source "$GO_ENV"' >> ~/.profile EOF } |