sentialx / electron-global Goto Github PK
View Code? Open in Web Editor NEWOne Electron instance for multiple apps
License: MIT License
One Electron instance for multiple apps
License: MIT License
Since I had already installed electron builder, installed only electron runtime using this
npm install --save-dev electron-runtime
and updated package.json script as "dist": "electron-runtime -m && electron-builder -m"
When i run npm run dist, I get electron-runtime command not found. Electron Builder works fine.
Am I missing something?
(over 50% of Mac users)
I have a little understanding of how it work internally
I remember having cache (localstorage, cookies, etc..) issues when sharing electron binaries
How do you handle that?
someApp/Contents/MacOS/someApp is not executable by default
Workaround (per install)
chmod +x /Applications/someApp/Contents/MacOS/someApp
Running
electron-global
without -m
, -w
or -l
causes electron-global to exit with code 0 without changes.
electron-global should infer the OS automatically like electron-builder
I need to use "build" section in package.json file to customize electron-builder output. But when i use "build" section in package.json, electron-global never be invoked.
Here is with "build" section messages:
• electron-builder version=20.44.4
• loaded configuration file=package.json ("build" field)
• writing effective config file=release\builder-effective-config.yaml
• no native production dependencies
• packaging platform=win32 arch=x64 electron=5.0.10 appOutDir=release\win-unpacked
• default Electron icon is used reason=application icon is not set
• building target=nsis file=release\Setup 2.0.0.exe archs=x64 oneClick=false perMachine=true
• building block map blockMapFile=release\Setup 2.0.0.exe.blockmap
Without "build" section:
• electron-builder version=20.44.4
• loaded configuration file=C:\Users\...\electron-builder.json
• writing effective config file=dist\builder-effective-config.yaml
• no native production dependencies
• packaging platform=win32 arch=x64 electron=5.0.10 appOutDir=dist\win-unpacked
• copying Electron source=C:\Users\...\electron-global destination=C:\Users\...\dist\win-unpacked
You'll see "copying Electron..." and it means now invoked electron-global.
Is this a bug or something else?
Env: Win10-x64 build 1903 latest update, node 12.10.0, and please don't mind electron-builder version :)
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (9)
at Object.writeFile (internal/fs/promises.js:542:5)
at Object.<anonymous> (/home/heath/SyncedProjects/pakkit/node_modules/electron-global/build/index.js:91:29)
at Generator.next (<anonymous>)
at fulfilled (/home/heath/SyncedProjects/pakkit/node_modules/electron-global/build/index.js:4:58) {
code: 'ERR_INVALID_ARG_TYPE'
}
arch linux rocket chat package is 23 MB, using:
After following the Usage
section of the README file, I tried running electron-builder --linux --windows
, but ended up with error:
Downloading electron-global binaries
Downloading electron-global binaries
[
[Error: ENOENT: no such file or directory, lstat '/home/akepinski/dev/elcalc/node_modules/electron-global/download/linux/electron'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: '/home/akepinski/dev/elcalc/node_modules/electron-global/download/linux/electron'
}
]
Done!
• electron-builder version=21.2.0 os=4.15.0-54-generic
• loaded configuration file=/home/akepinski/dev/elcalc/electron-builder.json
• writing effective config file=dist/builder-effective-config.yaml
• packaging platform=linux arch=x64 electron=6.0.4 appOutDir=dist/linux-unpacked
• copying Electron source=/home/akepinski/dev/elcalc/electron-global destination=/home/akepinski/dev/elcalc/dist/linux-unpacked
⨯ ENOENT: no such file or directory, rename '/home/akepinski/dev/elcalc/dist/linux-unpacked/electron' -> '/home/akepinski/dev/elcalc/dist/linux-unpacked/elcalc' stackTrace=Error: ENOENT: no such file or directory, rename '/home/akepinski/dev/elcalc/dist/linux-unpacked/electron' -> '/home/akepinski/dev/elcalc/dist/linux-unpacked/elcalc'
After checking the ./electron-global
directory, it only contains the electron_version
file, which is empty 😢
{
"appId": "me.kepinski.elcalc",
"files": [
"app/**/*",
"package.json"
],
"directories": {
"buildResources": "resources"
},
"electronDist": "./electron-global",
"mac": {
"category": "public.app-category.utilities"
},
"dmg": {
"iconSize": 150
},
"linux": {
"target": [
"AppImage",
"deb",
"rpm"
],
"synopsis": "Cross-Platform Calculator",
"description": "Cross-Platform calculator built with Electron.",
"category": "Utility;Calculator"
},
"publish": null
}
Linux Mint 19.1 Xfce
12.8.0
6.10.2
21.2.0
0.0.1
Running electron-global with yarn on macOS / Linux causes:
env: node\r: No such file or directory
This can be fixed by removing \r\n endings and using \n endings instead
Stackoverflow Answer
yarnpkg/yarn#5480
Workaround:
dos2unix node_modules/*
Can we build independent executables means applicaion1.exe and application2.exe having different names and different icons?
Still electron main process runtime is shared.
Windows is not linux and as such you shouldn't dump .folders in user home directory.
If you don't want to use %PROGRAMFILES% (which requires admin permissions) then the correct location to put files is %PROGRAMDATA%\electron-global. Just make sure to give write/read permissions to the local users group to the created folder.
The electron-runtime
launcher needs to be codesigned in order to codesign other Electron apps with electron-builder
, but codesigning for macOS (and probably for Windows) costs.
⨯ Command failed: codesign --sign x --force --options runtime --entitlements .../node_modules/app-builder-lib/templates/entitlements.mac.plist
...: code object is not signed at all
In subcomponent: .../Contents/MacOS/electron_url
stackTrace=
Launching an app built electron-global results in
dyld: Library not loaded: /usr/local/opt/gtk+3/lib/libgtk-3.0.dylib
Referenced from: /Applications/TeleDrive.app/Contents/MacOS/TeleDrive
Reason: image not found
[1] 66490 abort /Applications/TeleDrive.app/Contents/MacOS/TeleDrive
Workaround (per install)
brew install gtk+3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.