All Projects → mozilla → Web Ext

mozilla / Web Ext

Licence: mpl-2.0
A command line tool to help build, run, and test web extensions

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Web Ext

quickjira
🚤 📂 Quickly access the JIRA of your choice by typing the ticket id
Stars: ✭ 65 (-96.48%)
Mutual labels:  webextension, webextensions, browser-extension
Extension Create
Create modern cross-browser extensions with no build configuration.
Stars: ✭ 167 (-90.95%)
Mutual labels:  browser-extension, webextension, webextensions
Read Aloud
An awesome browser extension that reads aloud webpage content with one click
Stars: ✭ 444 (-75.95%)
Mutual labels:  browser-extension, webextension, webextensions
awesome-extension-apis
Awesome cross-extension APIs that enable browser extensions to integrate with each other.
Stars: ✭ 17 (-99.08%)
Mutual labels:  webextension, webextensions, browser-extension
News Feed Eradicator
A browser extension that deletes your news feed and replaces it with a nice quote
Stars: ✭ 690 (-62.62%)
Mutual labels:  browser-extension, webextensions
Downthemall
The DownThemAll! WebExtension
Stars: ✭ 512 (-72.26%)
Mutual labels:  webextension, webextensions
Save As Ebook
Save a web page/selection as an eBook (.epub format) - a Chrome/Firefox/Opera Web Extension
Stars: ✭ 959 (-48.05%)
Mutual labels:  webextension, webextensions
Nxenhanced
Adds "quality-of-life" features to NextDNS website for a more practical usability
Stars: ✭ 58 (-96.86%)
Mutual labels:  browser-extension, webextension
Useragent Switcher
A User-Agent spoofer browser extension that is highly configurable
Stars: ✭ 261 (-85.86%)
Mutual labels:  browser-extension, webextension
Checkmyhttps
We propose a user-friendly add-on that allows you to check if your encrypted web traffic (SSL/TLS) towards secured Internet servers (HTTPS) is not intercepted (being listened to).
Stars: ✭ 35 (-98.1%)
Mutual labels:  browser-extension, webextension
Turnoff Namuwiki
조별과제 때마다 "나무위키 꺼라."라고 말하시는게 피곤하신 여러분을 위해 만들어진 Browser Extension, 나무위키를 꺼 드립니다.
Stars: ✭ 59 (-96.8%)
Mutual labels:  browser-extension, webextension
Github Dashboard
[Web extension] Filter events on github.com activity dashboard.
Stars: ✭ 509 (-72.43%)
Mutual labels:  browser-extension, webextension
Trace.moe Webextension
WebExtension for the Anime Reverse Search Engine to search by image
Stars: ✭ 89 (-95.18%)
Mutual labels:  webextension, webextensions
Tabliss
An extensible New Tab web extension written in TypeScript, React and Redux.
Stars: ✭ 798 (-56.77%)
Mutual labels:  browser-extension, webextension
Jjb
一个帮助你自动申请京东价格保护的chrome拓展
Stars: ✭ 3,083 (+67.01%)
Mutual labels:  browser-extension, webextension
Tabs Aside
A session/tab manager web extension for Firefox based on the Microsoft Edge feature.
Stars: ✭ 58 (-96.86%)
Mutual labels:  browser-extension, webextensions
Dfpm
DFPM is a browser extension for detecting browser fingerprinting.
Stars: ✭ 81 (-95.61%)
Mutual labels:  browser-extension, webextension
Retrotxt
RetroTxt is the WebExtension that turns ANSI, ASCII, NFO text into in-browser HTML
Stars: ✭ 93 (-94.96%)
Mutual labels:  webextension, webextensions
Ankitab
Browser extension that replaces the new tab page with Anki flashcards
Stars: ✭ 121 (-93.45%)
Mutual labels:  browser-extension, webextension
AntiRickRoll
Chrome extension that blocks Rickrolls!
Stars: ✭ 22 (-98.81%)
Mutual labels:  webextension, browser-extension

Web-ext

This is a command line tool to help build, run, and test WebExtensions.

CircleCI codecov Dependency Status devDependency Status npm version

Ultimately, it aims to support browser extensions in a standard, portable, cross-platform way. Initially, it will provide a streamlined experience for developing Firefox Extensions.

Documentation

Here are the commands you can run. Click on each one for detailed documentation or use --help on the command line, such as web-ext build --help.

  • run
    • Run the extension
  • lint
    • Validate the extension source
  • sign
    • Sign the extension so it can be installed in Firefox
  • build
    • Create an extension package from source
  • docs
    • Open the web-ext documentation in a browser

