[arch-commits] Commit in npm/repos (2 files)

Felix Yan felixonmars at archlinux.org
Tue Feb 9 18:08:54 UTC 2021


    Date: Tuesday, February 9, 2021 @ 18:08:53
  Author: felixonmars
Revision: 851265

archrelease: copy trunk to community-testing-any

Added:
  npm/repos/community-testing-any/
  npm/repos/community-testing-any/PKGBUILD
    (from rev 851263, npm/trunk/PKGBUILD)

----------+
 PKGBUILD |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

Copied: npm/repos/community-testing-any/PKGBUILD (from rev 851263, npm/trunk/PKGBUILD)
===================================================================
--- community-testing-any/PKGBUILD	                        (rev 0)
+++ community-testing-any/PKGBUILD	2021-02-09 18:08:53 UTC (rev 851265)
@@ -0,0 +1,63 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+
+pkgname=npm
+pkgver=7.5.3
+pkgrel=1
+pkgdesc='A package manager for javascript'
+arch=('any')
+url='https://www.npmjs.com/'
+license=('custom:Artistic')
+depends=('nodejs' 'node-gyp' 'semver')
+# libgl: TODO
+# libvips: for sharp (doc build) (disabled as current version of gatsby imports a broken sharp)
+# libxi: for cwebp (doc build)
+makedepends=('libgl' 'libxi' 'marked' 'marked-man' 'procps-ng' 'python')
+options=('!emptydirs')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/npm/cli/archive/v$pkgver.tar.gz")
+sha512sums=('2fc9ad1873e0245d9ec6f9e8b613198946db2e25033e79631f8fe1ea90c78be869a71b570af6eb533bf3e570536b996eb4c3274fe1208f15a9f3419a44b448b1')
+
+prepare() {
+  cd cli-$pkgver
+  mkdir -p node_modules/.bin
+  ln -sf /usr/bin/marked{,-man} node_modules/.bin/
+
+  # Use local marked/marked-man
+  sed -i 's|node bin/npm-cli.js install marked|true |' Makefile
+
+  # Don't build twice
+  sed -i 's/install: all/install:/' Makefile
+
+  mkdir -p man/man1
+}
+
+build() {
+  cd cli-$pkgver
+  NODE_PATH=/usr/lib/node_modules make
+}
+
+package() {
+  cd cli-$pkgver
+  node bin/npm-cli.js install -g -f --prefix="$pkgdir/usr" $(node bin/npm-cli.js pack | tail -1)
+
+  # 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"
+
+  # Experimental dedup
+  _npmdir="$pkgdir"/usr/lib/node_modules/$pkgname
+  rm -r "$_npmdir"/node_modules/{,.bin/}semver
+  rm -r "$_npmdir"/node_modules/{,.bin/}node-gyp
+  sed -i 's|../../node_modules/node-gyp/bin/node-gyp.js|../../../node-gyp/bin/node-gyp.js|' \
+    "$_npmdir"/bin/node-gyp-bin/node-gyp
+
+  install -dm755 "$pkgdir"/usr/share/bash-completion/completions
+  node "$srcdir"/cli-$pkgver/bin/npm-cli.js completion > "$pkgdir"/usr/share/bash-completion/completions/npm
+
+  mv "$pkgdir"/usr/lib/node_modules/npm/man "$pkgdir"/usr/share/
+
+  install -Dm644 "$srcdir"/cli-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}



More information about the arch-commits mailing list