blob: b5010474a57de018a45606879d116a452b8ef61b (
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
|
# Maintainer: gardenapple@posteo.net
pkgname=readability-cli
pkgver=2.3.0
pkgrel=1
pkgdesc="Firefox Reader Mode in your terminal! - CLI tool for Mozilla's Readability library"
arch=('any')
url="https://www.npmjs.com/package/$pkgname"
license=('GPL3')
depends=('nodejs')
makedepends=('npm' 'jq')
optdepends=('bash-completion: Bash completion'
'zsh: zsh completion')
source=("https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz")
noextract=("$pkgname-$pkgver.tgz")
sha256sums=('f648307986666dfb657299006a9d362a83f5e681fb28c8f49b278bbbc2dc19e5')
b2sums=('cb14d6d704ee8e8abf8ea46814ea478a6d75e1260553acc4163c9a281de7ec5b5bdc2764d7a4da501041b1d9640a66e0eea34b57f60a1b6682368b302e3f3b98')
package() {
npm install -g --prefix "$pkgdir/usr" "$srcdir/$pkgname-$pkgver.tgz"
# Shell completions
cd "$pkgdir/usr/bin"
SHELL=/bin/zsh ./readable --completion \
| install -Dm644 /dev/stdin "$pkgdir/usr/share/zsh/site-functions/_readable"
SHELL=/bin/bash ./readable --completion \
| install -Dm644 /dev/stdin "$pkgdir/usr/share/bash-completion/completions/readable"
cd -
# Remove references to $pkgdir
find "$pkgdir" -type f -name package.json -print0 | xargs -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"
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
}
|