node-firefox

Interact with Firefox via the DevTools remote protocol

Usage no npm install needed!

<script type="module">
  import nodeFirefox from 'https://cdn.skypack.dev/node-firefox';
</script>

README

node-firefox

As an overall project, node-firefox is a family of modules made for interacting with Firefox via the DevTools Remote Protocol.

As a module, node-firefox serves as a table of contents for the rest of the modules in the node-firefox family.

Installation

npm

npm install node-firefox

From git

git clone https://github.com/mozilla/node-firefox.git
cd node-firefox
npm install

If you want to update later on:

cd node-firefox
git pull origin master
npm install

Usage

Using require('node-firefox') yields an object with properties that contain instances of all the other modules in the node-firefox family installed as dependencies.

For example:

> var firefox = require('node-firefox');
> Object.keys(firefox)
[ 'findPorts',
  'findDevices',
  'forwardPorts',
  'findSimulators',
  'startSimulator',
  'connect',
  'findApp',
  'installApp',
  'uninstallApp',
  'launchApp',
  'reloadCss' ]

Some of our grand goals

  • Simplify app development for Firefox OS--make it look more like "normal" app development by enabling developers to use tools like Gulp to do things such as deploying to the device.
  • "Close the circle" with Cordova + Firefox OS and make it possible to run cordova emulate or cordova deploy. (In progress here.)
  • Provide a command line tool which supports features of the WebIDE, for people who like typing more than clicking.
  • Mega grand goal: control/debug any browser on the command line via DevTools via Valence.

Current status

We're code reviewing and auditing the existing modules, and figuring out how to have them testable against a number of platforms (this includes both simulators and real, physical devices). We're using the node-firefox-ports module as the base to help us devise a framework that works well. For more details, you can ask sole or tofumatt in irc.mozilla.org #apps.

Supported platforms

Here's a very early stages support matrix. Bear with us as we make more progress ;)

Module / Platforms Linux Mac OS Windows
node-firefox-find-ports
  • simulator: x
  • browser: x
  • simulator: x
  • browser: x
  • simulator: x
  • browser: x
node-firefox-find-devices
  • device: x
node-firefox-forward-ports
  • device: x
node-firefox-find-simulators
  • simulator: x
  • simulator: x
  • simulator: x
node-firefox-start-simulator
  • simulator: x
  • simulator: x
  • simulator: x
node-firefox-connect
  • simulator: x
  • simulator: x
  • simulator: x
node-firefox-find-app
  • simulator: x
  • simulator: x
  • simulator: x
node-firefox-install-app
  • simulator: x
  • simulator: x
  • simulator: x
node-firefox-uninstall-app
  • simulator: x
  • simulator: x
  • simulator: x
node-firefox-launch-app
  • simulator: x
  • simulator: x
  • simulator: x
node-firefox-reload-css
  • simulator: x
  • simulator: x
  • simulator: x

Note: Linux testing used Ubuntu 14.

Examples

Installing a packaged app

node-firefox-examples-install-packaged is a full project that shows how to install a packaged app using node-firefox.

Building with gulp + browserify

node-firefox-examples-gulp shows how to build, push and watch a packaged app using node-firefox with gulp and browserify.

Dependencies

These are the dependencies between modules in the project (or closely related, like firefox-client).

We're only representing required dependencies to run a given module, not dependencies required for running the examples. Those are in the devDependencies section each module's package.json.

node-firefox-find-ports      +--> firefox-client


node-firefox-find-simulators +--> (no dependencies)


node-firefox-start-simulator +--> firefox-client
                             |
                             +--> node-firefox-find-simulators


node-firefox-connect         +--> firefox-client


node-firefox-find-app        +--> (no dependencies)


node-firefox-install-app     +--> (no dependencies)


node-firefox-launch-app      +--> (no dependencies)


node-firefox-reload-css      +--> (no dependencies)

Contributing

It's still early stages, but we'd love to get you onboard, so we wrote some guidelines for contributing.

History

Based on early work on node-fxos by Nicola Greco.