From bb81977e4e0eedb1019c590ae7f6ca2c53dd3f6f Mon Sep 17 00:00:00 2001 From: Sean O'Brien Date: Thu, 13 Sep 2018 11:50:14 -0400 Subject: [PATCH 1/2] Add support for calling lb-sdk from electron default app --- bin/lb-sdk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/lb-sdk b/bin/lb-sdk index 19210af7..75f322f5 100755 --- a/bin/lb-sdk +++ b/bin/lb-sdk @@ -85,7 +85,15 @@ if (!argv['q']) { /** * Set Reference For Main Options */ -var appFile = path.resolve(argv._[0]); +var appFile; + +// If this script is being called by electron.exe, we need to take the second argument. +if (process.defaultApp) { + appFile = path.resolve(argv._[1]); +} else { + appFile = path.resolve(argv._[0]); +} + /** * Load and Boot LoopBack Application */ From c397d10105978082e7e4e94268c1f9a850db2881 Mon Sep 17 00:00:00 2001 From: Sean O'Brien Date: Thu, 13 Sep 2018 17:37:21 -0400 Subject: [PATCH 2/2] Added support for nested execution --- bin/lb-sdk | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/bin/lb-sdk b/bin/lb-sdk index 75f322f5..6c65fff8 100755 --- a/bin/lb-sdk +++ b/bin/lb-sdk @@ -86,14 +86,27 @@ if (!argv['q']) { * Set Reference For Main Options */ var appFile; +var outFolder; -// If this script is being called by electron.exe, we need to take the second argument. -if (process.defaultApp) { - appFile = path.resolve(argv._[1]); -} else { - appFile = path.resolve(argv._[0]); +for (var i = 0; i < argv._.length - 2; i++) { + if (argv._[i].match(/lb-sdk/)) { + appFile = argv._[i + 1]; + outFolder = argv._[i + 2]; + break; + } +} + +if (!appFile) { + appFile = argv._[0]; } +if (!outFolder) { + outFolder = argv._[1]; +} + +appFile = path.resolve(appFile); + + /** * Load and Boot LoopBack Application */ @@ -104,7 +117,7 @@ var context = { framework: argv['l'] || 'angular2', moduleName: argv['module-name'] || 'sdk', apiUrl: argv['url'] || app.get('restApiRoot') || '/api', - outputFolder: argv._[1], + outputFolder: outFolder, isIo: argv['i'] || 'disabled', isNgrx: argv['n'] || 'disabled', driver: argv['d'] || 'ng2web',