# Description:  A language server for Bash
# URL: https://github.com/bash-lsp/bash-language-server
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: acorn pnpm typescript

name=bash-language-server
version=5.0.0
release=1
source=(https://github.com/bash-lsp/bash-language-server/archive/server-$version/$name-$version.tar.gz)

build() {
  cd $name-server-$version

  pnpm install --frozen-lockfile
  pnpm run compile

  rm -rf node_modules
  pnpm install --frozen-lockfile -P

  install -d $PKG/usr/lib/$name $PKG/usr/bin #$PKG/usr/lib/node_modules
  cp -a $SRC/$name-server-$version/server/* $PKG/usr/lib/$name/.
  #cp -a $SRC/$name-server-$version/node_modules/ $PKG/usr/lib/.
  chmod +x $PKG/usr/lib/$name/out/cli.js

  install -d $PKG/usr/bin
  ln -s /usr/lib/$name/out/cli.js $PKG/usr/bin/$name

  find $PKG \(\
    -iname "*README.md*" -o \
    -iname "*README.markdown*" -o \
    -iname "*CHANGELOG.md*" -o \
    -iname "*AUTHORS*" -o \
    -iname "*ChangeLog*" -o \
    -iname "*README_js.md*" -o \
    -iname "*COPYING*" -o \
    -iname "*LICENSE*" \) -delete
}
