diff options
author | Nick Boughton | 2020-06-12 14:05:29 +0100 |
---|---|---|
committer | Nick Boughton | 2020-06-12 14:05:29 +0100 |
commit | 39af479049c8a5fa3b838dc74a09029e021a40ff (patch) | |
tree | 5ebd0e5880334dcbe7dcb8d8b3b4b4e5db979643 | |
parent | f7c03b3ccb454a5721dd9721c273bf12bb89c9f3 (diff) | |
download | aur-39af479049c8a5fa3b838dc74a09029e021a40ff.tar.gz |
implemented node packaging guidelines
-rw-r--r-- | .SRCINFO | 9 | ||||
-rw-r--r-- | PKGBUILD | 42 |
2 files changed, 40 insertions, 11 deletions
@@ -1,15 +1,16 @@ pkgbase = quasar-cli pkgdesc = CLI management tool for development with the Quasar framework pkgver = 1.0.7 - pkgrel = 2 + pkgrel = 3 url = https://quasar.dev - arch = i686 - arch = x86_64 + arch = any license = MIT makedepends = npm>=5.0.0 depends = nodejs>=10.0.0 optdepends = npm: JS package management support - options = !strip + noextract = quasar-cli-1.0.7.tar.gz + source = quasar-cli-1.0.7.tar.gz::https://registry.npmjs.org/@quasar/cli/-/cli-1.0.7.tgz + sha1sums = 0bb8de2f74d822c9e1ee237ae4036efed559c67d pkgname = quasar-cli @@ -1,19 +1,47 @@ # Maintainer: Nick Boughton (nicholasboughton@gmail.com) +# Contributor: GFdevelop -pkgname=quasar-cli +_npmscope=quasar +_npmname=cli +_npmid="@$_npmscope/$_npmname" + +pkgname="${_npmscope}-${_npmname}" pkgver=1.0.7 -pkgrel=2 +pkgrel=3 pkgdesc='CLI management tool for development with the Quasar framework' -arch=(i686 x86_64) +arch=('any') url=https://quasar.dev -license=(MIT) +license=('MIT') depends=('nodejs>=10.0.0') makedepends=('npm>=5.0.0') optdepends=('npm: JS package management support') conflicts=() -options=(!strip) +source=("$pkgname-$pkgver.tar.gz::https://registry.npmjs.org/$_npmid/-/$_npmname-$pkgver.tgz") +noextract=("${source[@]%%::*}") +# Get SHASUM: curl -s "https://registry.npmjs.org/@quasar/cli" | jq '.versions."1.0.7".dist.shasum' +sha1sums=('0bb8de2f74d822c9e1ee237ae4036efed559c67d') package() { - npm install -g --prefix="$pkgdir"/usr @quasar/cli@$pkgver - find "$pkgdir"/usr -type d -exec chmod 755 {} + + # Setting temporary cache + npm install -g --user root --cache "$srcdir/npm-cache" --prefix "$pkgdir/usr" "${source[@]%%::*}" + + # 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 -execdir chmod 755 {} \+ + + # npm gives ownership of ALL FILES to build user + # https://bugs.archlinux.org/task/63396 + chown -R root:root $pkgdir + + # Package contains reference to $srcdir/$pkgdir + find "${pkgdir}" -type f -name package.json -execdir sed -i '/_where/d' {} \+ + + # print first line (the '{' symbol) and lines from the first non-underscored key to the end + # (npm internal keys are underscored but we don't need these keys) + sed -i -n '1p;/ "[^_].*": {$/,$p' "$pkgdir"/usr/lib/node_modules/"$_npmid"/package.json +# sed -i "s|$pkgdir||" "$pkgdir"/usr/lib/node_modules/"$_npmid"/node_modules/sshpk/package.json +# sed -i "s|$pkgdir||" "$pkgdir"/usr/lib/node_modules/"$_npmid"/node_modules/he/package.json + + # Add license + install -Dm644 "$pkgdir/usr/lib/node_modules/$_npmid/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } |