# Template file for 'bash-language-server'
pkgname=bash-language-server
version=5.0.0
revision=1
hostmakedepends="pnpm"
depends="nodejs"
short_desc="Bash language server"
maintainer="sirkhancision <jsantiago12tone@gmail.com>"
license="MIT"
homepage="https://github.com/bash-lsp/bash-language-server"
distfiles="https://github.com/bash-lsp/bash-language-server/archive/refs/tags/server-${version}.tar.gz"
checksum=ef8d104591cfcddf85da14af9585d8f0ab97f12e158df67ab50900f7342e353a

do_build() {
	pnpm install --frozen-lockfile
	pnpm run compile
}

do_install() {
	TARGET_PATH="usr/lib/${pkgname}"
	cd server

	rm -r node_modules
	npm install --production

	vmkdir ${TARGET_PATH}
	vcopy * ${TARGET_PATH}

	vmkdir usr/bin
	ln -sf /${TARGET_PATH}/out/cli.js ${DESTDIR}/usr/bin/${pkgname}
	chmod 0755 ${DESTDIR}/${TARGET_PATH}/out/cli.js

	vlicense ../LICENSE
}
