# shellcheck shell=bash disable=SC2034
# Included in Slint by Didier Spaier didieratslintdotfr

pkgname=pnpm
pkgver=10.30.1
pkgrel=1slint
arch=noarch
slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (fast, disk-efficient package manager for Node.js)"
"pnpm is a fast Node.js package manager with a content-addressable"
"store and workspace support."
)
url="https://pnpm.io"
license=('MIT')
depends=('nodejs')
source=("https://registry.npmjs.org/${pkgname}/-/${pkgname}-${pkgver}.tgz")
sha256sums=('bc8bb877378eab6a8a83114eeb6a31ef88528db4ab5570299baba8fa54da2375')
docs=("README.md" "LICENSE")
options=("nosrcpack")

build() {
  cd "$SRC/package" || exit 1

  install -dm755 "$PKG/usr/lib/node_modules/$pkgname"
  cp -a bin dist package.json "$PKG/usr/lib/node_modules/$pkgname"

  install -dm755 "$PKG/usr/bin"
  ln -sf "../lib/node_modules/$pkgname/bin/pnpm.cjs" "$PKG/usr/bin/pnpm"
  ln -sf "../lib/node_modules/$pkgname/bin/pnpx.cjs" "$PKG/usr/bin/pnpx"

  install -Dm644 "dist/templates/completion.bash" \
    "$PKG/usr/share/bash-completion/completions/pnpm"
  install -Dm644 "dist/templates/completion.fish" \
    "$PKG/usr/share/fish/vendor_completions.d/pnpm.fish"
  install -Dm644 "dist/templates/completion.zsh" \
    "$PKG/usr/share/zsh/site-functions/_pnpm"
}
