summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorlilac2018-09-20 02:28:13 +0800
committerlilac2018-09-20 02:28:13 +0800
commitf45c49c83724b2ef0c2371db10f4809809004f42 (patch)
tree195c2977569fd950bcc6e8fcd1381a0e9567c130
parentae489c9fa596440f213758376814d4cc295b8c63 (diff)
downloadaur-f45c49c83724b2ef0c2371db10f4809809004f42.tar.gz
update by lilac
-rw-r--r--.SRCINFO9
-rw-r--r--PKGBUILD39
-rw-r--r--exclude-scoped-modules.diff36
3 files changed, 74 insertions, 10 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 33c125ca71c0..d5cdbe94b28a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,17 +1,20 @@
pkgbase = nodejs-web-ext
pkgdesc = A command line tool to help build, run, and test web extensions
pkgver = 2.9.1
- pkgrel = 3
+ pkgrel = 5
url = https://developer.mozilla.org/en-US/Add-ons/WebExtensions
arch = any
license = MPL2
makedepends = yarn
makedepends = node-gyp
makedepends = python2
+ makedepends = git
depends = nodejs
options = !strip
- source = https://registry.npmjs.org/web-ext/-/web-ext-2.9.1.tgz
- sha256sums = c9a0502df328f40a26457c31b59c3986497bec18d5f99c4272f7e2d6aa100ba8
+ source = git+https://github.com/mozilla/web-ext.git#tag=2.9.1
+ source = exclude-scoped-modules.diff
+ sha256sums = SKIP
+ sha256sums = badc28aad41212d3b08255298b48e43022f918a73e030a7f0245047cb9e33228
pkgname = nodejs-web-ext
diff --git a/PKGBUILD b/PKGBUILD
index 4737ad6bf3b8..4f249e6d59c6 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,32 +3,57 @@
_npmname=web-ext
pkgname=nodejs-$_npmname
pkgver=2.9.1
-pkgrel=3
+pkgrel=5
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=('yarn' 'node-gyp' 'python2')
+makedepends=('yarn' 'node-gyp' 'python2' 'git')
# to speed up the build
options=('!strip')
-source=(https://registry.npmjs.org/$_npmname/-/$_npmname-$pkgver.tgz)
-sha256sums=('c9a0502df328f40a26457c31b59c3986497bec18d5f99c4272f7e2d6aa100ba8')
+# unit tests expect a git repo
+source=("git+https://github.com/mozilla/web-ext.git#tag=$pkgver"
+ exclude-scoped-modules.diff)
+sha256sums=('SKIP'
+ 'badc28aad41212d3b08255298b48e43022f918a73e030a7f0245047cb9e33228')
+
+prepare() {
+ cd "$srcdir/$_npmname"
+ patch -Np1 -i ../exclude-scoped-modules.diff
+
+ cd "$srcdir"
+ # -build for running webpack and tests, and the original for actual packaging
+ cp -r $_npmname{,-build}
+}
build() {
- cd package
+ cd "$srcdir/$_npmname-build"
+
+ PYTHON=python2 yarn install
+ NODE_ENV=production yarn run build
+ cp -r dist "$srcdir/$_npmname"
+ cd "$srcdir/$_npmname"
PYTHON=python2 yarn install --production
}
+check() {
+ cd "$srcdir/$_npmname-build"
+
+ yarn test
+}
+
package() {
local _npmdir="$pkgdir/usr/lib/node_modules/"
install -Ddm755 "$_npmdir"
- cp -r --no-preserve=ownership package "$_npmdir/$_npmname"
+ cp -r --no-preserve=ownership $_npmname "$_npmdir/$_npmname"
# remove references to $pkgdir
- rm -r "$pkgdir"/usr/lib/node_modules/web-ext/node_modules/dtrace-provider/build/
+ rm -r "$_npmdir"/web-ext/node_modules/dtrace-provider/build/
+
+ rm -r "$_npmdir"/web-ext/.git
install -Ddm755 "$pkgdir/usr/bin"
ln -s "/usr/lib/node_modules/$_npmname/bin/$_npmname" "$pkgdir/usr/bin/$_npmname"
diff --git a/exclude-scoped-modules.diff b/exclude-scoped-modules.diff
new file mode 100644
index 000000000000..372ceb26c0bd
--- /dev/null
+++ b/exclude-scoped-modules.diff
@@ -0,0 +1,36 @@
+diff --git a/webpack.config.js b/webpack.config.js
+index a03e8ed..7714f7a 100644
+--- a/webpack.config.js
++++ b/webpack.config.js
+@@ -8,13 +8,24 @@ var nodeModules = {};
+
+ // This is to filter out node_modules as we don't want them
+ // to be made part of any bundles.
+-fs.readdirSync('node_modules')
+- .filter(function(x) {
+- return ['.bin'].indexOf(x) === -1;
+- })
+- .forEach(function(mod) {
+- nodeModules[mod] = 'commonjs ' + mod;
+- });
++
++function addToNodeModulesMap(modName) {
++ if (modName.indexOf('bin') !== -1) {
++ return;
++ }
++ nodeModules[modName] = 'commonjs ' + modName;
++}
++
++for (const dirname of fs.readdirSync('node_modules')) {
++ if (dirname[0] === '@') {
++ const inner_dirs = fs.readdirSync(path.join('node_modules', dirname));
++ for (const inner_dirname of inner_dirs) {
++ addToNodeModulesMap(path.join(dirname, inner_dirname));
++ }
++ } else {
++ addToNodeModulesMap(dirname);
++ }
++}
+
+ var rules = [
+ {