Distributing Homebrew dependencies along with electron-packager - homebrew

I have an electron application that has the following dependencies:
ffmpeg
libmagic
gdbm
Currently, I use Homebrew and run brew install ffmpeg etc. upon startup of the app.
However, this is terrible for distribution. Is there a way to distribute these dependencies packaged alongside my application so that the end user doesn't have to have Homebrew or deal with installation errors? I'm distributing my app using electron-packager to create a Desktop Mac app.
I gave the specific dependencies just for context -- hopefully there is a solution that would work with any generic dependency?

It is possible with dynamic linking
use https://www.npmjs.com/package/ffmpeg-static
Example Usage
Returns the path of a statically linked ffmpeg binary on the local filesystem.
var pathToFfmpeg = require('ffmpeg-static');
console.log(pathToFfmpeg);
/Users/j/playground/node_modules/ffmpeg-static/ffmpeg
check https://discuss.atom.io/t/information-about-bundled-ffmpeg/28456/6

Related

How to Install manually ElectronJS

When installing Electron on my company's computer, I have some issues regarding certs and other firewall problems. Because of that, I need to skip the download of the binaries during installation of the project dependencies.
There is a section on the doc, which tells you how to download the binaries, but I could't find how to install it.
I tried to unzip it on my home/.electron folder, which resulted nothing.
Is there a way to properly install this binaries manually?

Electron - How can I install or use a third party dependency like a brew or apt-get package in my app?

Currently I want to build a desktop app which is using a third party package that can be installed trough apt-get or brew but I do not know how to inject this dependency on my electron app.
I want to avoid ask the user to install this dependency before of use my app like "Hey to use this app you should have the Package A installed.".
Thanks for the help.
You can do it in the installer (Preferred). For example, You can create a debian for your app.
In the makefile of the debian, you can check if module is present or not, if not install.
OR
You can do it in the app first boot,
You can check if the user's system already has that module or not using child_process (spawning a terminal & executing a cmd to check if the module is present) or by writing a native node module to do the same.
If the module is not present, you can use child_process module to execute the command to install that module.

How do you install and bundle GraphicsMagick in an Electron app?

I'm building an electron app and I need GraphicsMagick. The documentation suggest that you have to download and install the program itself before using it with node.js. So just installing the npm package is not enough.
How do I do it then? Do I actually have to have my Electron app download binaries (or bundle it with binaries) and then install the program on the first app launch in order to be able to use it?
It doesn't even support CLI commands like for example ffmpeg does, so I cannot just bundle the binaries and execute commands like gm.exe convert test.jpg
I'd say yes, you have to bundle the binaries together with your app, if you don't want to distribute your app via a package repository or require your user to install GraphicsMagick previously.
It does support CLI commands like gm.exe convert test.jpg. If your using electron-builder for packaging, you must add a configuration to prevent the binaries from being asar-packed:
"build": {
"asarUnpack": [
"path/to/your/GraphicsMagick/binary/**"
],
From electron you can call the program e.g. with
const child_process = require('child_process')
child_process.execFile('relative/path/to/your/gm.exe', ['version'],
(error, stdout, stderr) => {
console.log(stdout)
} )
You can download the windows binaries e.g. from the sourceforge host. After installing those binaries you have to copy the installed folder to your app.

Installation with Create React App

I'm sorry for asking what may be an obvious question to most, but I'm lost. I have created a react project with create-react-app. I want to add a third party library (Ant Design UI Framework) that uses .css styles. Ant will use global .css and the rest of my application can then use styleName.
After running npm install babel-plugin-react-css-modules --save what do I have to do to get this running? The documentation references the configuration but the individual steps required properly configure the app aren't clear at all—at least to me.
Can someone help with a bit of an "idiot's guide" to setting this up, and detail some of the steps?
Thanks,
Chris
Ant Design also have react native library as you can see here
You just need to run the following command on your project root to install it:
$ npm install antd-mobile --save

How to write an Electron app with Hyper?

I was wondering, how can I start to write an Electron app using the Hyper.js sources?
I am new to both Electron and Hyper, and watched a few videos on building an Electron app. But I can't quite figure out how to start the Hyper app. For instance, which is the "main" file in the sources?
Alright, after more reading and getting familiar with Node.js and Electron apps, the following procedure works:
git clone https://github.com/zeit/hyper
cd hyper
npm install
A lot of packages will be installed in a subdirectory called node_modules, then:
yarn run dev
And (in a separate terminal window):
yarn rup app
This will open an Electron app similar to the original one built by Hyper.

Resources