blob: a79090ba922c04b0360e74ad5fa11a177e35e167 (
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
|
# Maintainer: Tiago Seabra <tiagolseabra at gmail dot com>
pkgname=lighthouse
pkgver=11.7.1
pkgrel=1
pkgdesc='Automated auditing, performance metrics, and best practices for the web'
arch=(any)
url='https://github.com/GoogleChrome/lighthouse'
license=('Apache-2.0')
depends=(nodejs)
makedepends=(npm jq)
source=("https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz")
noextract=("$pkgname-$pkgver.tgz")
sha256sums=('96f3a62ef46c551c23e24978d54ba247491d34692b634b5dcf6abe54130b2fe7')
package() {
npm install -g \
--cache "$srcdir/npm-cache" \
--prefix "$pkgdir/usr" \
"$srcdir/$pkgname-$pkgver.tgz"
# npm gives ownership of ALL FILES to build user
# https://bugs.archlinux.org/task/63396
chown -R root:root "$pkgdir"
# remove references to $pkgdir
find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d'
# remove references to $srcdir
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"
}
|