mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Switch from npm to mise for the lazy-loaded tools
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@ GROUP_DESCRIPTIONS[migrate]="Migration runner"
|
||||
GROUP_DESCRIPTIONS[monitor]="Monitor status helpers"
|
||||
GROUP_DESCRIPTIONS[network]="Network status helpers"
|
||||
GROUP_DESCRIPTIONS[notification]="Notification helpers"
|
||||
GROUP_DESCRIPTIONS[npm]="NPM package wrappers"
|
||||
GROUP_DESCRIPTIONS[mise]="Mise tool wrappers"
|
||||
GROUP_DESCRIPTIONS[osd]="On-screen display status helpers"
|
||||
GROUP_DESCRIPTIONS[pkg]="Package management helpers"
|
||||
GROUP_DESCRIPTIONS[plugin]="Omarchy shell plugin and bar widget management"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Install a small pnpm dlx wrapper for a given npm package.
|
||||
# omarchy:summary=Install a small mise-backed wrapper for a given tool.
|
||||
# omarchy:args=<package> [command-name [bin-name]]
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Usage: omarchy-npm-install <package> [command-name [bin-name]]"
|
||||
echo "Usage: omarchy-mise-install <package> [command-name [bin-name]]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -16,7 +16,8 @@ mkdir -p "$HOME/.local/bin"
|
||||
|
||||
cat >"$HOME/.local/bin/$command" <<EOF
|
||||
#!/bin/bash
|
||||
exec omarchy-npm-run "$package" "$command" "$bin" "\$@"
|
||||
mise use -g "$package"
|
||||
exec "$bin" "\$@"
|
||||
EOF
|
||||
|
||||
chmod +x "$HOME/.local/bin/$command"
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Run a pnpm dlx-backed npm package wrapper.
|
||||
# omarchy:args=<package> <command-name> <bin-name> [args...]
|
||||
# omarchy:hidden=true
|
||||
|
||||
if (($# < 3)); then
|
||||
echo "Usage: omarchy-npm-run <package> <command-name> <bin-name> [args...]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
package=$1
|
||||
command=$2
|
||||
bin=$3
|
||||
shift 3
|
||||
|
||||
package_spec=$package
|
||||
state_dir="${XDG_STATE_HOME:-$HOME/.local/state}/omarchy/npm-wrappers"
|
||||
version_file="$state_dir/$command.version"
|
||||
pin_ttl=7200
|
||||
uses_pinned_version=0
|
||||
|
||||
if [[ -s $version_file ]]; then
|
||||
now=$(date +%s)
|
||||
pinned_at=$(stat -c %Y "$version_file" 2>/dev/null || printf '0\n')
|
||||
|
||||
if ((now - pinned_at < pin_ttl)); then
|
||||
pinned_version=$(<"$version_file")
|
||||
package_spec="$package@$pinned_version"
|
||||
uses_pinned_version=1
|
||||
else
|
||||
rm -f "$version_file"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! node_root=$(mise where node@latest 2>/dev/null); then
|
||||
mise use -g node@latest >/dev/null
|
||||
node_root=$(mise where node@latest)
|
||||
fi
|
||||
|
||||
export PATH="$node_root/bin:$PATH"
|
||||
|
||||
if omarchy-cmd-missing pnpm; then
|
||||
echo "Installing pnpm for $package..."
|
||||
omarchy-pkg-add pnpm
|
||||
hash -r
|
||||
fi
|
||||
|
||||
# pnpm reads npm_config_* env vars for CLI configuration.
|
||||
export npm_config_minimum_release_age=$pin_ttl
|
||||
export npm_config_dlx_cache_max_age=$pin_ttl
|
||||
|
||||
if (( uses_pinned_version )); then
|
||||
export npm_config_minimum_release_age=0
|
||||
fi
|
||||
|
||||
if (($# == 1)) && [[ $1 == "update" ]]; then
|
||||
export npm_config_minimum_release_age=0
|
||||
export npm_config_dlx_cache_max_age=0
|
||||
|
||||
if ! latest_version=$(env -u npm_config_minimum_release_age -u npm_config_dlx_cache_max_age pnpm view "$package@latest" version); then
|
||||
echo "Could not resolve latest npm version for $package" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$state_dir"
|
||||
printf '%s\n' "$latest_version" >"$version_file"
|
||||
package_spec="$package@$latest_version"
|
||||
|
||||
pnpm dlx --package "$package_spec" true
|
||||
|
||||
echo "Updated $command to $latest_version"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec pnpm dlx --package "$package_spec" "$bin" "$@"
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Ensure all default .desktop, web apps, TUIs, and npm wrappers are installed.
|
||||
# omarchy:summary=Ensure all default .desktop, web apps, TUIs, and mise wrappers are installed.
|
||||
|
||||
mkdir -p ~/.local/share/icons/hicolor/48x48/apps/
|
||||
cp "$OMARCHY_PATH"/applications/icons/*.png ~/.local/share/icons/hicolor/48x48/apps/
|
||||
@@ -14,10 +14,10 @@ if omarchy-cmd-present alacritty; then
|
||||
cp "$OMARCHY_PATH/default/alacritty/Alacritty.desktop" ~/.local/share/applications/
|
||||
fi
|
||||
|
||||
# Refresh the webapps, TUIs, and npm wrappers
|
||||
# Refresh the webapps, TUIs, and mise wrappers
|
||||
bash "$OMARCHY_PATH/install/packaging/icons.sh"
|
||||
bash "$OMARCHY_PATH/install/packaging/webapps.sh"
|
||||
bash "$OMARCHY_PATH/install/packaging/tuis.sh"
|
||||
bash "$OMARCHY_PATH/install/packaging/npm.sh"
|
||||
bash "$OMARCHY_PATH/install/packaging/mise.sh"
|
||||
|
||||
update-desktop-database ~/.local/share/applications
|
||||
|
||||
@@ -12,9 +12,10 @@ if gum confirm "Are you sure you want to remove all preinstalled web apps, TUI w
|
||||
cp "$OMARCHY_PATH/default/hypr/plain-bindings.lua" ~/.config/hypr/bindings.lua
|
||||
hyprctl reload
|
||||
|
||||
# Remove npm stubs
|
||||
# Remove mise stubs
|
||||
rm -f ~/.local/bin/codex ~/.local/bin/gemini ~/.local/bin/copilot \
|
||||
~/.local/bin/opencode ~/.local/bin/playwright-cli ~/.local/bin/pi
|
||||
~/.local/bin/opencode ~/.local/bin/playwright ~/.local/bin/playwright-cli ~/.local/bin/pi \
|
||||
~/.local/bin/ghui ~/.local/bin/hunk
|
||||
|
||||
omarchy-pkg-drop \
|
||||
aether \
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Update mise-managed tools
|
||||
|
||||
if omarchy-cmd-present mise; then
|
||||
echo -e "\e[32m\nUpdate mise tools\e[0m"
|
||||
mise up
|
||||
echo
|
||||
fi
|
||||
@@ -14,6 +14,7 @@ omarchy-update-available-reset
|
||||
omarchy-update-system-pkgs
|
||||
omarchy-migrate
|
||||
omarchy-update-aur-pkgs
|
||||
omarchy-update-mise
|
||||
omarchy-update-orphan-pkgs
|
||||
omarchy-hook post-update
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ run_logged $OMARCHY_INSTALL/packaging/nvim.sh
|
||||
run_logged $OMARCHY_INSTALL/packaging/icons.sh
|
||||
run_logged $OMARCHY_INSTALL/packaging/webapps.sh
|
||||
run_logged $OMARCHY_INSTALL/packaging/tuis.sh
|
||||
run_logged $OMARCHY_INSTALL/packaging/npm.sh
|
||||
run_logged $OMARCHY_INSTALL/packaging/mise.sh
|
||||
run_logged $OMARCHY_INSTALL/packaging/asus-rog.sh
|
||||
run_logged $OMARCHY_INSTALL/packaging/framework16.sh
|
||||
run_logged $OMARCHY_INSTALL/packaging/dell-xps-touchpad-haptics.sh
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
omarchy-mise-install codex
|
||||
omarchy-mise-install gemini
|
||||
omarchy-mise-install copilot
|
||||
omarchy-mise-install opencode
|
||||
omarchy-mise-install npm:playwright playwright
|
||||
omarchy-mise-install pi
|
||||
omarchy-mise-install npm:@kitlangton/ghui ghui
|
||||
omarchy-mise-install aqua:modem-dev/hunk hunk
|
||||
@@ -1,8 +0,0 @@
|
||||
omarchy-npm-install @openai/codex codex
|
||||
omarchy-npm-install @google/gemini-cli gemini
|
||||
omarchy-npm-install @github/copilot copilot
|
||||
omarchy-npm-install opencode-ai opencode
|
||||
omarchy-npm-install playwright playwright-cli playwright
|
||||
omarchy-npm-install @earendil-works/pi-coding-agent pi
|
||||
omarchy-npm-install @kitlangton/ghui ghui
|
||||
omarchy-npm-install hunkdiff hunk
|
||||
@@ -1,3 +0,0 @@
|
||||
echo "Install npm package wrappers using pnpm with 5-day security lag"
|
||||
|
||||
source "$OMARCHY_PATH/install/packaging/npm.sh"
|
||||
@@ -1,3 +0,0 @@
|
||||
echo "Refresh npm wrappers with update support"
|
||||
|
||||
source "$OMARCHY_PATH/install/packaging/npm.sh"
|
||||
@@ -0,0 +1,5 @@
|
||||
echo "Install mise package wrappers"
|
||||
|
||||
rm -f "$HOME/.local/bin/playwright-cli"
|
||||
|
||||
source "$OMARCHY_PATH/install/packaging/mise.sh"
|
||||
Reference in New Issue
Block a user