summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6c6c3172da79003d70b264a8666bc88497aeb53d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Maintainer: Rubin Simons <me@rubin55.org>
# Contributor: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: hexchain <i at hexchain dot org>

_branch=main
_pkgname=yaml-language-server
pkgname=${_pkgname}-git
pkgver=r1318.5371011
pkgrel=2
pkgdesc='YAML Language Server, git main build'
url="https://github.com/redhat-developer/${_pkgname}"
license=(MIT)
arch=(any)
conflicts=(yaml-language-server)
depends=(nodejs)
makedepends=(jq yarn)
options=('!emptydirs' '!strip')
source=("${pkgname}::git+${url}.git#branch=${_branch}")
sha256sums=('SKIP')

pkgver() {
	cd "${srcdir}/${pkgname}"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

check() {
  cd $pkgname-$pkgver
  # see: https://github.com/redhat-developer/yaml-language-server/issues/1018
  #yarn test
}

build() {
  cd $pkgname
  yarn --frozen-lockfile
  yarn compile
}
package() {
  cd $pkgname

  # Emulate `npm prune --omit=dev`
  cp package.json{,.bak}
  read -ra devDependencies < <(jq -r '.devDependencies | keys | join(" ")' package.json)
  yarn remove --frozen-lockfile "${devDependencies[@]}"
  mv package.json{.bak,}

  install -d "$pkgdir"/usr/{bin,lib/node_modules/$_pkgname}
  ln -s ../lib/node_modules/$_pkgname/bin/$_pkgname "$pkgdir"/usr/bin/$_pkgname
  cp -r bin node_modules out package.json "$pkgdir"/usr/lib/node_modules/$_pkgname
  install -Dm644 -t "$pkgdir"/usr/share/doc/$pkgname {CHANGELOG,README}.md
  install -Dm644 -t "$pkgdir"/usr/share/licenses/$pkgname LICENSE
}