arch-pkgs/rollup/PKGBUILD
2022-03-05 20:08:21 +00:00

46 lines
1.6 KiB
Bash

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