summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 576d227c9df09ce9b6f1587580a7b5ff3d93ecc1 (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
# Maintainer: Chocobo1 <chocobo1 AT archlinux DOT net>

pkgname=js-beautify-git
pkgver=1.14.7.r19.g686f8c1b
pkgrel=1
pkgdesc="Beautifier for javascript"
arch=('any')
url="https://beautifier.io/"
license=('MIT')
depends=('nodejs')
makedepends=('git' 'npm')
provides=("js-beautify=$pkgver")
conflicts=('js-beautify')
source=("git+https://github.com/beautify-web/js-beautify.git")
sha256sums=('SKIP')


pkgver() {
  cd "js-beautify"

  _tag=$(git tag -l --sort -v:refname | head -n1)
  _rev=$(git rev-list --count $_tag..HEAD)
  _hash=$(git rev-parse --short HEAD)
  printf "%s.r%s.g%s" "$_tag" "$_rev" "$_hash" | sed 's/^v//'
}

build() {
  cd "js-beautify"

  npm install -D
  tools/build.sh js
}

package() {
  cd "js-beautify"

  npm install -g --user root --prefix="$pkgdir/usr" git+file://$(pwd)
  rm -r "$pkgdir/usr/lib/node_modules/js-beautify/js"/*
  cp -r js/* "$pkgdir/usr/lib/node_modules/js-beautify/js"
  install -Dm644 "LICENSE" -t "$pkgdir/usr/share/licenses/js-beautify"

  find "$pkgdir/usr" -type d -exec chmod 755 {} +
  chown -R root:root "$pkgdir"
}