[arch-commits] Commit in (4 files)
Chih-Hsuan Yen
yan12125 at archlinux.org
Sat Dec 19 14:39:57 UTC 2020
Date: Saturday, December 19, 2020 @ 14:39:57
Author: yan12125
Revision: 779976
web-ext: moved from AUR with 12 votes
The AUR package was maintained by myself and was called web-ext. Using the name to conform to the new Node.js packaging guidelines [1].
Also restoring Chromium tests - seems the issue has been fixed since version 4.0 [2].
[1] https://wiki.archlinux.org/index.php?title=Node.js_package_guidelines&type=revision&diff=599637&oldid=582142
[2] https://github.com/mozilla/web-ext/issues/1779
Added:
web-ext/
web-ext/trunk/
web-ext/trunk/PKGBUILD
web-ext/trunk/skip-if-non-git-repo.diff
---------------------------+
PKGBUILD | 63 ++++++++++++++++++++++++++++++++++++++++++++
skip-if-non-git-repo.diff | 21 ++++++++++++++
2 files changed, 84 insertions(+)
Added: web-ext/trunk/PKGBUILD
===================================================================
--- web-ext/trunk/PKGBUILD (rev 0)
+++ web-ext/trunk/PKGBUILD 2020-12-19 14:39:57 UTC (rev 779976)
@@ -0,0 +1,63 @@
+# Maintainer: Chih-Hsuan Yen <yan12125 at gmail.com>
+
+pkgname=web-ext
+pkgver=5.4.1
+pkgrel=1
+pkgdesc='A command line tool to help build, run, and test web extensions'
+arch=(any)
+url='https://developer.mozilla.org/en-US/Add-ons/WebExtensions'
+license=('MPL2')
+depends=('nodejs')
+makedepends=('npm' 'node-gyp')
+replaces=('nodejs-web-ext')
+provides=('nodejs-web-ext')
+conflicts=('nodejs-web-ext')
+# to speed up the build
+options=('!strip')
+# tarball on npmjs lacks scripts for building from sources
+source=("https://github.com/mozilla/web-ext/archive/$pkgver/web-ext-$pkgver.tar.gz"
+ "skip-if-non-git-repo.diff")
+sha256sums=('c2591f601c1b385d1360d9d3867fbe45a0db12973b4019b066b0fa13e3207687'
+ 'f485e30d304023a8a503095b6d0ba1f0f9f70d476e2ce58c5a7713caaa78ab49')
+
+prepare() {
+ cd "$srcdir"
+
+ pushd $pkgname-$pkgver
+ patch -Np1 -i ../skip-if-non-git-repo.diff
+ popd
+
+ # -build for running webpack and tests, and the original for actual packaging
+ cp -r $pkgname-$pkgver{,-build}
+}
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver-build"
+
+ npm install
+ NODE_ENV=production npm run build
+ cp -r dist "$srcdir/$pkgname-$pkgver"
+
+ cd "$srcdir/$pkgname-$pkgver"
+ npm install --production
+}
+
+check() {
+ cd "$srcdir/$pkgname-$pkgver-build"
+
+ npm test
+}
+
+package() {
+ local _npmdir="$pkgdir/usr/lib/node_modules/"
+
+ install -Ddm755 "$_npmdir"
+ cp -r --no-preserve=ownership $pkgname-$pkgver "$_npmdir/$pkgname"
+
+ # Non-deterministic race in npm gives 777 permissions to random directories.
+ # See https://github.com/npm/cli/issues/1103 for details.
+ find "${pkgdir}/usr" -type d -exec chmod 755 {} +
+
+ install -Ddm755 "$pkgdir/usr/bin"
+ ln -s "/usr/lib/node_modules/$pkgname/bin/$pkgname" "$pkgdir/usr/bin/$pkgname"
+}
Added: web-ext/trunk/skip-if-non-git-repo.diff
===================================================================
--- web-ext/trunk/skip-if-non-git-repo.diff (rev 0)
+++ web-ext/trunk/skip-if-non-git-repo.diff 2020-12-19 14:39:57 UTC (rev 779976)
@@ -0,0 +1,21 @@
+diff --git a/tests/unit/test.program.js b/tests/unit/test.program.js
+index d18beff..cea3d4d 100644
+--- a/tests/unit/test.program.js
++++ b/tests/unit/test.program.js
+@@ -885,7 +885,15 @@ describe('program.defaultVersionGetter', () => {
+ });
+
+ it('returns git commit information in development', function() {
+- const commit = `${git.branch()}-${git.long()}`;
++ var commit;
++ try {
++ commit = `${git.branch()}-${git.long()}`;
++ } catch (error) {
++ if (error.message.includes('no git repository found')) {
++ this.skip();
++ }
++ throw error;
++ }
+ const testBuildEnv = {globalEnv: 'development'};
+ assert.equal(defaultVersionGetter(projectRoot, testBuildEnv),
+ commit);
More information about the arch-commits
mailing list