blob: 07cfaa8a57451bd4a824e1c318c415e133507de4 (
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
52
53
54
55
|
# Maintainer: zoorat <zoorat [at] protonmail [dot] com>
_npmname=autocannon
pkgname=nodejs-$_npmname
pkgver=8.0.0
pkgrel=1
pkgdesc="fast HTTP/1.1 benchmarking tool written in Node.js"
arch=(any)
url="https://github.com/mcollina/autocannon"
license=("MIT")
depends=("nodejs")
makedepends=("npm" "jq")
provides=("$_npmname")
conflicts=("$_npmname")
changelog="changelog.md"
source=("https://registry.npmjs.org/${_npmname}/-/${_npmname}-${pkgver}.tgz"
"https://raw.githubusercontent.com/mcollina/autocannon/master/LICENSE")
noextract=("${_npmname}-${pkgver}.tgz")
b2sums=('6bdf2b9bfb0dfe0b6f33d98f90d44ab2c38d0dff43758f3db12228db9541fb6e4bfce264a54c4499570745ca41202bd667619286b1892352e29e0f677480ed1a'
'ac1f56051dfc2f729db4d635ff40ab143314a29b3a3259967e1d83ab1b26cb53059a29d3ec52f1358e588b90cadbcc4a63cf3feb485770b085b7cbfd8313e43a')
# Document: https://wiki.archlinux.org/title/Node.js_package_guidelines
package() {
# Install using Using npm
npm install -s -g \
--cache "${srcdir}/npm-cache" \
--prefix "${pkgdir}/usr" \
"${srcdir}/${_npmname}-${pkgver}.tgz"
# Fix ownership of ALL FILES
find "${pkgdir}/usr" -type d -exec chmod 755 {} +
chown -R root:root "${pkgdir}"
# Remove references to $pkgdir
find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d'
local tmppackage="$(mktemp)"
local pkgjson="$pkgdir/usr/lib/node_modules/$_npmname/package.json"
jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" >"$tmppackage"
mv "$tmppackage" "$pkgjson"
chmod 644 "$pkgjson"
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
# Install LICENSE file
install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
|