addpkg: pnpm

This commit is contained in:
MedzikUser 2022-05-21 12:15:23 +02:00
parent 9de46f0e62
commit d69846669e
No known key found for this signature in database
GPG Key ID: A5FAC1E185C112DB
4 changed files with 68 additions and 0 deletions

2
.gitignore vendored
View File

@ -3,6 +3,8 @@
# source files
*.tar*
*.tgz
*.part
*.zip
*.rar
*.7z

26
packages/pnpm/PKGBUILD Normal file
View File

@ -0,0 +1,26 @@
# Maintainer: MedzikUser <nivua1fn@duck.com>
pkgname='pnpm'
pkgver="7.1.2"
pkgrel=1
pkgdesc='Fast, disk space efficient package manager'
arch=('any')
url="https://www.npmjs.com/package/${pkgname}"
license=('MIT')
depends=('nodejs')
makedepends=('npm')
_file="${pkgname}-${pkgver}.tgz"
source=("https://registry.npmjs.org/${pkgname}/-/${_file}")
noextract=("$_file")
sha256sums=('839b1b6c3b6504f08a56d78aa38d35d48bba76684fe391229f112c65e25f0862')
package() {
npm install -g --prefix "${pkgdir}/usr" "${_file}"
# Non-deterministic race in npm gives 777 permissions to random directories.
# See https://github.com/npm/npm/issues/9359 for details.
chmod -R u=rwX,go=rX "${pkgdir}"
# npm installs package.json owned by build user
# https://bugs.archlinux.org/task/63396
chown -R root:root "${pkgdir}"
}

1
packages/pnpm/built.conf Normal file
View File

@ -0,0 +1 @@
NPM="pnpm"

View File

@ -118,6 +118,45 @@ update-package() {
return 0
fi
if [ -n "${NPM}" ]
then
local latest_version="$(curl --location --silent "https://unpkg.com/${NPM}/package.json" | jq -r ".version")"
if [[ -z "${latest_version}" || "${latest_version}" = "null" ]]
then
echo "[!] Failed to get latest version of ${pkgname}"
return 1
fi
custom_vars=$(
. "${pkgdir}/PKGBUILD"
echo "local version=${pkgver}"
)
eval "${custom_vars}"
if [ "${version}" = "${latest_version}" ]
then
return 0
fi
sed -i "s|^\(pkgver=\)\(.*\)\$|\1\"${latest_version}\"|g" "${pkgdir}/PKGBUILD"
# Update package checksums
cd "${pkgdir}"
updpkgsums
if [ "${GIT_COMMIT_PACKAGES}" = "true" ]
then
git add "${pkgdir}/PKGBUILD"
git commit -m "upgpkg: '${pkgname}' to '${latest_version}'"
fi
echo "[i] Updated '${pkgname}' to '${latest_version}'"
return 0
fi
fi
}