Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Electron packaging with electron-packager

I am trying to package my app using electron-packager. Below is my code.

electron-packager ./electron Myapp --platform=darwin --arch=x64 --version=0.34.0 --overwrite

i added folder named electron to my app and to my surprise, Myapp is always packaged to my parent folder . It does not recognise the electron folder despite the fact that the folder is available.

Moreover, when my app is packaged, it shows my app icon, version and licence files in the finder. But from my code editor, it shows the folder has many files and subfolders like below,

.

The above folder when viewed from finder, it displays only licence, version and my exe . This however happened only in darwin platform. Please what am i doing wrong ? Any help would be appreciated.

Note , i am running an OSX operating system.

like image 568
Nuru Salihu Avatar asked Jun 01 '16 07:06

Nuru Salihu


2 Answers

.apps are technically just folders. Your editor is taking that into account and showing the contents. If you right click on your app, and press show package contents, you'll see whats inside the app. Also, electron-packager does not support outputting to a different directory. You could however cd electron and run electron packager from there, and then it would package to that directory. EDIT: you can actually output to a different directory, with the --out option.

like image 119
willyb321 Avatar answered Oct 13 '22 17:10

willyb321


Add this in package.JSON

"scripts": { 

"start": "electron .",
 "install": "electron-rebuild",

 "package-osx": "electron-packager . Node-RED --platform=darwin --arch=x64 --out=build --overwrite",

"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --prune=true --out=release-builds",

 "package-win": "electron-packager . electron-serialport --overwrite --asar=true --platform=win32 --arch=x64 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"CryptoApp\"",

 "package-linux": "electron-packager . electron-serialport --overwrite --asar=true --platform=linux --arch=x64 --prune=true --out=release-builds" 

},

 "dependencies": {

 "electron-packager": "^12.1.0",

 "electron-prebuilt": "^1.4.13",

 }

In case of no working for windows use following...

"package-win": "electron-packager . electron-serialport --overwrite --asar=true --platform=win32 --arch=ia32 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"CryptoApp\"",

Thanks...

like image 45
YASH GAUTAMI Avatar answered Oct 13 '22 17:10

YASH GAUTAMI