openfin-cli
Advanced tools
Comparing version
11
cli.js
@@ -6,2 +6,10 @@ #!/usr/bin/env node | ||
openfinCli = require('./'); | ||
const options = { | ||
flags: { | ||
name: { alias: 'n', type: 'string' }, | ||
url: { alias: 'u', type: 'string' }, | ||
config: { alias: 'c', type: 'string' }, | ||
launch: { alias: 'l', type: 'boolean' } | ||
} | ||
}; | ||
@@ -16,2 +24,4 @@ var cli = meow({ | ||
'-l --launch launch this configuration', | ||
'-p --devtools-port devtools port number', | ||
'-v --runtime-version runtime version', | ||
@@ -22,3 +32,2 @@ '-i --installer a url to an OpenFin config file ', | ||
'--file-name <application name to be used in the config>', | ||
@@ -25,0 +34,0 @@ '--no-ext <If set “true”, the file is extention-less>', |
29
index.js
@@ -18,2 +18,4 @@ 'use strict'; | ||
launch = flags.l || flags.launch, | ||
devtools_port = flags.p || flags.devtoolsPort, | ||
runtime_version = flags.v || flags.runtimeVersion, | ||
parsedUrl = url ? parseURLOrFile(url) : url; | ||
@@ -27,3 +29,3 @@ | ||
try { | ||
writeToConfig(name, parsedUrl, config, function(configObj) { | ||
writeToConfig(name, parsedUrl, config, devtools_port, runtime_version, function(configObj) { | ||
if (launch) { | ||
@@ -84,3 +86,3 @@ launchOpenfin(config); | ||
for (var key in flags) { | ||
if (flags.hasOwnProperty(key)) { | ||
if (flags.hasOwnProperty(key) && flags[key] !== false) { | ||
return false; | ||
@@ -107,3 +109,3 @@ } | ||
//write the specified config to disk. | ||
function writeToConfig(name, url, config, callback) { | ||
function writeToConfig(name, url, config, devtools_port, runtime_version, callback) { | ||
if (isURL(config)) { | ||
@@ -120,2 +122,3 @@ request(config, function(err, response, body) { | ||
startup_app = {}, | ||
runtime = {}, | ||
configAction, | ||
@@ -142,9 +145,23 @@ actionMessage; | ||
} | ||
if (runtime_version) { | ||
runtime.version = runtime_version; | ||
} | ||
} | ||
//create or update the config | ||
configAction({ | ||
var appConfigObj = { | ||
startup_app: url ? startup_app : null, | ||
shortcut: shortcut | ||
}, config).fail(function(err) { | ||
} | ||
if (devtools_port) { | ||
appConfigObj.devtools_port = devtools_port; | ||
} | ||
if (runtime_version) { | ||
appConfigObj.runtime = runtime; | ||
} | ||
//create or update the config | ||
configAction(appConfigObj, config).fail(function(err) { | ||
console.log(err); | ||
@@ -151,0 +168,0 @@ }).done(function(configObj) { |
{ | ||
"name": "openfin-cli", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "OpenFin Runtime cli tool", | ||
@@ -11,2 +11,5 @@ "homepage": "http://www.openfin.co", | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"repository": "openfin/openfin-cli", | ||
@@ -23,20 +26,22 @@ "license": "MIT", | ||
"dependencies": { | ||
"meow": "^2.0.0", | ||
"meow": "^5.0.0", | ||
"openfin-config-builder": "latest", | ||
"openfin-installer": "latest", | ||
"openfin-launcher": "latest", | ||
"request": "^2.53.0" | ||
"request": "^2.87.0" | ||
}, | ||
"devDependencies": { | ||
"grunt-cli": "^0.1.13", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-contrib-nodeunit": "^0.4.1", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"load-grunt-tasks": "^1.0.0", | ||
"time-grunt": "^1.0.0", | ||
"grunt-mocha-cli": "^1.11.0", | ||
"grunt": "^1.0.3", | ||
"grunt-cli": "^1.2.0", | ||
"grunt-contrib-jshint": "^1.1.0", | ||
"grunt-contrib-nodeunit": "^2.0.0", | ||
"grunt-contrib-watch": "^1.1.0", | ||
"grunt-jsbeautifier": "^0.2.7", | ||
"grunt-mocha-cli": "^4.0.0", | ||
"jshint-stylish": "^1.0.0", | ||
"grunt-jsbeautifier": "^0.2.7" | ||
"load-grunt-tasks": "^4.0.0", | ||
"time-grunt": "^1.0.0" | ||
}, | ||
"scripts": { | ||
"start": "node cli", | ||
"test": "grunt mochacli" | ||
@@ -43,0 +48,0 @@ }, |
@@ -24,5 +24,5 @@ # OpenFin Runtime cli tool | ||
##Examples | ||
## Examples | ||
####Launching OpenFin Demos | ||
#### Launching OpenFin Demos | ||
``` | ||
@@ -33,3 +33,3 @@ $ openfin --launch --config http://cdn.openfin.co/demos/hyperblotter/app.json | ||
####Launching an application | ||
#### Launching an application | ||
@@ -45,3 +45,3 @@ ```sh | ||
####Creating a config file | ||
#### Creating a config file | ||
@@ -57,3 +57,3 @@ ```sh | ||
####Launching a given config file | ||
#### Launching a given config file | ||
@@ -71,23 +71,23 @@ ```sh | ||
####Generate installer URL | ||
#### Generate installer URL | ||
Will print a url to the console with the name proivided via the `-n` flag and the hosted confg | ||
file url provided via the `-c` flag | ||
````sh | ||
```sh | ||
$ openfin -n OpenFinPOC -c http://goo.gl/w2747v -h | ||
```` | ||
``` | ||
####Download an installer zip locally | ||
#### Download an installer zip locally | ||
Use the `-d` or `--destination` flag to specify the directory of the download. To download to the current directory use `-d .` or `--destination .` | ||
````sh | ||
```sh | ||
$ openfin --destination my-dist-directory --installer http://goo.gl/w2747v | ||
```` | ||
``` | ||
Shorthand | ||
````sh | ||
```sh | ||
$ openfin -d my-dist-directory -i http://goo.gl/w2747v | ||
```` | ||
``` | ||
####Installer config options | ||
```` | ||
#### Installer config options | ||
``` | ||
--no-ext If set “true”, the file is extention-less' | ||
@@ -98,3 +98,3 @@ --rvm-config URL that points to the RVM config. Must be a full URL.' | ||
```` | ||
``` | ||
## License | ||
@@ -104,3 +104,5 @@ | ||
By downloading OpenFin, you agree to the terms of our [Developer License](https://openfin.co/developer-agreement/) | ||
[npm-url]: https://npmjs.org/package/openfin-cli | ||
@@ -107,0 +109,0 @@ [npm-image]: https://badge.fury.io/js/openfin-cli.svg |
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
22161
104.89%194
13.45%107
1.9%10
11.11%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
Updated
Updated