From 305355beaf122619c2e4ae1ec7de8f335ade1447 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Tue, 14 Feb 2023 13:01:48 +0200 Subject: [PATCH] scripts: chmods & npm package helper --- scripts/install-dotfiles.sh | 0 scripts/install-go-packages.sh | 0 scripts/install-npm-packages.sh | 26 ++++++++++++++++++++++++++ scripts/shared.sh | 0 4 files changed, 26 insertions(+) mode change 100644 => 100755 scripts/install-dotfiles.sh mode change 100644 => 100755 scripts/install-go-packages.sh create mode 100755 scripts/install-npm-packages.sh mode change 100644 => 100755 scripts/shared.sh diff --git a/scripts/install-dotfiles.sh b/scripts/install-dotfiles.sh old mode 100644 new mode 100755 diff --git a/scripts/install-go-packages.sh b/scripts/install-go-packages.sh old mode 100644 new mode 100755 diff --git a/scripts/install-npm-packages.sh b/scripts/install-npm-packages.sh new file mode 100755 index 0000000..73d40d3 --- /dev/null +++ b/scripts/install-npm-packages.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env zsh +# Install npm packages globally. + +source "$HOME/.dotfiles/scripts/shared.sh" + +if ! command -v npm &> /dev/null; then + msg_err "npm could not be found." + exit 1 +fi + +packages=( + # This is a tool to check if your files consider your .editorconfig rules. + "editorconfig-checker" +) + +for pkg in "${packages[@]}"; do + # Trim spaces + pkg=${pkg// /} + # Skip comments + if [[ ${pkg:0:1} == "#" ]]; then continue; fi + + msg_run "Installing npm package:" "$pkg" + npm install -g --force "$pkg" + echo "" +done + diff --git a/scripts/shared.sh b/scripts/shared.sh old mode 100644 new mode 100755