Files
nodejs-bash-language-server/nodejs-bash-language-server.spec

117 lines
4.6 KiB
RPMSpec

#
# spec file for package nodejs-bash-language-server
#
# Copyright (c) Andreas Schneider <asn@cryptomilk.org>
#
# 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 http://bugs.opensuse.org/
#
%define pkg_name bash-language-server
Name: nodejs-bash-language-server
Version: 5.6.0
Release: 0
Summary: A language server for Bash
License: MIT
Url: https://github.com/bash-lsp/bash-language-server
Source0: %{url}/archive/server-%{version}/%{pkg_name}-%{version}.tar.gz
Source1: %{pkg_name}-%{version}-vendor.tar.zst
Source2: bashls-launcher.sh
Source3: bash-language-server-bundled-licenses.txt
Patch0: bashls-no-vscode.patch
BuildRequires: fdupes
BuildRequires: typescript
BuildRequires: npm >= 16
BuildRequires: pnpm >= 8
BuildRequires: perl
BuildRequires: zstd
Recommends: ShellCheck
Recommends: bash-completion
BuildArch: noarch
%description
Bash language server implementation based on Tree Sitter and its grammar for
Bash with explainshell integration.
%prep
%autosetup -n %{pkg_name}-server-%{version} -p1 -a1
cp %{SOURCE3} .
%build
pnpm install --offline --ignore-scripts --frozen-lockfile --store-dir="$(pwd)/.pnpm-store"
npm run compile
%install
# Only install production dependencies in node_modules
rm -rf node_modules/
pnpm install --production --offline --ignore-scripts --frozen-lockfile --package-import-method copy --store-dir="$(pwd)/.pnpm-store"
for S in $(grep -l '#!.*node' \
server/out/cli.js \
server/node_modules/ajv/scripts/* \
server/node_modules/escodegen/bin/* \
server/node_modules/esprima/bin/* \
server/node_modules/performance-now/test/scripts/* \
server/node_modules/pn/scripts/* \
server/node_modules/sshpk/bin/* \
server/node_modules/uuid/bin/* \
server/node_modules/vscode-languageserver/bin/* \
) ; do
SB="${S}.backup"
cp ${S} ${SB}
perl -p -i -e 's|#!/usr/bin/env node|#!%{_bindir}/node|g' $S
diff -urN ${SB} ${S} || :
rm ${SB}
done
install -d -m 0755 %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/
cp -av server %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/
cp -av node_modules %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/
install -d -m 0755 %{buildroot}%{_bindir}
install -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/%{pkg_name}
find %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name} -name "*.bak" -delete
find %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name} -type f -name "\.*" -delete
find %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name} -type d -name "\.bin" -print0 | xargs -0 rm -rf
find %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name} -type d -name "\.github" -print0 | xargs -0 rm -rf
find %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name} -type d -name "\.yarn" -print0 | xargs -0 rm -rf
rm -f %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/node_modules/.pnpm/editorconfig@*/node_modules/editorconfig/bin/editorconfig
rm -f %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/node_modules/.pnpm/semver@*/node_modules/semver/bin/semver.js
rm -rf %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/server/node_modules/ajv/scripts/
rm -rf %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/server/node_modules/dashdash/etc/
rm -rf %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/server/node_modules/performance-now/test/
rm -f %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/server/src/get-options.sh
# dangling symlinks
rm -f %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/server/node_modules/@types/fuzzy-search
rm -f %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/server/node_modules/@types/node-fetch
rm -f %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/server/node_modules/@types/turndown
rm -f %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/server/node_modules/@types/urijs
%fdupes %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}
%files
%license LICENSE bash-language-server-bundled-licenses.txt
%doc README.md server/CHANGELOG.md
%dir %{_prefix}/lib/node_modules
%{_bindir}/%{pkg_name}
%{_prefix}/lib/node_modules/%{pkg_name}/
%changelog