File nodejs-patch-package.spec of Package nodejs-patch-package
#
# spec file for package file
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define mod_name patch-package
%global _use_internal_dependency_generator 0
%if 0%{?usrmerged}
%define nodejs_sitelib %{_prefix}/local/lib/node_modules
%else
%define nodejs_sitelib %{_prefix}/lib/node_modules
%endif
Name:           nodejs-patch-package
Version:        6.4.7
Release:        0
Summary:        Fix broken node modules instantly 🏃🏽♀️
License:        MIT
Group:          Development/Libraries/Other
URL:            https://github.com/ds300/patch-package
Source0:        %{mod_name}-%{version}.tar.gz
Source1:        %{mod_name}-node_modules-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  nodejs
#BuildRequires:  nodejs-packaging
BuildRequires:  yarn
Requires:       nodejs
BuildArch:      noarch
%description
patch-package lets app authors instantly make and keep fixes to npm dependencies. It's a vital band-aid for those of us living on the bleeding edge.
%prep
mkdir -p %{_builddir}/node_modules_offline
%setup -q -T -D -a 1 -n node_modules_offline
%setup -q -n %{mod_name}-%{version}
%build
yarn config set yarn-offline-mirror %{_builddir}/node_modules_offline/npm-packages-offline-cache
%if 0%{?usrmerged}
mkdir -p %{buildroot}%{_prefix}/local/bin/
yarn --offline config set prefix %{buildroot}%{_prefix}/local/
yarn --offline config set global-folder %{buildroot}%{_prefix}/local/lib
%else
mkdir -p %{buildroot}%{_bindir}/
yarn --offline config set prefix %{buildroot}%{_prefix}/
yarn --offline config set global-folder %{buildroot}%{_prefix}/lib
%endif
yarn --offline install
#yarn --offline run build 
./node_modules/.bin/tsc --project tsconfig.build.json
%install
mkdir -p %{buildroot}%{nodejs_sitelib}
yarn pack .
%if 0%{?usrmerged}
    yarn global add --offline file:/$PWD/%{mod_name}-v%{version}.tgz --prefix=%{buildroot}%{_prefix}/local
    rm %{buildroot}%{_prefix}/local/lib/package.json
    rm %{buildroot}%{_prefix}/local/lib/yarn.lock
%else
    yarn global add --offline file:/$PWD/%{mod_name}-v%{version}.tgz --prefix=%{buildroot}%{_prefix}
    rm %{buildroot}%{_prefix}/lib/package.json
    rm %{buildroot}%{_prefix}/lib/yarn.lock
%endif
%fdupes %{buildroot}
%files
%if 0%{?usrmerged}
%{_prefix}/local/bin/%{mod_name}
%else
%{_bindir}/%{mod_name}
%endif
%defattr(-,root,root)
%license LICENSE
%doc README.md
/%{nodejs_sitelib}
%changelog