%bcond_without check %global npm_name aw-webui %global commit0 7de395b4b5d9097c2ee6fd2afcc9876bc969df66 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) %global url1 https://github.com/ActivityWatch/media %global commit1 ae8d3737a4984cc891076dc830ad117b13288a9f %global shortcommit1 %(c=%{commit1}; echo ${c:0:7}) Name: nodejs-%{npm_name} Version: %{shortcommit0} Release: %autorelease Summary: A web-based UI for ActivityWatch, built with Vue.js License: 0BSD and Apache-2.0 and (Apache-2.0 OR MIT) and Artistic-2.0 and BSD-2-Clause and BSD-3-Clause and CC-BY-4.0 and ISC and MIT and MPL-2.0 and (MPL-2.0 OR Apache-2.0) and Unlicense and W3C-20150513" URL: https://github.com/ActivityWatch/%{npm_name} Source0: %{url}/archive/%{commit0}/%{npm_name}-%{shortcommit0}.tar.gz Source1: https://github.com/wojnilowicz/activitywatch-copr/releases/download/7de395b/%{npm_name}-%{version}-nm-prod.tgz Source2: https://github.com/wojnilowicz/activitywatch-copr/releases/download/7de395b/%{npm_name}-%{version}-nm-dev.tgz Source3: %{npm_name}-%{version}-bundled-licenses.txt Source4: %{url1}/archive/%{commit1}/media-%{shortcommit1}.tar.gz BuildArch: noarch ExclusiveArch: %{nodejs_arches} noarch Requires: nodejs BuildRequires: nodejs-npm BuildRequires: nodejs-devel %description %{summary} %prep %autosetup -n %{npm_name}-%{commit0} -p1 # unpack some icons tar xfz %{SOURCE4} --strip-components 1 -C media cp -pr media/logo/logo.{png,svg} -t static # it's not a git repository, so querying git would fail sed -ri 's/git rev-parse --short HEAD/echo %{shortcommit0}/' vue.config.js # copy license cp -p %{SOURCE3} . # unpack npm prod dependencies straight to node_modules because # building fails when symlinking from node_modules_prod to node_modules tar xfz %{SOURCE1} --strip-components 2 --one-top-level=node_modules # unpack npm dev dependencies too because cannot find vue-cli-service # when building tar xfz %{SOURCE2} --strip-components 2 --one-top-level=node_modules %build npm run build %install # remove dependencies from package.json otherwise they're added to the requires # or want to be bundled sed -ri '/"dependencies"/,/\}/ d' package.json sed -ri '/"devDependencies"/,/\}/ d' package.json mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name} cp -pr dist package.json -t %{buildroot}%{nodejs_sitelib}/%{npm_name} %if %{with check} %check npm test %endif %files %license LICENSE.txt %{npm_name}-%{version}-bundled-licenses.txt %doc README.md %{nodejs_sitelib}/%{npm_name} %changelog %autochangelog