feat(installer): added bun as a js package manager (#4362)

* Added bun as an npm package manager

* Update install.sh

* Update install.sh

* Update install.sh

* Update install.sh

* Update utils/installer/install.sh

Co-authored-by: LostNeophyte <lostneophyte@tuta.io>

---------

Co-authored-by: LostNeophyte <lostneophyte@tuta.io>
This commit is contained in:
The Bearodactyl 2024-01-13 15:33:22 -06:00 committed by GitHub
parent b124e8c3e3
commit e85637c240
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,7 +135,7 @@ function main() {
if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then
if [ "$INTERACTIVE_MODE" -eq 1 ]; then if [ "$INTERACTIVE_MODE" -eq 1 ]; then
if confirm "Would you like to install LunarVim's NodeJS dependencies: $(stringify_array "${__npm_deps[@]}")?"; then if confirm "Would you like to install LunarVim's NodeJS/BunJS dependencies: $(stringify_array "${__npm_deps[@]}")?"; then
install_nodejs_deps install_nodejs_deps
fi fi
if confirm "Would you like to install LunarVim's Python dependencies: $(stringify_array "${__pip_deps[@]}")?"; then if confirm "Would you like to install LunarVim's Python dependencies: $(stringify_array "${__pip_deps[@]}")?"; then
@ -286,6 +286,12 @@ function __install_nodejs_deps_yarn() {
echo "All NodeJS dependencies are successfully installed" echo "All NodeJS dependencies are successfully installed"
} }
function __install_nodejs_deps_bun() {
echo "Installing bun modules with bun..."
bun install -g "${__npm_deps[@]}"
echo "All BunJS dependencies are successfully installed"
}
function __validate_node_installation() { function __validate_node_installation() {
local pkg_manager="$1" local pkg_manager="$1"
local manager_home local manager_home
@ -296,6 +302,8 @@ function __validate_node_installation() {
if [ "$pkg_manager" == "npm" ]; then if [ "$pkg_manager" == "npm" ]; then
manager_home="$(npm config get prefix 2>/dev/null)" manager_home="$(npm config get prefix 2>/dev/null)"
elif [ "$pkg_manager" == "bun" ]; then
manager_home="$BUN_INSTALL"
elif [ "$pkg_manager" == "pnpm" ]; then elif [ "$pkg_manager" == "pnpm" ]; then
manager_home="$(pnpm config get prefix 2>/dev/null)" manager_home="$(pnpm config get prefix 2>/dev/null)"
else else
@ -310,7 +318,7 @@ function __validate_node_installation() {
} }
function install_nodejs_deps() { function install_nodejs_deps() {
local -a pkg_managers=("pnpm" "yarn" "npm") local -a pkg_managers=("pnpm" "bun" "yarn" "npm")
for pkg_manager in "${pkg_managers[@]}"; do for pkg_manager in "${pkg_managers[@]}"; do
if __validate_node_installation "$pkg_manager"; then if __validate_node_installation "$pkg_manager"; then
eval "__install_nodejs_deps_$pkg_manager" eval "__install_nodejs_deps_$pkg_manager"