# Tests require network %bcond_with tests %global npm_name electron-packager Name: nodejs-%{npm_name} Version: 15.4.0 Release: 1%{?dist} Summary: Electron packaging tool that creates OS-specific bundles License: BSD and ASL 2.0 CC0 and CC-BY and ISC and MIT URL: https://www.npmjs.com/package/%{npm_name} # NPM archive does not contain tests. Source0: https://github.com/electron/%{npm_name}/archive/v%{version}/%{npm_name}-%{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-devel %description Customize and package your Electron app with OS-specific bundles (.app, .exe, etc.) via JS or CLI. %prep %setup -q -n %{npm_name}-%{version} cp %{SOURCE3} . %build # Setup bundled node modules tar xfz %{SOURCE1} mkdir -p node_modules cp -a node_modules_prod/* node_modules/ cp -a node_modules_prod/.bin node_modules/ # Fix shebangs for f in $(grep -rl '^#!/usr/bin/env node$'); do sed -i 's|#!/usr/bin/env node$|#!/usr/bin/node|' $f done %install mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pr src/ bin/ package.json usage.txt %{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}%{_bindir}/ cp -a %{buildroot}%{nodejs_sitelib}/%{npm_name}/bin/%{npm_name}.js %{buildroot}%{_bindir}/%{npm_name} %check %nodejs_symlink_deps --check # Setup bundled dev node_modules for testing tar xfz %{SOURCE2} for mod in node_modules_dev/* node_modules_dev/@*/* ; do basename="$(sed 's|node_modules_dev/||' <<< ${mod})" if ! [ -e "node_modules/${basename}" ]; then cp -a "${mod}" "node_modules/${basename}" fi done for bin in node_modules_dev/.bin/*; do if ! [ -e "node_modules/.bin/$(basename ${bin})" ]; then cp -a "${bin}" node_modules/.bin/ fi done %if %{with tests} ./node_modules/.bin/ava test/index.js %endif %files %license LICENSE collaborators.md usage.txt %{npm_name}-%{version}-bundled-licenses.txt %doc {README,NEWS,docs/*}.md %{nodejs_sitelib}/%{npm_name} %{_bindir}/%{npm_name} %changelog * Mon Feb 14 2022 Maxwell G - 15.4.0-1 - Initial package