From 5242a841a5dd2179d1ed620a67594932eb129422 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 20 Nov 2021 17:00:07 +0100 Subject: [PATCH] [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 --- .dir-locals.el | 5 +---- .nvm_packages | 8 ++++++++ utils/lib_nvm.sh | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .nvm_packages diff --git a/.dir-locals.el b/.dir-locals.el index e1d0b8ef7..f67ab4714 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -94,12 +94,9 @@ (js-mode . ((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) (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 + diff --git a/utils/lib_nvm.sh b/utils/lib_nvm.sh index cd2fbc189..267ba8a4a 100755 --- a/utils/lib_nvm.sh +++ b/utils/lib_nvm.sh @@ -117,6 +117,7 @@ nvm.install() { 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 }