From e1050fc7e188056fb6bf9c57d9ac1c05e356e444 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Wed, 4 Feb 2026 03:05:29 +0200 Subject: [PATCH] refactor(npm): inline packages and drop unused dependencies --- config/asdf/npm-packages | 7 ------- scripts/install-npm-packages.md | 11 +++++++++-- scripts/install-npm-packages.sh | 19 ++++++++----------- 3 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 config/asdf/npm-packages diff --git a/config/asdf/npm-packages b/config/asdf/npm-packages deleted file mode 100644 index 4ee9bfd..0000000 --- a/config/asdf/npm-packages +++ /dev/null @@ -1,7 +0,0 @@ -blade-formatter -corepack -editorconfig-checker -github-release-notes -neovim -npm -stylelint-lsp diff --git a/scripts/install-npm-packages.md b/scripts/install-npm-packages.md index a1ba2da..16da78a 100644 --- a/scripts/install-npm-packages.md +++ b/scripts/install-npm-packages.md @@ -1,6 +1,6 @@ # install-npm-packages -Installs global npm packages listed in `config/npm/packages`. +Install npm packages defined in the script. ## Usage @@ -8,4 +8,11 @@ Installs global npm packages listed in `config/npm/packages`. scripts/install-npm-packages.sh ``` -Uses `npm install -g` for each package in the configuration file. +## What it does + +1. Checks that `npm` is available. +2. Installs each package from the inline list using `npm install -g`. +3. Upgrades all global packages. +4. Cleans the npm cache. + +To add or remove packages, edit the `packages` array in `scripts/install-npm-packages.sh`. diff --git a/scripts/install-npm-packages.sh b/scripts/install-npm-packages.sh index ce9e797..525dacd 100755 --- a/scripts/install-npm-packages.sh +++ b/scripts/install-npm-packages.sh @@ -15,23 +15,20 @@ if ! command -v npm &> /dev/null; then fi packages=( - # This is a tool to check if your files consider your .editorconfig rules. - "editorconfig-checker" - # Node module to create a release or a changelog from - # a tag and uses issues or commits to creating the release notes. - "github-release-notes" - "neovim" - "corepack" + editorconfig-checker # Check files against .editorconfig rules + github-release-notes # Create release notes from tags and issues + neovim # Neovim node client + corepack # Node.js package manager version management ) # Function to install npm packages install_packages() { for pkg in "${packages[@]}"; do - # Trim spaces - pkg=${pkg// /} - # Skip comments - if [[ ${pkg:0:1} == "#" ]]; then continue; fi + # Strip inline comments and trim whitespace + pkg="${pkg%%#*}" + pkg="${pkg// /}" + [[ -z "$pkg" ]] && continue if npm ls -g -p "$pkg" &> /dev/null; then msgr run_done "$pkg" "already installed"