Files
synp/synp.spec

79 lines
2.6 KiB
RPMSpec

#
# spec file for package synp
#
# Copyright (c) 2024 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/
#
# The internal dependency generator adds lots of unnecessary Requires:
# and strange Provides: own(foo) because it slurps in all package.json
%global __nodejs_provides %{nil}
%global __nodejs_requires %{nil}
Name: synp
Version: 1.9.14
Release: 0
Summary: Convert yarn.lock to package-lock.json and vice versa
License: MIT
URL: https://github.com/imsnif/synp
Source0: %{name}-%{version}.tar.gz
Source1: npm-packages-offline-cache.tar.zst
Source2: yarnrc
Source3: Makefile
Source4: PACKAGING_README.md
Source5: vendor_yarn_dependencies.sh
#
BuildRequires: yarn
BuildRequires: fdupes
#
BuildArch: noarch
%description
Convert yarn.lock to package-lock.json and vice versa.
%prep
%autosetup -p 1
tar xf %{SOURCE1}
cp %{SOURCE2} ./.yarnrc
%build
echo "Build is here..."
%install
mkdir -p %{buildroot}/usr/lib/%{name}/
tar xf %{SOURCE0} -C %{buildroot}/usr/lib/%{name}/ --strip-components=1
rm -rf %{buildroot}/usr/lib/%{name}/test/
yarn install --offline
cp -r ./node_modules/ %{buildroot}/usr/lib/%{name}/
mkdir -p %{buildroot}/%{_bindir}/
sed -i 's|/usr/bin/env node|/usr/bin/node|' %{buildroot}/usr/lib/%{name}/cli/%{name}.js
sed -i 's|/usr/bin/env node|/usr/bin/node|' %{buildroot}/usr/lib/%{name}/cli/run.js
sed -i 's|/usr/bin/env node|/usr/bin/node|' %{buildroot}/usr/lib/%{name}/node_modules/*/node_modules/*/bin/*
sed -i 's|/usr/bin/env node|/usr/bin/node|' %{buildroot}/usr/lib/%{name}/node_modules/*/bin/*
sed -i 's|/usr/bin/env node|/usr/bin/node|' %{buildroot}/usr/lib/%{name}/node_modules/@babel/core/node_modules/semver/bin/semver
find %{buildroot}/usr/lib/%{name}/node_modules/ -name "*.js" -print0 | xargs -0 sed -i 's|/usr/bin/env node|/usr/bin/node|'
%fdupes %{buildroot}/usr/lib/%{name}/
ln -s /usr/lib/%{name}/cli/%{name}.js %{buildroot}/%{_bindir}/%{name}
%files
%license LICENSE.md
%doc README.md
%{_bindir}/%{name}
/usr/lib/%{name}/
%changelog