mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-23 07:56:27 +00:00
refactor(npm): inline packages and drop unused dependencies
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
blade-formatter
|
|
||||||
corepack
|
|
||||||
editorconfig-checker
|
|
||||||
github-release-notes
|
|
||||||
neovim
|
|
||||||
npm
|
|
||||||
stylelint-lsp
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# install-npm-packages
|
# install-npm-packages
|
||||||
|
|
||||||
Installs global npm packages listed in `config/npm/packages`.
|
Install npm packages defined in the script.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -8,4 +8,11 @@ Installs global npm packages listed in `config/npm/packages`.
|
|||||||
scripts/install-npm-packages.sh
|
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`.
|
||||||
|
|||||||
@@ -15,23 +15,20 @@ if ! command -v npm &> /dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
packages=(
|
packages=(
|
||||||
# This is a tool to check if your files consider your .editorconfig rules.
|
editorconfig-checker # Check files against .editorconfig rules
|
||||||
"editorconfig-checker"
|
github-release-notes # Create release notes from tags and issues
|
||||||
# Node module to create a release or a changelog from
|
neovim # Neovim node client
|
||||||
# a tag and uses issues or commits to creating the release notes.
|
corepack # Node.js package manager version management
|
||||||
"github-release-notes"
|
|
||||||
"neovim"
|
|
||||||
"corepack"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Function to install npm packages
|
# Function to install npm packages
|
||||||
install_packages()
|
install_packages()
|
||||||
{
|
{
|
||||||
for pkg in "${packages[@]}"; do
|
for pkg in "${packages[@]}"; do
|
||||||
# Trim spaces
|
# Strip inline comments and trim whitespace
|
||||||
pkg=${pkg// /}
|
pkg="${pkg%%#*}"
|
||||||
# Skip comments
|
pkg="${pkg// /}"
|
||||||
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
[[ -z "$pkg" ]] && continue
|
||||||
|
|
||||||
if npm ls -g -p "$pkg" &> /dev/null; then
|
if npm ls -g -p "$pkg" &> /dev/null; then
|
||||||
msgr run_done "$pkg" "already installed"
|
msgr run_done "$pkg" "already installed"
|
||||||
|
|||||||
Reference in New Issue
Block a user