ec4f5b8059
- /home/dot_config/rclone/system/s3-docker.service.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_07-docker-plugins.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_13-post-install-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-warp.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-timeshift.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-keybase.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-install-aqua-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_12-install-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_18-install-sdkman.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-gnome-extension-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_20-font.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_21-dconf-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_50-crontab.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_57-netdata.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_59-connect-tailscale.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_70-misc-bug-fixes.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_06-bin-symlink.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_40-firefox.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_40-chrome.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_27-tor.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-linux.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_26-system-vscode-node-modules.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_26-vscode-extensions.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_07-docker-plugins.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_05-log-config.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_04-environment-profile.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-warp.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-timeshift.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-keybase.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-install-aqua-packages.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_12-install-packages.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_18-install-sdkman.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-gnome-extension-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_20-font.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_21-dconf-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_45-vmware.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_50-crontab.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_57-netdata.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_59-connect-tailscale.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_70-misc-bug-fixes.sh.tmpl
78 lines
4 KiB
Cheetah
78 lines
4 KiB
Cheetah
{{- if (ne .host.distro.family "windows") -}}
|
|
#!/usr/bin/env bash
|
|
# @file run_onchange_after_26-system-vscode-node-modules.tmpl
|
|
# @brief Installs NPM packages to the system `/` directory as a catch-all for tools that recursively search upwards for shared NPM configurations.
|
|
# @description
|
|
# This script makes fallback linter and code auto-fixer configurations globally available. Normally, configurations, like
|
|
# the ones used for ESLint, are installed at the project level by specifying the NPM package configuration
|
|
# in the `package.json` file (or via an `.eslintrc` file). However, whenever no configuration is present, IDEs like
|
|
# Visual Studio Code will recursively search upwards in the directory tree, trying to find an ESLint configuration.
|
|
#
|
|
# This script addresses this issue by installing a set of shared NPM packages that enhance the functionality of tools like ESLint
|
|
# by placing a `package.json` with all the necessary settings into the highest directory possible and then installing the package's
|
|
# modules. This normally results in a `package.json` file and `node_modules/` folder at the root of the system.
|
|
#
|
|
# ## NPM Packages Included
|
|
#
|
|
# To reduce clutter, all the configurations are mapped out in the `package.json` file. Our default `package.json` file includes
|
|
# the following configuration:
|
|
#
|
|
# ```json
|
|
# <!-- AUTO-GENERATED:START (REMOTE:url=https://gitlab.com/megabyte-labs/install.doctor/-/raw/master/home/dot_config/Code/User/package.json) -->
|
|
# {
|
|
# ...
|
|
# // Notable dependencies listed below
|
|
# "dependencies": {
|
|
# "eslint-config-strictlint": "latest",
|
|
# "jest-preset-ts": "latest",
|
|
# "prettier-config-strictlint": "latest",
|
|
# "remark-preset-strictlint": "latest",
|
|
# "stylelint-config-strictlint": "latest"
|
|
# },
|
|
# ...
|
|
# }
|
|
# <!-- AUTO-GENERATED:END -->
|
|
# ```
|
|
#
|
|
# ## Strict Lint
|
|
#
|
|
# More details on the shared configurations can be found at [StrictLint.com](https://strictlint.com).
|
|
# Strict Lint is another brand maintained by Megabyte Labs that is home to many of the well-crafted
|
|
# shared configurations that are included in our default NPM configuration fallback settings.
|
|
#
|
|
# ## Notes
|
|
#
|
|
# * If the system root directory is not writable (even with `sudo`), then the shared modules are installed to the provisioning user's `$HOME` directory
|
|
#
|
|
# ## Links
|
|
#
|
|
# * [`package.json` configuration file](https://github.com/megabyte-labs/install.doctor/blob/master/home/dot_config/Code/User/package.json)
|
|
# * [StrictLint.com documentation](https://strictlint.com/docs)
|
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
{{ includeTemplate "universal/logg" }}
|
|
|
|
if command -v code > /dev/null && command -v pnpm > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/vscode/package.json" ]; then
|
|
### Install linter fallback node_modules / package.json to system or home directory
|
|
if sudo cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/vscode/package.json" /package.json; then
|
|
logg info 'Successfully copied linter fallback configurations package.json to /package.json'
|
|
logg info 'Installing system root directory node_modules'
|
|
cd / && sudo pnpm i --no-lockfile || EXIT_CODE=$?
|
|
else
|
|
logg warn 'Unable to successfully copy linter fallback configurations package.json to /package.json'
|
|
logg info 'Installing linter fallback configurations node_modules to home directory instead'
|
|
cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/vscode/package.json" "$HOME/package.json"
|
|
cd ~ && pnpm i --no-lockfile || EXIT_CODE=$?
|
|
fi
|
|
|
|
### Log message if install failed
|
|
if [ -n "$EXIT_CODE" ]; then
|
|
logg warn 'Possible error(s) were detected while installing linter fallback configurations to the home directory.'
|
|
else
|
|
logg success 'Installed linter fallback configuration node_modules'
|
|
fi
|
|
else
|
|
logg info 'Skipping installation of fallback linter configurations because one or more of the dependencies is missing.'
|
|
fi
|
|
|
|
{{ end -}}
|