diff options
author | Benjamin Denhartog | 2020-11-29 00:35:16 -0700 |
---|---|---|
committer | Benjamin Denhartog | 2020-11-29 02:24:49 -0700 |
commit | b37ced1ddccdbd40e8a2d95a1727595faffecea7 (patch) | |
tree | fe5202c769638dd74d21d17a76c2097edef60a13 | |
parent | 6ac79fcb21bfaa9a8a142374bf9dd21e627a45ff (diff) | |
download | aur-b37ced1ddccdbd40e8a2d95a1727595faffecea7.tar.gz |
feat(firebase): refactor PKGBUILD to follow best practices for nodejs packages
-rw-r--r-- | .SRCINFO | 12 | ||||
-rw-r--r-- | PKGBUILD | 59 |
2 files changed, 47 insertions, 24 deletions
@@ -1,17 +1,15 @@ pkgbase = firebase-tools pkgdesc = The Firebase Command Line Tools pkgver = 8.9.0 - pkgrel = 1 - url = https://firebase.google.com/docs/cli/ - install = firebase-tools.install + pkgrel = 2 + url = https://github.com/firebase/firebase-tools arch = any license = MIT makedepends = npm depends = nodejs - provides = nodejs-firebase-tools - conflicts = nodejs-firebase-tools - replaces = nodejs-firebase-tools - noextract = firebase-tools-8.9.0.tgz + conflicts = firebase-tools + replaces = firebase-tools + noextract = firebase-tools-v8.9.0.tgz source = https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.9.0.tgz sha256sums = 544070dbd2955a3613d7f0c5a05cc1088b144ddef2776a893244c3d194871c2b @@ -1,35 +1,60 @@ -# Maintainer: Raphaël Doursenaud <rdoursenaud@free.fr> -# Previous Maintainer: crasm <crasm@firebase-tools.aur.yooz4sio.vczf.io> -# PKGBUILD structure copied from grunt-cli package +# Maintainer: Benjamin Denhartog <ben@sudoforge.com> +# Contributor: Raphaël Doursenaud <rdoursenaud@free.fr> +# Contributor: crasm <crasm@firebase-tools.aur.yooz4sio.vczf.io> pkgname=firebase-tools pkgver=8.9.0 -pkgrel=1 +pkgrel=3 pkgdesc="The Firebase Command Line Tools" arch=('any') -url="https://firebase.google.com/docs/cli/" +url="https://github.com/firebase/firebase-tools" license=('MIT') depends=('nodejs') -makedepends=('npm') -provides=('nodejs-firebase-tools') -conflicts=('nodejs-firebase-tools') -replaces=('nodejs-firebase-tools') -install=${pkgname}.install +makedepends=( + 'npm' + 'jq' +) +conflicts=('firebase-tools') +replaces=('firebase-tools') source=("https://registry.npmjs.org/${pkgname}/-/${pkgname}-${pkgver}.tgz") -noextract=(${pkgname}-${pkgver}.tgz) +noextract=("${pkgname}-${pkgver}.tgz") sha256sums=('544070dbd2955a3613d7f0c5a05cc1088b144ddef2776a893244c3d194871c2b') package() { - npm install -g --user root --prefix "${pkgdir}/usr" "${srcdir}/${pkgname}-${pkgver}.tgz" + # We throw away output here to keep the build quieter; if issues are + # encountered, be sure to remove the output redirection in order to debug. + npm install \ + --global \ + --user root \ + --prefix "${pkgdir}/usr" \ + "${srcdir}/${pkgname}-${pkgver}.tgz" &> /dev/null # Non-deterministic race in npm gives 777 permissions to random directories. # See https://github.com/npm/npm/issues/9359 for details. find "${pkgdir}/usr" -type d -exec chmod 755 {} + - # npm gives ownership of ALL FILES to build user - # https://bugs.archlinux.org/task/63396 - chown -R root:root "${pkgdir}" + # Remove references to the package directory + find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d' + + # Remove references to the package directory from package.json + find "$pkgdir" \ + -type f \ + -name 'package.json' \ + -execdir sh -c "jq '. | delpaths([paths|select(.[0] | test(\"_.*\"))])' {} > {}.new" \; \ + -exec mv {}.new {} \; + + # sshpk contains build references in the `man` attribute... + find "${pkgdir}/usr/lib/node_modules/${pkgname}/node_modules/sshpk/package.json" \ + -execdir sh -c "jq '.man = [[\ + \"man/man1/sshpk-conv.1\", \ + \"man/man1/sshpk-sign.1\", \ + \"man/man1/sshpk-verify.1\" \ + ]]' {} > {}.new" \; \ + -exec mv {}.new {} \; - mkdir -p "${pkgdir}/usr/share/licenses/${pkgname}" - ln -s "/usr/lib/node_modules/${pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/" + # Install a symlink for the LICENSE file + install -d "${pkgdir}/usr/share/licenses/${pkgname}" + ln -s \ + "/usr/lib/node_modules/${pkgname}/LICENSE" \ + "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" } |