Deploy apps to FirefoxOS in NodeJS/CLI
This is part of node-fxos' project.
$ npm install fxos-deploy
# command line
$ npm install -g fxos-deploy
Usage: fxos-deploy [manifestURL] [options]
manifestURL App manifest.webapp to deploy
Options:
--zip Zip file containing the app
-p, --port Port of FirefoxOS
-f, --force Kill other simulators on this port
--verbose Set the output level to verbose
--bin Set external B2G bin
--profile Set external B2G profile
--release <release> Release of FirefoxOS to filter
--exit Exit after startup
--stdin <stdin filepath> The path where stdin of the simulator will be redirected to
--stdout <stdout filepath> The path where stdout of the simulator will be redirected to
--stderr <stderr filepath> The path where stderr of the simulator will be redirected to
--version Print version and exit
Start a FirefoxOS simulator and connect to it through firefox-client by returning client
.
// client from firefox-client or fxos-connect or fxos-start
var deploy = require('fxos-deploy');
/* ... */
deploy({
manifestURL: 'manifest.webapp',
zip:'nicola.zip',
client: client
}, function(err, appId){
console.log("deployed with ID:", appId);
})
/* ... */
deploy({
manifestURL: 'manifest.webapp',
zip:'nicola.zip',
client: sim.client
})
.then(function(appId) {})
.fail(function(err) {})
This handles connection and disconnection wrapping a callback in between
var deploy = require('fxos-deploy/command');
deploy({
port:8002,
zip: 'nicola.zip',
manifestURL: 'manifest.webapp'
}, function(err, result, next){
// result = {
// client: FirefoxClient,
// result: appId
// }
next(err);
})
var FirefoxClient = require("firefox-client");
var deploy = require('fxos-deploy');
var client = new FirefoxClient();
client.connect(1234, function(err) {
deploy({
zip: 'nicola.zip',
manifestURL: 'manifest.webapp',
client: client
}, function(err, appId){
console.log("deployed:", appId);
client.disconnect();
});
});
var start = require('fxos-start');
var deploy = require('fxos-deploy');
start(function(err, sim) {
deploy({
manifestURL: 'manifest.webapp',
zip:'nicola.zip',
client: sim.client
}, function(err, appId){
console.log("deployed with ID:", appId);
sim.client.disconnect();
})
})
var connect = require('fxos-connect');
var deploy = require('fxos-deploy');
connect().then(function(sim) {
return deploy({
manifestURL: 'manifest.webapp',
zip:'nicola.zip',
client: sim.client
}).then(sim.client.disconnect);
});