## START: Set by rpmautospec ## (rpmautospec version 0.8.1) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 3; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec %global npm_name cssnano %global preset_name cssnano-preset-advanced %global _description %{expand: Cssnano is a modern, modular compression tool written on top of the PostCSS ecosystem, which allows us to use a lot of powerful features in order to compact CSS appropriately. } Name: nodejs-%{npm_name} Version: 7.0.7 Release: %autorelease Summary: A modular minifier, built on top of the PostCSS ecosystem # License for the main package and its dependencies License: MIT AND BSD-2-Clause AND BSD-3-Clause AND CC0-1.0 AND ISC URL: https://github.com/cssnano/%{npm_name} Source0: https://registry.npmjs.org/%{npm_name}/-/%{npm_name}-%{version}.tgz Source1: %{npm_name}-%{version}-nm-prod.tgz Source2: %{npm_name}-%{version}-nm-dev.tgz Source3: %{npm_name}-%{version}-bundled-licenses.txt # Sources for the 'advanced' preset subpackage, using its own dependency bundles Source4: https://registry.npmjs.org/%{preset_name}/-/%{preset_name}-%{version}.tgz Source5: %{preset_name}-%{version}-nm-prod.tgz Source6: %{preset_name}-%{version}-nm-dev.tgz Source7: %{preset_name}-%{version}-bundled-licenses.txt BuildArch: noarch ExclusiveArch: %{nodejs_arches} noarch BuildRequires: nodejs-devel BuildRequires: npm Requires: nodejs %description %{_description} # Definition of the subpackage for the 'advanced' preset %package -n nodejs-%{preset_name} Summary: Advanced optimisations preset for cssnano License: MIT AND BSD-3-Clause AND CC-BY-4.0 AND ISC Requires: nodejs-%{npm_name} = %{version}-%{release} %description -n nodejs-%{preset_name} This package provides the "advanced" preset for cssnano, which enables more aggressive, but potentially unsafe, CSS optimizations. %prep # Unpack main source (Source0) to 'package' and preset source (Source4) to 'package-a4' %autosetup -n package -a 4 # --- Block for main package dependencies --- cp %{SOURCE3} . # Unpack dependency bundle for the main package. It creates 'node_modules_prod'. tar xfz %{SOURCE1} # Rename it to avoid conflict before we unpack the next one mv node_modules_prod node_modules_main_prod # --- Block for preset subpackage dependencies --- cp %{SOURCE7} . # Unpack dependency bundle for the preset package. It also creates 'node_modules_prod'. tar xfz %{SOURCE5} # Rename this one as well mv node_modules_prod node_modules_preset_prod # --- Create a unified node_modules for the %check section --- # This uses your original, correct logic, but applies it to both sets of dependencies. mkdir -p node_modules pushd node_modules # Link contents from BOTH bundles ln -s ../node_modules_main_prod/* . ln -s ../node_modules_preset_prod/* . # Handle .bin directories from both, if they exist if [ -d "../node_modules_main_prod/.bin" ]; then ln -s ../node_modules_main_prod/.bin . fi if [ -d "../node_modules_preset_prod/.bin" ]; then ln -s ../node_modules_preset_prod/.bin . fi popd %build # nothing to build %install # 1. Install the main cssnano package with its own dependencies mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name}/node_modules cp -pr package/package.json package/src %{buildroot}%{nodejs_sitelib}/%{npm_name}/ cp -pr node_modules_main_prod/* %{buildroot}%{nodejs_sitelib}/%{npm_name}/node_modules/ # 2. Install the preset package into its own directory with its own dependencies mkdir -p %{buildroot}%{nodejs_sitelib}/%{preset_name}/node_modules cp -pr package-a4/package.json package-a4/src %{buildroot}%{nodejs_sitelib}/%{preset_name}/ cp -pr node_modules_preset_prod/* %{buildroot}%{nodejs_sitelib}/%{preset_name}/node_modules/ # 3. CRITICAL STEP: Create a symlink so the main package can find the preset. # This makes the separate preset installation visible inside the main package's node_modules. ln -s ../../%{preset_name} %{buildroot}%{nodejs_sitelib}/%{npm_name}/node_modules/%{preset_name} %check # Change to the main package's source directory to run tests cd package # With the unified node_modules created in %prep, we can now run the checks %nodejs_symlink_deps --check # Test that the main module can be required %{__nodejs} -e 'require("./")' # Test that the preset can be required %{__nodejs} -e 'require("cssnano-preset-advanced")' %files %license package/LICENSE-MIT %license %{SOURCE3} %doc package/README.md %{nodejs_sitelib}/%{npm_name} %files -n nodejs-%{preset_name} %license package-a4/LICENSE-MIT %license %{SOURCE7} %doc package-a4/README.md %{nodejs_sitelib}/%{preset_name} %changelog ## START: Generated by rpmautospec * Tue Aug 05 2025 Jiri Kyjovsky - 7.0.7-3 - Uncommitted changes * Thu Jul 24 2025 Fedora Release Engineering - 7.0.7-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild * Tue Jul 15 2025 Jiri Kyjovsky - 7.0.7-1 - Initial package ## END: Generated by rpmautospec