blob: f5244c8f8ee230e4a1440b2b16beb4af2707cf23 (
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: gardenapple <mailbox@appl.garden>
_pkgname=readability-cli
pkgname="nodejs-$_pkgname"
pkgver=2.4.5
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')
provides=('readability-cli' 'readable')
conflicts=('readability-cli')
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=('5a98e20670d599147e59320dfb6147ba8a99a124b0cf9b1d6c30a564ae666128')
b2sums=('099923799beebb1767509ac877545be03cdb44924134de4068ed78f2cdba632c477b9cdbb7e247f583aaf21e5433a5b8f39ef42f5a69d653a7113b5514114661')
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 -
# Man pages
cd "$pkgdir/usr/share/man/man1"
cp --no-dereference 'readability-cli.1' 'readable.1'
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
}
|