arch-pkgs/rollup/PKGBUILD
2022-02-21 08:45:41 +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.67.3
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=('1bfc75bd4c1b1ad3fa3b964cf3fb16afcfa9ed87d9848d7ca4fa8c46d31831649b1e3299fda8c71a233e196353956c8e47410721d4fc2c753e678722219d6807')
b2sums=('ad2ab054c39ecb49d44c8d3101b81e25323d8dc8f977a117ce6bb3808f896d6d507a36f19285032afefb63f4f6eafc99801f3bbe4d1e35d90f04f4136583986a')
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"
}