summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorAli Mousavi2019-03-21 03:11:38 +0330
committerAli Mousavi2019-03-21 03:11:38 +0330
commit477a0419009761e2a8c69ae304978a6de2c41ed0 (patch)
tree8e8de2858568e7563592dee75ab39b48c387210c /PKGBUILD
downloadaur-477a0419009761e2a8c69ae304978a6de2c41ed0.tar.gz
Version 2.4.16
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD30
1 files changed, 30 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..e5c44d38533c
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,30 @@
+# Maintainer: Ali Mousavi <ali.mousavi@gmail.com>
+_npmname=gatsby-cli
+pkgname=nodejs-$_npmname
+pkgver=2.4.16
+pkgrel=1
+pkgdesc="The Gatsby command line interface"
+arch=(any)
+url="https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-cli"
+license=('MIT')
+depends=('nodejs')
+makedepends=('npm' 'jq')
+source=("https://registry.npmjs.org/$_npmname/-/$_npmname-$pkgver.tgz")
+noextract=($_npmname-$pkgver.tgz)
+md5sums=('77158e4a330ca90627ae55daea76b6dc')
+
+package() {
+ npm install -g --cache $srcdir/npm-cache --user root --prefix $pkgdir/usr $srcdir/$_npmname-$pkgver.tgz
+ find "$pkgdir"/usr -type d -exec chmod 755 {} +
+
+ # Remove references to $pkgdir
+ find "$pkgdir" -type f -name package.json -print0 | xargs -0 sed -i "/_where/d"
+
+ # Remove references to $srcdir
+ local tmppackage="$(mktemp)"
+ local pkgjson="$pkgdir/usr/lib/node_modules/$_npmname/package.json"
+ jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" > "$tmppackage"
+ mv "$tmppackage" "$pkgjson"
+ chmod 644 "$pkgjson"
+}
+