openfin-cli
Advanced tools
Comparing version 1.1.6 to 2.0.2
75
index.js
'use strict'; | ||
var configBuilder = require('openfin-config-builder'), | ||
openfinLauncher = require('openfin-launcher'), | ||
{ connect } = require('hadouken-js-adapter'), | ||
path = require('path'), | ||
@@ -28,10 +28,4 @@ fs = require('fs'), | ||
try { | ||
writeToConfig(name, parsedUrl, config, devtools_port, runtime_version, function(configObj) { | ||
if (launch) { | ||
launchOpenfin(config); | ||
} | ||
if (configObj) { | ||
fetchInstaller(flags, configObj); | ||
} | ||
writeToConfig(name, parsedUrl, config, devtools_port, runtime_version, function (configObj) { | ||
if (launch) launchOpenfin(config); | ||
}); | ||
@@ -43,37 +37,2 @@ } catch (err) { | ||
function fetchInstaller(flags, configObj) { | ||
var hyperlink = flags.h || flags.hyperlink, | ||
destination = flags.d || flags.destination, | ||
appName = configObj.startup_app ? configObj.startup_app.name : null, | ||
name = flags.n || flags.name || appName || 'openfin', | ||
openfinInstaller = require('openfin-installer')(configObj), | ||
fetchOptions = { | ||
noExt: flags.noExt || null, | ||
rvmConfig: flags.rvmConfig || null, | ||
supportEmail: flags.supportEmail || null, | ||
dnl: flags.dnl || null, | ||
destination: flags.d || flags.destination, | ||
config: flags.c || null, | ||
name: name | ||
}; | ||
if (destination) { | ||
openfinInstaller | ||
.fetchInstaller(fetchOptions) | ||
.then(function() { | ||
console.log('Installer zip written to', destination); | ||
}, | ||
function(reason) { | ||
console.log(reason); | ||
}); | ||
} | ||
if (hyperlink) { | ||
console.log('\n', openfinInstaller.generateInstallUrl(encodeURIComponent(name), fetchOptions.config, | ||
fetchOptions.noExt, fetchOptions.rvmConfig, fetchOptions.supportEmail, fetchOptions.dnl), '\n'); | ||
} | ||
} | ||
function isURL(str) { | ||
@@ -99,8 +58,14 @@ return (typeof str === 'string') && str.lastIndexOf('http') >= 0; | ||
//will launch download the rvm and launch openfin | ||
function launchOpenfin(config) { | ||
openfinLauncher.launchOpenFin({ | ||
configPath: isURL(config) ? config : path.resolve(config) | ||
}).fail(function(err) { | ||
onError('launch failed', err); | ||
}); | ||
async function launchOpenfin(config) { | ||
try { | ||
const manifestUrl = isURL(config) ? config : path.resolve(config); | ||
const fin = await connect({ | ||
uuid: 'openfin-cli-server-connection', | ||
manifestUrl, | ||
nonPersistent: true | ||
}); | ||
fin.once('disconnected', process.exit); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
@@ -111,3 +76,3 @@ | ||
if (isURL(config)) { | ||
request(config, function(err, response, body) { | ||
request(config, function (err, response, body) { | ||
if (!err && response.statusCode === 200) { | ||
@@ -126,3 +91,3 @@ callback(JSON.parse(body)); | ||
fs.exists(config, function(exists) { | ||
fs.exists(config, function (exists) { | ||
if (exists) { | ||
@@ -154,3 +119,3 @@ configAction = configBuilder.update; | ||
shortcut: shortcut | ||
} | ||
}; | ||
@@ -166,5 +131,5 @@ if (devtools_port) { | ||
//create or update the config | ||
configAction(appConfigObj, config).fail(function(err) { | ||
configAction(appConfigObj, config).fail(function (err) { | ||
console.log(err); | ||
}).done(function(configObj) { | ||
}).done(function (configObj) { | ||
console.log(actionMessage, path.resolve(config)); | ||
@@ -171,0 +136,0 @@ callback(configObj); |
{ | ||
"name": "openfin-cli", | ||
"version": "1.1.6", | ||
"version": "2.0.2", | ||
"description": "OpenFin Runtime cli tool", | ||
@@ -25,6 +25,6 @@ "homepage": "http://www.openfin.co", | ||
"dependencies": { | ||
"hadouken-js-adapter": "^0.36.1-alpha.1", | ||
"meow": "^5.0.0", | ||
"openfin-config-builder": "latest", | ||
"openfin-installer": "latest", | ||
"openfin-launcher": "latest", | ||
"request": "^2.87.0" | ||
@@ -31,0 +31,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20976
165
+ Added@types/node@9.6.61(transitive)
+ Addedhadouken-js-adapter@0.36.1-alpha.1(transitive)
+ Addedoptions@0.0.6(transitive)
+ Addedultron@1.0.2(transitive)
+ Addedws@1.1.5(transitive)
- Removedopenfin-launcher@latest
- Removedansi-regex@2.1.1(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbinary@0.3.0(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbuffers@0.1.1(transitive)
- Removedchainsaw@0.1.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfstream@0.1.31(transitive)
- Removedglob@7.2.3(transitive)
- Removedgraceful-fs@3.0.12(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removedisarray@0.0.1(transitive)
- Removedlodash@2.4.2(transitive)
- Removedmatch-stream@0.0.2(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednatives@1.1.6(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedopenfin-launcher@1.4.9(transitive)
- Removedover@0.0.5(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpullstream@0.4.1(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedsingle-line-log@1.1.2(transitive)
- Removedslice-stream@1.0.0(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedtraverse@0.3.9(transitive)
- Removedunzip@0.1.11(transitive)
- Removedwrappy@1.0.2(transitive)