%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: nodejs-packaging Version: 2023.10 Release: 1%{?dist} Summary: RPM macros and utilities for Node.js packaging License: MIT URL: https://fedoraproject.org/wiki/Node.js/Packagers Source1: LICENSE Source2: README.md Source3: macros.nodejs Source4: multiver_modules Source5: nodejs-fixdep Source6: nodejs-setversion Source7: nodejs-symlink-deps Source8: nodejs.attr Source9: nodejs.prov Source10: nodejs.req Source11: nodejs_abi.attr Source12: nodejs_abi.req Source13: nodejs-packaging-bundler # Created with `tar cfz test.tar.gz test` Source14: test.tar.gz BuildRequires: python3 # Several of the macros require the /usr/bin/node command, so we need to # ensure that it is present when packaging. Requires: nodejs Requires: redhat-rpm-config ExclusiveArch: %{nodejs_arches} noarch x86_64 aarch64 BuildArch: noarch %description This package contains RPM macros and other utilities useful for packaging Node.js modules and applications in RPM-based distributions. %package bundler Summary: Bundle a node.js application dependencies Requires: npm Requires: coreutils Requires: findutils Requires: jq %description bundler nodejs-packaging-bundler bundles a node.js application node_module dependencies It gathers the application tarball. It generates a runtime (prod) tarball with runtime node_module dependencies It generates a testing (dev) tarball with node_module dependencies for testing It generates a bundled license file that gets the licenses in the runtime dependency tarball %prep cp -da %{_sourcedir}/* . tar xvf test.tar.gz %build %{nil} %install install -Dpm0644 macros.nodejs %{buildroot}%{macrosdir}/macros.nodejs install -Dpm0644 nodejs.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs.attr install -Dpm0644 nodejs_abi.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_abi.attr install -pm0755 nodejs.prov %{buildroot}%{_rpmconfigdir}/nodejs.prov install -pm0755 nodejs.req %{buildroot}%{_rpmconfigdir}/nodejs.req install -pm0755 nodejs_abi.req %{buildroot}%{_rpmconfigdir}/nodejs_abi.req install -pm0755 nodejs-symlink-deps %{buildroot}%{_rpmconfigdir}/nodejs-symlink-deps install -pm0755 nodejs-fixdep %{buildroot}%{_rpmconfigdir}/nodejs-fixdep install -pm0755 nodejs-setversion %{buildroot}%{_rpmconfigdir}/nodejs-setversion install -Dpm0644 multiver_modules %{buildroot}%{_datadir}/node/multiver_modules install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packaging-bundler %check ./test/run %files %license LICENSE %{macrosdir}/macros.nodejs %{_rpmconfigdir}/fileattrs/nodejs*.attr %{_rpmconfigdir}/nodejs* %{_datadir}/node/multiver_modules %files bundler %{_bindir}/nodejs-packaging-bundler