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

Felix Yan felixonmars at archlinux.org
Tue Oct 27 14:05:53 UTC 2020


    Date: Tuesday, October 27, 2020 @ 14:05:52
  Author: felixonmars
Revision: 734421

archrelease: copy trunk to community-testing-any

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

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

Copied: npm/repos/community-testing-any/PKGBUILD (from rev 734420, npm/trunk/PKGBUILD)
===================================================================
--- community-testing-any/PKGBUILD	                        (rev 0)
+++ community-testing-any/PKGBUILD	2020-10-27 14:05:52 UTC (rev 734421)
@@ -0,0 +1,66 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+
+pkgname=npm
+pkgver=7.0.5
+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' 'nodejs-yaml' 'procps-ng' 'python')
+options=('!emptydirs')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/npm/cli/archive/v$pkgver.tar.gz")
+sha512sums=('1f7a89196d19311546709ec19da74062b9ee5171be93daa9951159d354ec978d0b9b860b222487af7883caa1073c8359f61173a34db2cde98efb15b9877ce98f')
+
+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's cmark-gfm vendors cmark-gfm. Hard to fix.
+  node bin/npm-cli.js install cmark-gfm --no-global --no-timing --no-save
+
+  NODE_PATH=/usr/lib/node_modules make
+}
+
+package() {
+  cd cli-$pkgver
+  # More broken in 7.x
+  mkdir -p "$pkgdir"/usr/lib
+  make NPMOPTS="--prefix=\"$pkgdir/usr\"" install
+
+  # 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
+
+  install -dm755 "$pkgdir"/usr/share/bash-completion/completions
+  node "$srcdir"/cli-$pkgver/bin/npm-cli.js completion > "$pkgdir"/usr/share/bash-completion/completions/npm
+
+  install -Dm644 "$srcdir"/cli-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+
+  mv "$pkgdir"/usr/lib/node_modules/npm/man "$pkgdir"/usr/share/
+}



More information about the arch-commits mailing list