Name:                js-jquery
Version:             3.6.0
Release:             1
Summary:             JavaScript DOM manipulation, event handling, and AJAX library
BuildArch:           noarch
%global ver_x %(echo %{version} | cut -d. -f1)
%global ver_y %(echo %{version} | cut -d. -f2)
%global ver_z %(echo %{version} | cut -d. -f3)
License:             MIT
URL:                 https://jquery.com/
Source0:             https://github.com/jquery/jquery/archive/%{version}/jquery-%{version}.tar.gz
#Created by ./generate-source.sh <version>
Source1:             jquery_%{version}_node_modules.tar.gz
Source2:             generate-source.sh
Patch1:              %{name}-disable-gzip-js.patch
BuildRequires:       web-assets-devel nodejs-packaging
Provides:            jquery = %{version}-%{release}
Provides:            %{name}-static = %{version}-%{release}
Provides:            %{name}%{ver_x} = %{version}-%{release}
Provides:            %{name}%{ver_x}-static = %{version}-%{release}
Requires:            web-assets-filesystem
Provides:            bundled(sizzle) = 2.3.5
Provides:            bundled(js-sizzle) = 2.3.5
%description
jQuery is a fast, small, and feature-rich JavaScript library. It makes things
like HTML document traversal and manipulation, event handling, animation, and
Ajax much simpler with an easy-to-use API that works across a multitude of
browsers. With a combination of versatility and extensibility, jQuery has
changed the way that millions of people write JavaScript.

%prep
%autosetup -n jquery-%{version} -v -p1
rm -rf dist/*
tar xf %{SOURCE1}

%build
./node_modules/grunt-cli/bin/grunt -v 'build:*:*' uglify

%check
./node_modules/grunt-cli/bin/grunt -v 'build:*:*' test:prepare test:fast

%install
%global installdir %{buildroot}%{_jsdir}/jquery
mkdir -p %{installdir}/%{version}
cp -p dist/* %{installdir}/%{version}
mkdir -p %{buildroot}%{_webassetdir}
ln -s ../javascript/jquery %{buildroot}%{_webassetdir}/jquery
ln -s %{version} %{installdir}/latest
ln -s %{version} %{installdir}/%{ver_x}
ln -s %{version} %{installdir}/%{ver_x}.%{ver_y}

%files
%{_jsdir}/jquery
%{_webassetdir}/jquery
%doc AUTHORS.txt CONTRIBUTING.md LICENSE.txt README.md

%changelog
* Mon Jul 4 2022 liyanan <liyanan32@h-partners.com> - 3.6.0-1
- update to 3.6.0

* Wed Sep 2 2020 zhanghua <zhanghua40@huawei.com> - 3.5.0-1
- update to 3.5.0

* Thu Dec 12 2019 duyeyu <duyeyu@huawei.com> - 3.2.1-5
- init package
