mean-expert-official / loopback-sdk-builder

Tool for auto-generating Software Development Kits (SDKs) for LoopBack
Other
399 stars 178 forks source link

Electron default app support #618

Open s73obrien opened 5 years ago

s73obrien commented 5 years ago

What type of issue are you creating?

What version of this module are you using?

Write other if any: 2.3.1

Please add a description for your issue:

Running loopback inside main process of electron. In pursuit of that, I would like to run this script in electron's default app so that I may fully integrate the server into an electron user interface. This may be ill-advised I understand, but there you have it.

Essentially, I want to:

electron --require ./node_modules/ts-node/register ./node_modules/@mean-expert/loopback-sdk-builder/bin/lb-sdk <electron entry point> <sdk location> <options>

The only real roadblock that I see is that, when running as an argument to electron's default app, the argv._ array has an extra entry at the beginning. See here for a better description of that phenomenon.

I have committed a PR adding support by looking for presence of the process.defaultApp variable and taking the second argument in argv._ accordingly as the script target.