[mod] NVM: dev-tools pre-installed in NVM's node installation

The Node.js installation in the NVM environment can be used by IDEs and other
developer tasks.  The required developer packagaes are added to the file
./.nvm_packages and will be installed when Node.js is installed.  Initial we
start with:

- eslint

Having a dedicated developer enviroment, provided by nvm makes it easy to
integrate Node.js packages into various IDEs.  One example is shown in the
.dir-locals.el which is used by emacs.

[1] https://github.com/nvm-sh/nvm#default-global-packages-from-file-while-installing
[2] https://eslint.org

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-11-20 17:00:07 +01:00
parent 69dd025da9
commit 5242a841a5
3 changed files with 10 additions and 4 deletions

View File

@ -94,12 +94,9 @@
(js-mode (js-mode
. ((eval . (progn . ((eval . (progn
;; flycheck should use the (local) NVM environment (see nvm-dir) ;; use nodejs from the (local) NVM environment (see nvm-dir)
(nvm-use-for-buffer) (nvm-use-for-buffer)
(setq-local js-indent-level 2) (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) (flycheck-mode)
)))) ))))

8
.nvm_packages Normal file
View File

@ -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

View File

@ -117,6 +117,7 @@ nvm.install() {
info_msg "checkout ${NVM_VERSION_TAG}" info_msg "checkout ${NVM_VERSION_TAG}"
git checkout "${NVM_VERSION_TAG}" 2>&1 | prefix_stdout " ${_Yellow}||${_creset} " git checkout "${NVM_VERSION_TAG}" 2>&1 | prefix_stdout " ${_Yellow}||${_creset} "
popd &> /dev/null popd &> /dev/null
cp "${REPO_ROOT}/.nvm_packages" "${NVM_DIR}/default-packages"
nvm.env nvm.env
} }