Coder Social home page Coder Social logo

brittanydionigi / node-firefox-ports Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mozilla/node-firefox-find-ports

0.0 0.0 0.0 109 KB

Find out the ports where Firefox Desktop and Firefox OS remote debugging tools are listening

License: Other

JavaScript 100.00%

node-firefox-ports's Introduction

node-firefox-ports Build Status

Find ports where debuggable runtimes are listening.

This is part of the node-firefox project.

When runtimes have remote debugging enabled, they start a server that listens for incoming connections. This module can find those runtimes and in which port they are listening.

Current limitations

We can only detect Firefox Desktop and Firefox OS Simulators. Devices connected via USB are exposed via adb, which makes differentiation difficult with the method we are using to detect runtimes.

We also do not support Windows yet--we have no parser, tests or test data for Windows. But there are placeholders in the code marked with TODO: Windows that indicate where the Windows code would need to be added. If you want to contribute, those are the gaps that need to be filled in order for this to work on Windows.

NOTE

This is a work in progress. Things will probably be missing and broken while we move from fx-ports to firefox-ports. Please have a look at the existing issues, and/or file more if you find any! :-)

Installation

From git

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

If you want to update later on:

cd node-firefox-ports
git pull origin master
npm install

npm

This module is not on npm yet.

Usage

findPorts(options) // returns a Promise

where options is a plain Object with any of the following:

  • firefox: look for Firefox Desktop instances
  • firefoxOSSimulator: look for Firefox OS Simulators
  • detailed: query each found runtime for more information, such as the version, build time, processor, etc. The additional data will be added to the entry under a new device field.

If no options are provided, or if options is an empty Object ({}), then findPorts will look for any runtimes, of any type.

Finding ports

var findPorts = require('./node-firefox-ports');
// (or require('node-firefox-ports') when it's on npm)

// Return all listening runtimes
findPorts().then(results) {
  console.log(results);
});

// Returns only Firefox OS simulators, this time with error handling
findPorts({ firefoxOSSimulator: true }).then(function(results) {
  console.log(results);
}, function(err) {
  console.log(err);
});

// Returns only Firefox OS simulators, with extra detailed output
findPorts({ firefoxOSSimulator: true, detailed: true }).then(function(results) {
  console.log(results);
});

Running the tests

After installing, you can simply run the following from the module folder:

npm test

To add a new unit test file, create a new file in the tests/unit folder. Any file that matches test.*.js will be run as a test by the appropriate test runner, based on the folder location.

We use gulp behind the scenes to run the test; if you don't have it installed globally you can use npm gulp from inside the project's root folder to run gulp.

Code quality and style

Because we have multiple contributors working on our projects, we value consistent code styles. It makes it easier to read code written by many people! :-)

Our tests include unit tests as well as code quality ("linting") tests that make sure our test pass a style guide and JSHint. Instead of submitting code with the wrong indentation or a different style, run the tests and you will be told where your code quality/style differs from ours and instructions on how to fix it.

History

This is based on initial work on fx-ports by Nicola Greco.

The command line utility binary has been removed for this initial iteration, since pretty much all the existing applications using this module were just using the JS code directly, not the binary.

License

This program is free software; it is distributed under an Apache License.

Copyright

Copyright (c) 2014 Mozilla (Contributors).

node-firefox-ports's People

Contributors

sole avatar nicola avatar tofumatt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.