diff options
author | Daniel M. Capella | 2021-02-15 12:00:18 +0000 |
---|---|---|
committer | Daniel M. Capella | 2021-02-15 12:00:18 +0000 |
commit | 7163a3ad30cf1f0040dbabb52883ecadc89066fc (patch) | |
tree | 48800bb14b9aa72b66742a2e60732ddee5036c07 | |
parent | d76eb37a5c92c3ed65de9ade733a413d7f6db8cd (diff) | |
download | aur-7163a3ad30cf1f0040dbabb52883ecadc89066fc.tar.gz |
Respect lockfiles, run tests, obey namcap
-rw-r--r-- | PKGBUILD | 53 |
1 files changed, 43 insertions, 10 deletions
@@ -1,25 +1,58 @@ # Maintainer: Daniel M. Capella <polyzen@archlinux.org> +_name=HTMLHint pkgname=htmlhint pkgver=0.14.2 -pkgrel=1 +pkgrel=2 pkgdesc='Static Code Analysis Tool for your HTML' arch=('any') url=https://htmlhint.com/ license=('MIT') depends=('nodejs') -makedepends=('npm') -source=("https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz") -noextract=("$pkgname-$pkgver.tgz") -sha512sums=('9540a019567fa320a4a600e421ae487c29705fc3e9cb5d4393b5dd7956e80064a62a322e38ac7acb2f3a592d16d3c285b4246ec5fb73372f8a7508cce148ea08') +makedepends=('git' 'jq' 'npm') +source=("git+https://github.com/htmlhint/HTMLHint.git#tag=v$pkgver") +b2sums=('SKIP') + +build() { + cd $_name + npm ci + npm run build + npm pack +} + +check() { + cd $_name + npm test +} package() { - npm install -g --user root --prefix "$pkgdir"/usr --ignore-scripts --production $pkgname-$pkgver.tgz + cd $_name + npm install --global \ + --user root \ + --prefix "$pkgdir"/usr \ + --production \ + $pkgname-$pkgver.tgz + chown -R root:root "$pkgdir" + cp -r dist "$pkgdir"/usr/lib/node_modules/$pkgname + install -d "$pkgdir"/usr/share/licenses/$pkgname + ln -s /usr/lib/node_modules/$pkgname/LICENSE.md \ + "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.md + + # Remove references to $srcdir and $pkgdir + find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d' + + local tmppackage="$(mktemp)" + local pkgjson="$pkgdir/usr/lib/node_modules/$pkgname/package.json" + jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" > "$tmppackage" + mv "$tmppackage" "$pkgjson" + chmod 644 "$pkgjson" - cd "$pkgdir" - mkdir -p usr/share/licenses/$pkgname - mv usr/lib/node_modules/$pkgname/LICENSE.md usr/share/licenses/$pkgname - chown -R root:root . + find "$pkgdir" -type f -name package.json | while read pkgjson; do + local tmppackage="$(mktemp)" + jq 'del(.man)' "$pkgjson" > "$tmppackage" + mv "$tmppackage" "$pkgjson" + chmod 644 "$pkgjson" + done } # vim:set ts=2 sw=2 et: |