web-ext
Develop, test, and package web extensions
TLDR
Run the web extension in the current directory in Firefox
Run a web extension from a specific directory in Firefox
Display verbose execution output
Run a web extension in Firefox Android
Lint the manifest and source files for errors
Build and package the extension
Display verbose build output
Sign a package for self-hosting
SYNOPSIS
web-ext command [options]
PARAMETERS
run
Run the WebExtension in a temporary Firefox profile for testing.
build
Build a packaged WebExtension from source files.
lint
Check the WebExtension source files for errors and potential problems.
sign
Sign the WebExtension for distribution on the Mozilla Add-ons website.
convert
Convert a legacy extension format into a WebExtension.
validate
Validate that the extension's manifest.json file is formatted correctly.
--source-dir
Specify the directory containing the WebExtension source code (defaults to the current directory).
--firefox
Specify the path to the Firefox executable.
--target
Specify the browser to target during run and build (e.g., firefox-desktop, chromium).
--artifacts-dir
Specify a target location for web-ext to create all of the artifact files it uses.
--config
Specify a target location for web-ext to read configuration information from instead of package.json and .web-ext-config.js
--verbose
Enable verbose output.
--help
Display the help message
--version
Display the version of web-ext.
DESCRIPTION
web-ext is a command-line tool from Mozilla for developing, testing, and publishing WebExtensions for Firefox, Chrome, and other Chromium-based browsers. It simplifies the workflow by providing commands for building, running, and signing WebExtensions. You can use it to automatically reload your extension during development, package your extension for distribution, and submit it to the Mozilla Add-ons website.
Key features include automatic extension reloading during development, cross-browser testing capabilities, and simplified packaging and distribution processes. It allows developers to focus on the code and the browser compatibility with a unified command set. The tool interacts with the browser API so you can use browser commands to test browser actions without using the UI.
CAVEATS
web-ext depends on Node.js and npm (Node Package Manager). Ensure these are installed on your system before using web-ext. Some commands, like `sign`, require an account and API key from the Mozilla Add-ons website.
CONFIGURATION
web-ext can be configured using a `package.json` file, or a `.web-ext-config.js` file in the project directory. It is typical to include build commands in `package.json` which will allow you to run commands like `npm run build`.
PERMISSIONS
WebExtensions require specific permissions to access browser features and data. Carefully review and declare only the necessary permissions in your `manifest.json` file.
HISTORY
web-ext was created by Mozilla to streamline WebExtension development. It emerged as a necessity to simplify the cross-browser compatibility challenges that web extension developers were facing. It provides a single toolchain to build, test and package web extensions for multiple browsers. It's usage has increased with the rise of web extensions as a popular way to customize and extend browser functionality. The `run` feature provides an easy method to use and test commands like browserActions, without actually clicking on browser buttons.