arch-pkgs/rollup/PKGBUILD

47 lines
1.6 KiB
Bash

# Maintainer: Simon Legner <Simon.Legner@gmail.com>
# Contributor: George Rawlinson <george@rawlinson.net.nz>
pkgname=rollup
pkgver=2.67.0
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=('5bcdc0684470bc3887c07105fdd7c07d2df3d417b9c1fee7fa93b76403b921069d093da5053afb590d8cc1965efa7a1d6c3fa7dc7b42e0e08e01db0e3cf70a65')
b2sums=('337e59fe090c57d14a59d4632b6d56b179fea052a7af2a347ad4c814c719d54f1f9c5c987c9fec1f5d360a6dfc3f0defeb543bc25859094e4f1ecb6cd3f6115b')
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"
}