Installation from npm

First, make sure you are running the current LTS (long term support) version of NodeJS.

Global command

You can install this command onto your machine globally with:

npm install --global web-ext

For your project

Alternatively, you can install this command as one of the devDependencies of your project. This method can help you control the version of web-ext as used by your team.

npm install --save-dev web-ext

Next you can use the web-ext command in your project as an npm script. Here is an example where the --source-dir argument specifies where to find the source code for your extension.

package.json

"scripts": {
  "start:firefox": "web-ext run --source-dir ./extension-dist/",
}

You can always pass in additional commands to your npm scripts using the -- suffix. For example, the previous script could specify the Firefox version on the command line with this:

npm run start:firefox -- --firefox=nightly

Installation from source

You'll need:

  • Node.js, 12.0.0 or higher
  • npm, 6.9.0 or higher is recommended

Optionally, you may like:

  • nvm, which helps manage node versions

If you had already installed web-ext from npm, you may need to uninstall it first:

npm uninstall --global web-ext

Change into the source and install all dependencies:

git clone https://github.com/mozilla/web-ext.git
cd web-ext
npm install

Build the command:

npm run build

Link it to your node installation:

npm link

You can now run it from any directory:

web-ext --help

To get updates, just pull changes and rebuild the executable. You don't need to relink it.

cd /path/to/web-ext
git pull
npm run build

Using web-ext in NodeJS code

Aside from using web-ext on the command line, you may wish to execute web-ext in NodeJS code. There is limited support for this. Here are some examples.

You are able to execute command functions without any argument validation. If you want to execute web-ext run you would do so like this:

// const webExt = require('web-ext');
// or...
import webExt from 'web-ext';

webExt.cmd.run({
  // These are command options derived from their CLI conterpart.
  // In this example, --source-dir is specified as sourceDir.
  firefox: '/path/to/Firefox-executable',
  sourceDir: '/path/to/your/extension/source/',
}, {
  // These are non CLI related options for each function.
  // You need to specify this one so that your NodeJS application
  // can continue running after web-ext is finished.
  shouldExitProgram: false,
})
  .then((extensionRunner) => {
    // The command has finished. Each command resolves its
    // promise with a different value.
    console.log(extensionRunner);
    // You can do a few things like:
    // extensionRunner.reloadAllExtensions();
    // extensionRunner.exit();
  });

If you would like to run an extension on Firefox for Android:

// Path to adb binary (optional parameter, auto-detected if missing)
const adbBin = "/path/to/adb";
// Get an array of device ids (Array<string>)
const deviceIds = await webExt.util.adb.listADBDevices(adbBin);
const adbDevice = ...
// Get an array of Firefox APKs (Array<string>)
const firefoxAPKs = await webExt.util.adb.listADBFirefoxAPKs(
  deviceId, adbBin
);
const firefoxApk = ...

webExt.cmd.run({
  target: 'firefox-android',
  firefoxApk,
  adbDevice,
  sourceDir: ...
}).then((extensionRunner) => {...});

If you would like to control logging, you can access the logger object. Here is an example of turning on verbose logging:

webExt.util.logger.consoleStream.makeVerbose();
webExt.cmd.run({sourceDir: './src'}, {shouldExitProgram: false});

You can also disable the use of standard input:

webExt.cmd.run({noInput: true}, {shouldExitProgram: false});

web-ext is designed for WebExtensions but you can try disabling manifest validation to work with legacy extensions. This is not officially supported.

webExt.cmd.run(
  {sourceDir: './src'},
  {
    getValidatedManifest: () => ({
      name: 'some-fake-name',
      version: '1.0.0',
    }),
    shouldExitProgram: false,
  },
);

Should I Use It?

Yes! The web-ext tool enables you to build and ship extensions for Firefox. This platform stabilized in Firefox 48 which was released in April of 2016.

Get Involved

Hi! This tool is under active development. To get involved you can watch the repo, file issues, create pull requests, or ask a question on dev-addons. Read the contributing section for how to develop new features.

Some Questions and Answers

Why do we need a command line tool?

This is a great question and one that we will ask ourselves for each new web-ext feature. Most WebExtension functionality is baked into the browsers themselves but a complimentary command line tool will still be helpful. Here is a partial list of examples:

  • File watching.
    • When you edit a file, you may need to trigger certain commands (tests, installation, etc).
  • Integrating with services.
    • Mozilla offers some useful services such as linting and signing extensions.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].