File nodejs-esbuild.spec of Package nodejs-esbuild

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


Name:           nodejs-esbuild
Version:        0.23.1
Release:        0
Summary:        This is a JavaScript bundler and minifier.
License:        MIT
URL:            https://github.com/evanw/esbuild
Source0:        esbuild-%{version}.tgz
Source1:        @esbuild-package.json
BuildRequires:  esbuild
Requires:       esbuild
Requires:       nodejs >= 18.0
BuildArch:      noarch

%description
This is a JavaScript bundler and minifier.
See https://github.com/evanw/esbuild and the
JavaScript API documentation for details.

%prep
%autosetup -n package

%build
mkdir nodejs_modules
mkdir -p @esbuild/linux-x64
cd @esbuild/linux-x64
mkdir bin
cd bin
ln -sf %{_bindir}/esbuild .
cd ..
sed -e "s/#VERSION#/%{version}/" %{SOURCE1} > package.json


%install
install -D -d -m 0755 %{buildroot}%{_prefix}/lib/node_modules/esbuild
mv @esbuild %{buildroot}%{_prefix}/lib/node_modules
cp -a * %{buildroot}%{_prefix}/lib/node_modules/esbuild

%files
%doc README.md
%license LICENSE.md
%dir %{_prefix}/lib/node_modules
%{_prefix}/lib/node_modules/esbuild/
%{_prefix}/lib/node_modules/@esbuild/

%changelog
openSUSE Build Service is sponsored by