Name:           yarn
Version:        1.22.21
Release:        0%{?dist}
Summary:        📦🐈 Fast, reliable, and secure dependency management
License:        BSD-2-Clause
URL:            https://github.com/%{name}pkg/%{name}/releases
Source:         %{URL}/download/v%{version}/%{name}-v%{version}.tar.gz
BuildRequires:  perl
Requires:       nodejs >= 4.0 sed
BuildArch:      noarch

%description
Fast: Yarn caches every package it has downloaded, so it never needs to
download the same package again. It also does almost everything concurrently to
maximize resource utilization. This means even faster installs.

Reliable: Using a detailed but concise lockfile format and a deterministic
algorithm for install operations, Yarn is able to guarantee that any
installation that works on one system will work exactly the same on another
system.

Secure: Yarn uses checksums to verify the integrity of every installed package
before its code is executed.

%prep
%autosetup -n %{name}-v%{version}

%build
rm bin/*.cmd
perl -pi -e 's|%{_bindir}/env node|%{_bindir}/node|g' bin/* lib/*

%install
install -D -d -m 0755              %{buildroot}%{_datadir}/%{name}/ %{buildroot}%{_bindir}
cp -av bin/ lib/ package.json      %{buildroot}%{_datadir}/%{name}/
ln -s ../..%{_datadir}/%{name}/bin/%{name}    %{buildroot}%{_bindir}/%{name}    
ln -s ../..%{_datadir}/%{name}/bin/%{name}pkg %{buildroot}%{_bindir}/%{name}pkg 

%files
%doc README.md
%license LICENSE
%{_datadir}/%{name}/
%{_bindir}/%{name}*

%changelog
* Sun Feb 04 2024 pappy <skrochen@krotek.com> 1.22.21-0
- Convert to Fedora 39