File nodejs-vite.spec of Package nodejs-vite

#
# spec file for package nodejs-vite
#
# 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/
#


%define mod_name vite
Name:           nodejs-%{mod_name}
Version:        5.4.2
Release:        0
Summary:        Next Generation Frontend Tooling
License:        MIT
# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group:          Development/Languages/NodeJS
URL:            https://vitejs.dev/
Source0:        %{mod_name}-%{version}.tgz
Source1:        node_modules-%{version}.tar.xz
BuildRequires:  fdupes
BuildRequires:  nodejs
BuildRequires:  nodejs-esbuild
BuildRequires:  nodejs-rollup
Requires:       nodejs
Requires:       nodejs-esbuild
Requires:       nodejs-package-config
Requires:       nodejs-rollup

%description
Next Generation Frontend Tooling.

Get ready for a development environment that can finally catch up with you.

%prep
%setup -q -n package
tar xfJ %{SOURCE1}

%build
cd node_modules
ln -sf %{_prefix}/lib/node_modules/rollup .
ln -sf %{_prefix}/lib/node_modules/esbuild .

%install
mkdir -p %{buildroot}%{_prefix}/lib/node_modules/%{mod_name}
cp -r * %{buildroot}%{_prefix}/lib/node_modules/%{mod_name}

chmod +x %{buildroot}%{_prefix}/lib/node_modules/%{mod_name}/bin/vite.js
mkdir -p %{buildroot}%{_prefix}/lib/node_modules/.bin
ln -sf %{_prefix}/lib/node_modules/%{mod_name}/bin/vite.js %{buildroot}%{_prefix}/lib/node_modules/.bin/vite

%fdupes %{buildroot}

%files
%dir %{_prefix}/lib/node_modules
%{_prefix}/lib/node_modules/%{mod_name}
%dir %{_prefix}/lib/node_modules/.bin
%{_prefix}/lib/node_modules/.bin/%{mod_name}

%changelog
openSUSE Build Service is sponsored by