void-packages/srcpkgs/pnpm/template

31 lines
1002 B
Bash

# Template file for 'pnpm'
pkgname=pnpm
version=8.8.0
revision=1
build_style=fetch
hostmakedepends="nodejs jq"
depends="nodejs"
short_desc="Fast, disk space efficient package manager"
maintainer="Bnyro <bnyro@tutanota.com>"
license="MIT"
homepage="https://pnpm.io/"
distfiles="https://registry.npmjs.org/pnpm/-/pnpm-${version}.tgz"
checksum=d713a5750e41c3660d1e090608c7f607ad00d1dd5ba9b6552b5f390bf37924e9
python_version=3
do_install() {
npm install -g --user root --prefix "${DESTDIR}/usr" "${XBPS_SRCDISTDIR}/${pkgname}-${version}/${pkgname}-${version}.tgz"
local _npmdir="${DESTDIR}/usr/lib/node_modules/${pkgname}"
# Sort and cleanup package.json
jq '.|=with_entries(select(.key|test("_.+")|not))' "$_npmdir/package.json" > "$_npmdir/package.json"
chmod 644 "$_npmdir/package.json"
# Delete JS SourceMaps
find "${DESTDIR}/usr/lib" -depth -name '*.map' -delete
vlicense "$_npmdir/LICENSE"
vdoc "$_npmdir/README.md"
rm -rf "${DESTDIR}/usr/etc" "$_npmdir/LICENSE" "$_npmdir/README.md"
}