Tools for building .xpi files

I’m returning to extension development after several years. I have an existing add-on to update. I’m trying to sort out the current documentation from the obsolete documentation. I started with

That told me to install web-ext with

npm install --global web-ext

I had to install “npm” first. I’m on Ubuntu 18.04 LTS. Large numbers of error messages came out about obsolete versions. (“Jetpack is no longer supported, etc.”) The debug log for the install has over 26,000 lines. The actual errors were

28897 warn optional Skipping failed optional dependency /web-ext/addons-linter/fsevents:
28898 warn notsup Not compatible with your operating system or architecture: fsevents@2.1.3
28899 warn optional Skipping failed optional dependency /web-ext/chokidar/fsevents:
28900 warn notsup Not compatible with your operating system or architecture: fsevents@2.1.3
28901 warn optional Skipping failed optional dependency /web-ext/watchpack-chokidar2/chokidar/fsevents:
28902 warn notsup Not compatible with your operating system or architecture: fsevents@1.2.13
28903 warn ws@7.3.1 requires a peer of bufferutil@^4.0.1 but none was installed.
28904 warn ws@7.3.1 requires a peer of utf-8-validate@^5.0.2 but none was installed.
28905 verbose stack Error: EACCES: permission denied, access '/usr/local/lib'

In the end, it failed because that script wants to be run as root. Allowing that mess to modify system files seems a bad idea.

Does the Mozilla Foundation guarantee that this tool can be trusted to run as root? How do I know there isn’t a backdoor in that mess?

Tried installing it without --global. Installation ran OK.
Attempted to run web-ext. Got

~/node_modules/web-ext/bin$ ./web-ext

/home/john/node_modules/camelcase/index.js:69
		.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toLocaleUpperCase())
  ^
SyntaxError: Invalid regular expression: /[_.\- ]+([\p{Alpha}\p{N}_]|$)/: Invalid escape
    at camelCase (/home/john/node_modules/camelcase/index.js:69:3)
    at A.command (/home/john/node_modules/web-ext/dist/web-ext.js:1:31702)
    at Object.F [as main] (/home/john/node_modules/web-ext/dist/web-ext.js:1:36712)
    at Object.<anonymous> (/home/john/node_modules/web-ext/bin/web-ext:7:8)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)

The Foundation is not really involved with this. It is also a quirk of Ubuntu’s way of offering NPM that global installations require root.

Based on the error you posted I’m wondering if the node delivered by default with Ubuntu 18.04 LTS is even new enough to handle web-ext.

I personally usually use https://github.com/nvm-sh/nvm to install node on my linux machines, though the official download for the latest versions would be at https://nodejs.org/en/.

In any case, you can always just zip your files and submit that to AMO these days. See also https://extensionworkshop.com/documentation/publish/package-your-extension/

In general, everything on extensionworkshop.com is pretty new and should be (mostly) up to date. Same goes for https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions which is more of a reference documentation/the not Firefox specific stuff.

That’s helpful. I can run the extension just fine in Firefox as a temporary extension for test purposes, so I don’t need any of the “run” tools of web-ext.
So, this does the job:

zip -r -FS adlimiter.zip *.js *.html *.md *.json images contentscript 
mv adlimiter.zip adlimiter.xpi

“web-ext” seems to be more of a problem than a solution, since Firefox itself has decent facilities for testing add-ons in the release version, and even more in the developer version.

Off to AMO. It’s a minor update to an old add-on.

What I tried to point out and I guess didn’t make quite clear enough is that you don’t even need to rename your files to .xpi for either temp installs in Firefox nor uploading to AMO. That way you can separate signed and unsigned packages you have locally by the file ending.