arch-pkgs/rollup/PKGBUILD

46 lines
1.6 KiB
Bash

# Maintainer: Simon Legner <Simon.Legner@gmail.com>
# Contributor: George Rawlinson <george@rawlinson.net.nz>
pkgname=rollup
pkgver=2.75.1
pkgrel=1
pkgdesc='Next-generation ES6 module bundler'
arch=(any)
url='https://rollupjs.org/'
license=('MIT')
depends=('nodejs')
makedepends=('npm' 'jq')
source=("$pkgname-$pkgver.tar.gz::https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz")
noextract=("$pkgname-$pkgver.tar.gz")
sha512sums=('cc3ef7aeadc56a7affb299a2c9b32a98612f3a9af28ff85e2ea39bfa5b9bc625e5a3c6b3789ff3df4e93d9d258bb37d664f4014b4393fbe1971ba2db7784e82b')
b2sums=('70ca1ed176cf387d7782419a7dc16ba122851c1a6710dd8f460839f1885238b8a68da004caa877f9fc05307d8f49f63e382d13174b607ea29f59ffddf15b2a07')
package() {
local NPM_FLAGS=(--no-audit --no-fund --no-update-notifier)
npm install \
--global \
--prefix "$pkgdir/usr" \
--cache "$srcdir/npm-cache" \
"${NPM_FLAGS[@]}" \
"$pkgname-$pkgver.tar.gz"
# install licenses
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" \
"$pkgdir/usr/lib/node_modules/rollup/LICENSE.md"
# install documentation
install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" \
"$pkgdir/usr/lib/node_modules/rollup/"{CHANGELOG,README}.md
# remove references to ${src,pkg}dir
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"
# npm gives ownership of ALL FILES to build user
# https://bugs.archlinux.org/task/63396
chown -R root:root "$pkgdir"
}