From 437a900268b144f3ec3e4d16dcab0bfa0ee38d0b Mon Sep 17 00:00:00 2001 From: Raboneko <119771935+raboneko@users.noreply.github.com> Date: Sun, 30 Nov 2025 21:42:15 -0800 Subject: [PATCH] add: NVM (#7804) (#7825) * add: NVM * chore: Packager and changelog (cherry picked from commit 2896419ba244ff0a10c37812442185bda2529d22) Co-authored-by: Gilver --- anda/tools/nvm/anda.hcl | 6 ++++++ anda/tools/nvm/binscript | 5 +++++ anda/tools/nvm/nvm.spec | 42 ++++++++++++++++++++++++++++++++++++++ anda/tools/nvm/update.rhai | 1 + 4 files changed, 54 insertions(+) create mode 100644 anda/tools/nvm/anda.hcl create mode 100644 anda/tools/nvm/binscript create mode 100644 anda/tools/nvm/nvm.spec create mode 100644 anda/tools/nvm/update.rhai diff --git a/anda/tools/nvm/anda.hcl b/anda/tools/nvm/anda.hcl new file mode 100644 index 0000000000..0801883bd2 --- /dev/null +++ b/anda/tools/nvm/anda.hcl @@ -0,0 +1,6 @@ +project pkg { + arches = ["x86_64"] + rpm { + spec = "nvm.spec" + } +} diff --git a/anda/tools/nvm/binscript b/anda/tools/nvm/binscript new file mode 100644 index 0000000000..b12d8bbb74 --- /dev/null +++ b/anda/tools/nvm/binscript @@ -0,0 +1,5 @@ +#!/usr/bin/sh + +source /etc/profile.d/nvm.sh + +nvm $@ diff --git a/anda/tools/nvm/nvm.spec b/anda/tools/nvm/nvm.spec new file mode 100644 index 0000000000..c2e3bc7e00 --- /dev/null +++ b/anda/tools/nvm/nvm.spec @@ -0,0 +1,42 @@ +Name: nvm +Version: 0.40.3 +Release: 1%{?dist} +Summary: Node Version Manager +License: MIT +URL: https://github.com/nvm-sh/nvm +Source0: %{url}/archive/refs/tags/v%{version}.tar.gz +Source1: binscript +# Only works with POSIX compliant shells +Requires: (bash or dash or ksh or zsh) +BuildArch: noarch +Packager: Gilver E. + +%description +POSIX-compliant script to manage multiple active Node.js versions. + +%pkg_completion -bz + +%prep +%autosetup -n %{name}-%{version} + +%build +# Anyone home? + +%install +install -Dm744 %{SOURCE1} %{buildroot}%{_bindir}/%{name} + +install -Dm644 bash_completion %{buildroot}%{bash_completions_dir}/%{name}.bash +# Another cursed script that uses bashcompinit to use one file for Bash and Zsh completions +install -Dm644 bash_completion %{buildroot}%{zsh_completions_dir}/_%{name} + +install -Dm644 %{name}.sh -t %{buildroot}%{_sysconfdir}/profile.d + +%files +%license LICENSE.md +%doc README.md +%{_bindir}/%{name} +%{_sysconfdir}/profile.d/%{name}.sh + +%changelog +* Sun Nov 30 2025 Gilver E. - 0.40.3-1 +- Initial package diff --git a/anda/tools/nvm/update.rhai b/anda/tools/nvm/update.rhai new file mode 100644 index 0000000000..916991d83c --- /dev/null +++ b/anda/tools/nvm/update.rhai @@ -0,0 +1 @@ +rpm.version(find(`nvm_echo \"v([\d.]+)\"`, gh_rawfile("nvm-sh/nvm", "master", "install.sh"), 1));