%global npm_name rollup Name: nodejs-%{npm_name} Version: 4.52.5 Release: %autorelease Summary: Module bundler for JavaScript License: MIT AND ISC URL: https://rollupjs.org/ Source0: https://github.com/%{npm_name}/%{npm_name}/archive/refs/tags/v%{version}.tar.gz Source1: %{npm_name}-%{version}-nm-prod.tgz Source2: %{npm_name}-%{version}-nm-dev.tgz Source3: %{npm_name}-%{version}-bundled-licenses.txt BuildArch: noarch ExclusiveArch: %{nodejs_arches} noarch Requires: nodejs BuildRequires: nodejs-npm BuildRequires: nodejs-concurrently BuildRequires: nodejs BuildRequires: nodejs-devel BuildRequires: nodejs-husky BuildRequires: rust-napi-devel BuildRequires: wasm-pack BuildRequires: cargo-rpm-macros >= 24 %description %{summary}. %prep %setup -q -n %{npm_name}-%{version} cp %{SOURCE3} . # Setup bundled runtime(prod) node modules tar xfz %{SOURCE1} mkdir -p node_modules pushd node_modules ln -s ../node_modules_prod/* . ln -s ../node_modules_prod/.bin . popd sed -i -e 's/\(wasm-pack [^&]*\)\&\&/\1 -- --offline \&\&/' package.json pushd rust %cargo_prep popd %generate_buildrequires for mod in bindings_napi bindings_wasm parse_ast xxhash do pushd rust/${mod} %cargo_generate_buildrequires popd done %build npm run build pushd rust %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies popd %install mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pr package.json index.js lib/ \ %{buildroot}%{nodejs_sitelib}/%{npm_name} # Copy over bundled nodejs modules cp -pr node_modules node_modules_prod \ %{buildroot}%{nodejs_sitelib}/%{npm_name} mkdir -p %{buildroot}%{nodejs_sitelib}/rollup/bin install -p -D -m0755 bin/rollup %{buildroot}%{nodejs_sitelib}/rollup/bin/rollup mkdir -p %{buildroot}%{_bindir} ln -sr %{nodejs_sitelib}/rollup/bin/rollup %{buildroot}%{_bindir}/rollup %check %{__nodejs} -e 'require("./")' # Setup bundled dev node_modules for testing # Note: this cannot be in %%prep or the dev node_modules # can get pulled into the regular rpm tar xfz %{SOURCE2} pushd node_modules ln -s ../node_modules_dev/* . popd pushd node_modules/.bin ln -s ../../node_modules_dev/.bin/* . popd # Run tests ./node_modules/.bin/tap test/*.js %files %doc readme.markdown %license LICENSE %{npm_name}-%{version}-bundled-licenses.txt %{nodejs_sitelib}/rollup %{_bindir}/rollup %autochangelog