mozilla / node-firefox

node.js modules for interacting with Firefox via the DevTools remote protocol
https://www.npmjs.org/package/firefox
Mozilla Public License 2.0
301 stars 18 forks source link

Use node-firefox as a distribution module? #36

Closed lmorchard closed 9 years ago

lmorchard commented 9 years ago

What if node-firefox had an index.js like this?

// node-firefox/index.js
module.exports = {
  findPorts: require('node-firefox-find-ports'),
  findDevices: require('node-firefox-find-devices'),
  forwardPorts: require('node-firefox-forward-ports'),
  findSimulators: require('node-firefox-find-simulators'),
  startSimulator: require('node-firefox-start-simulator'),
  connect: require('node-firefox-connect'),
  findApp: require('node-firefox-find-app'),
  installApp: require('node-firefox-install-app'),
  uninstallApp: require('node-firefox-uninstall-app'),
  launchApp: require('node-firefox-launch-app'),
  reloadCss: require('node-firefox-reload-css')
};

Then, a developer could just include node-firefox in dependencies and use var firefox = require('node-firefox'); to make calls like firefox.findPorts(). Or, even make shorter aliases like var findPorts = firefox.findPorts to cut down on redundant firefoxes everywhere.

tofumatt commented 9 years ago

Yeah, I was actually looking at this sad, empty module earlier and thinking this would make sense.

I’m all for it and could do the grunt work later tonight :)

sole commented 9 years ago

There's that option, or the option of having this module be a command line thing.

Or maybe that thing should be node-firefox-cli? o_O

tofumatt commented 9 years ago

This one could certainly ship with a CLI as well? Like, npm install -g firefox. node-firefox-cli would be a weird CLI script to have to type all the time.

-tofumatt

On 26 March 2015 at 18:52:13, sole (notifications@github.com) wrote:

There's that option, or the option of having this module be a command line thing.

Or maybe that thing should be node-firefox-cli? o_O

— Reply to this email directly or view it on GitHub.

sole commented 9 years ago

I believe when you install grunt-cli you don't type grunt-cli but grunt ;)

tofumatt commented 9 years ago

Yeah, but I loathe that. It’s like brew install mercurial and you get the binary hg. It’s super unexpected. :-(

sole commented 9 years ago

you're actually right! and it's a thing that totally confused me with grunt. So let's not do this.

What about this - having this module do a module.exports but also importing and running the cli/binary if installed globally

tofumatt commented 9 years ago

That plan sounds perfect to me!

lmorchard commented 9 years ago

Going to call this done for now: https://github.com/mozilla/node-firefox/commit/4705b0daa3e315a4e398b6508c8b8480141cf898

But, I've also started working on a CLI tool: https://github.com/lmorchard/node-firefox-cli/tree/initial-implementation