Electron without GUI - node.js

I need to create a node.js application that works in background as a web application. The app should provide some functionality for the main client's site. The application is going to be installed on many machines with differences OS, that's why I want to get rid of node.js dependency and compile it to binary.
I used electron-builder, but as I understood it depended on GUI. So, what can I do to compile the app that can work without GUI and Node.js?

How about pkg?
This command line interface enables you to package your Node.js project into an executable that can be run even on devices without Node.js installed.

Related

Creating an installer for software on Node.js

With what can implement an installer for the application on Node.js be implemented with the ability to install applications without access to the Internet?
You may accomplish this by using https://www.npmjs.com/package/pkg to pack your app to a single executable.

Creating a native background application using ndk

How to create more than 1 background applications in a single Android application using Android NDK ?
Need help in creating few background applications using NDK. My C application makes use of few standalone applications which run in the background (as services on windows). So my question is how can I create these standalone applications on Andriod platform?
I'm aware that these have to be services in Android applications, but services are Java code & NDK doesn't support C services & all my application code is in C. So how can I port these standalone applications onto Android along with my main application which uses these standalone helper applications. Should they be made separate libraries ?
If they are made separate libraries, then how can I ensure that they keep running in the background? I'm not sure, so any guidance will be very helpful. I don't want to root the device.
Android is very different from Windows, porting Windows services may be a significant challenge.
First of all, the IPC protocols are not the same, therefore you may need modifications to simply have your code compile.
The second issue is the background execution model of Android. On the newer versions, since Marshmallow, Google is improving the battery life by proactively killing all background services.
So, if you depend on these processes to be running always, you must keep your app in the foreground.
This said, you can build and run a command line executable for Android without wrapping it into an Android (Java) application or Service.
You can run them from the android shell (at least for testing), or use Runtime.exec() from Java. If you root the device, you can even start these executables on boot from init.rc, just as if it were a regular Linux box.

UWP app deployment via download

I want to deploy my in-house UWP app only to selected Windows Phone 10 devices via a download link.
This already works for iOS and Android, but I have troubles with WinPhone 10.
On my development device, I can just download and install the created appxbundle file. However, it seems that the appxbundle does not include the dependencies (Microsoft.NET.CoreRuntime.1.0.appx, Microsoft.VCLibs.ARM.Debug.14.00.appx). Therefore the installation does not work on devices, which have never been used to develop the app (and therefore do not have the dependencies installed).
Is there a way to create a complete appxbundle which also installs the dependencies?
Building the app in release mode solved the problem.
The .NET native toolchain includes all the required dependencies into the executable and therefore the installation of the dependencies is not required.

Depending on lots of npm from vscode moduleā€¦?

I'm just starting out trying to integrate Ensime scala ide-support into vscode. I have pulled out some of the integration parts from my atom package https://github.com/ensime/ensime-atom into https://github.com/ensime/ensime-node.
However, when depending on this from vscode I get red squigglies that it can't be found:
However, code still build and runs just fine. I got worried. I found this:
Q: Can I use native Node.js modules with my extension?
A: A Visual Studio Code extension package contains all of its
dependencies. This means that if you develop your extension on Windows
and depend on a native Node.js module when you publish that extension,
the Windows compiled native dependency will be contained in your
extension. Users on OS X or Linux won't be able to use the extension.
The only way to make this work for now is to include binaries for all
four platforms of VS Code (Windows x86 and x64, Linux, OS X) in your
extension and have code that dynamically loads the right one.
What does this mean? I can't use fs, net, child_process and the like? Kindof need them all I think or does vscode provide all that through abstraction layers?
You do have the basic node modules (fs, etc) already included as part of the dependency of vscode itself.
Did you remember to include this module in your package.json file as a dependency?
A way to check this would be to clean your code, put it in a new folder, and run "npm install" - if everything then runs fine, you are good to go.
See this docs:
https://code.visualstudio.com/Docs/extensionAPI/extension-manifest
Be sure to also read up on the new extension authoring update in the latest version: https://code.visualstudio.com/Updates

What are some mechanisms to package cross-platform Electron apps in a single build?

I'm developing a desktop application based on Electron and I use electron-packager to create executables. The app uses some binary node modules such as bcrypt.
On my Mac, I package the app, targeting both OSX and Windows. The resulting package runs fine on OSX. But when I run the resulting Windows package (.exe and dependencies) on Windows 8.1 64 bits, the app throws an error (quite expectedly):
Is there any practice or tool that helps me be able to do the packaging once in any OS, even if the app depends on binary modules, and produce executables for Windows, OSX and Linux? For example, I'd like to run the build on OSX to produce executables for all three operating systems, instead of having to repeat the packaging for each platform
You should look into removing native binary requirements from your project if possible. For example the module you mention, bcrypt, has another implementation which is full JS and doesn't require native binaries: https://www.npmjs.com/package/bcrypt-nodejs
If you really need to include compiled binaries as a part of your dependencies you're probably going to have to design that part of the build/packaging automation yourself.

Resources