-
-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proton-packager #43
Comments
I've been experimenting with nexe and pkg and I've got them working. I would prefer creating a single binary this way, rather than creating a .app with what you've done. I would love the keep the cli tool, but replace the packaging with nexe. I just need to finish up testing and then I'll make a write-up |
Ok, so |
Pkg and nexe both create a single binary file regardless of the platform (please correct me if I'm wrong). Double-clicking such a file on macOS would first open a Terminal and the app itself would start. It's also not possible to give an icon to a single binary file which is then also visible in the Dock. |
Ok. I'm still going to create a single binary using |
I see, this week me too will be working on packaging issues with nexe/pkg. I like what @mischnic has done, but something more cross-platform would be ideal. Although we could detect the user's platform an expose the right script for them in the package.json file: ie. {
"name": "my-proton-app",
"scripts": {
"package": "proton-packager mac MyApp -f"
},
...
} And in Linux/Windows: {
"name": "my-proton-app",
"scripts": {
"package": "nexe --build"//or just `node build.js` and add nexe as dev dep.
},
...
} Other thing, @kusti8 having library files next to the binary file is not ideal but isn't too bad either, we can design a installer kind of thing that will expose a shortcut to the user and copy our files to other folder, in Linux, something like having an |
I want thinking of integrating the nexe/pkg approach into proton-packager, so the user could just pass |
@mischnic yeah, that would be ideal. |
Yeah that sounds like a good idea. Libui-node may go statically linked
which would make it easier to package.
…On Mon, Mar 5, 2018, 7:54 PM Alberto Rosado ***@***.***> wrote:
@mischnic <https://github.com/mischnic> yeah, that would be ideal.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJW73PWZyL5iGAy2lTFRoMlv6i96ncoxks5tbd5dgaJpZM4SbT9e>
.
|
I have been working in issuing appImages files for Linux, so with @mischnic piece and mine(in progress ), we will only need something similar for windows? |
I suggest you to join forces. I can add proton support to electron-builder. Despite the name, electron can be easily decoupled (actually, modules is already decoupled and some part of code even available as a separate internal tool app-builder https://github.com/develar/app-builder). So, you can just implement specific for proton pars, and you get generic features that electron-builder provides for free and right now:
|
I think that would be a good idea, ideally, and this is what I'm working to achieve on |
The problem I see with create-proton-app is that distributing new script versions is quite hard because it is installed globally (create-react-app had this as well). Also, putting the script into the created project means that the user has to update it himself. This is why separate packagers are better suited (and they can be used in projects created without create-...-app).
What if you wanted to package for linux on windows (after we got precompiled binaries for libui-node)? This is the reason why most scripts in the npm ecosystem are node scripts themselves.
So what is better, creating an untested script from scratch or using an already tested tool? |
electron-builder is able to produce AppImage on macOS/Linux and no need to install AppImage tools manually. The same for snap. And for other targets (yes, we don't try to reinvent the wheel — FPM is used under the hood for deb, rpm, apk and other Linux targets). "usability"
Here framework specific only first step (yes, because of performance, other steps can be also depends, for example, electron-builder tries to do all using in-memory and avoid file copying). "proton pars" means "how to transform user project into packable format" (step 1).
Because of usability, NodeJS cannot be used for all raw and native things. Native node module it is hell (must be no native modules to ensure that users will not suffer). JS implementation of some things in most cases leads to bloated package ("as little dependencies as possible"). So, image tasks (electron-builder is able to produce icns or ico from one png file), downloading (multi-part downloader cannot be effectively implemented using NodeJS) and other low-level tasks implemented in Golang.
Golang is much more better suitable language for build tools. But in any case right now electron-builder implemented in TS. Golang used only for low-level tasks. |
mmm, I see, totally forgot the case when someone on windows wants to produce other platform binaries, LOL. I like Golang, and I like |
Ok. If no one has some objections, I will incorporate https://github.com/mischnic/proton-packager into a new module proton-builder, that will use electron-builder-lib under the hood and will decouple electron related code. For example, issues like mischnic/proton-packager#3 will be in the past, since electron-builder is able correctly copy only production deps (including support for Yarn/Lerna workspaces). (actually, proton-packager can also use electron-builder-lib for such tasks, but I think it will be better to reuse common electron-builder framework — I mean framework will delegate specific tasks to, instead "some other tool will provide own front-end and use generic lib functions). |
Awesome!!! 👍 I just add that to the scripts and we will be done with packaging. |
👍 |
Sounds good. |
I have done first part (download node and prepare app template, code is taken from https://github.com/mischnic/proton-packager/blob/master/src/mac.js) of required changes to electron-builder to support proton (btw, electron-builder also supports muon, so, electron was already a little bit decoupled).
electron-builder is not yet able to build Proton, I will continue (develar/electron-builder@f20d7cc#diff-d0d77e592f1e2eac7e50d28153a8d0c0). Next part — copying project files. These changes is not yet in the master branch of electron-builder, it is my working branch. |
@develar Two important things that (I think) are different to electron (just as a reminder):
|
@mischnic Thanks. Also, as far I see, |
Technically yes, but in total that's at most only 500kb. |
It is a little bit strange for me, since it should be handled somehow outside of builder tool to be fully controlled by user... but I totally agree that this functionality should be fully integrated since most users will use runtime compilation during development. For example, electron-webpack is not supported by electron-builder, instead, electron-webpack provides special So, it will be easy for user to package whatever complex project structure. But by default solution like electron-compile support (build on the fly without intermediate files) and how it is currently implemented in the proton-packager. BTW — for Windows it is not good to have a lot of small files. Solution or https://github.com/pmq20/node-packer (on a first glance, development env will be very complex to setup), or WebPack bundle (easy solution, but requires changes to the app and can lead to runtime errors due to difference to development version). In any case for now I want to support Linux/macOS at first. |
Yes, a bundler would work as well, might even be faster running the app then. I don't fully understand how electron-webpack and electron-bundler work together, but we can use that if they do. |
The icon is in #102 (as a svg). |
I have converted provided SVG file to ICNS, electron-builder 20.14.3 uses it as a default icon for macOS. |
In the meantime, I've set up an example for how to use launchui-packager with proton-native: https://github.com/mischnic/proton-launchui. |
@mischnic The main question to be answered with using launchui-packager is how to update the app after publishing. Is there any workaround for that? |
https://github.com/electron-userland/electron-builder/releases/tag/v20.36.1
I think this issue can be closed. Further issue please file to electron-builder issue tracker (prefix with "proton: " to ensure that it will be fixed faster than electron framework issues ;)). |
What do you think about launchui? Right now, when no prebuilds for libui, it is the only solution to build proton app on any OS for any OS. In case of Windows no variants — bat file or another script is not good. But for Linux and macOS... I am worry about fact that in case of LaunchUI user cannot easily use own node version. But... probably it is ok as I have prepared appveyor and so, it is easy to release new LaunchUI builds for new versions of libui/node. |
libui binaries are already available and libui-node prebuilds should be in the near future (not sure where I said that a few days ago - there are too many issues regarding the packaging 😄). |
Actually we can simply use link args as solution (for both desktop and start-up shortcuts). Another solution is VBScript. For me problem is that on bloody Windows I didn't managed to make libui working and instead of investigating WHY bloody libui-node cannot find compiled libui node native module I decided to just use launchui (I forked it and build using latest LTS node). Maybe on this weekend I will do another round of debugging libui-node and bloody windows. |
BTW — I have security concerns of using node.exe directly with arg. Not sure are all antiviruses will be happy. It is why I gave up and started to use LaunchUI for Windows. Windows is so bad that it is better to avoid any unclear solution for packaging apps, that can be used in various conditions. |
Ok, I have managed to rebuild *** native module and now Windows is happy to run app and load native module directly without LaunchUI. Problem is that Windows doesn't have such concept as application. On Linux or macOS you can define your application as unit, but on Windows it is just a bunch of files. See screenshot. Nice? Nice. So, user can by mistake run Yes — we can name helper executable as Should we? I think we should not. The only price of LaunchUI — send PR once in several months to build a new release for recent libui/nodejs version. And as AppVeyour file to do it is provided, even if main maintainers doesn't provide required versions for you, it takes only 30-40 minutes (per arch) to build your own if need (fork repo, add project to AppVeyour, change download-deps.json, wait 30 minutes and grab artifacts from build — no need even touch Windows and deal with Microsoft tools). "avoid base binaries" vs "app will differ from native and consists of two executable (that will also slighly slowdown start because it is Windows)" And don't tell me about AppX — thanks to Microsoft, this technology supported only on Windows 10 and so, we can use it only in 2030 or later. |
Just to clarify, my intent is to maintain LaunchUI and keep releasing new versions, and the AppVeyor integration will definitely help with that, but first there must be some consensus whether it's the "right" solution or not. |
It could, but I think that libui-node still has to be recompiled to link against node.dll instead of node.exe, even if it's using N-API. |
I don't think so (at least on macOS). libui-napi isn't linked to anything regarding node. I'm guessing that everything of that is done when node loads the module at runtime.
|
NodeJS doesn't going to offer official solution — nodejs/node#556 So, it means that for now even if you can build simple launcher like package main
import (
"os"
"os/exec"
"path/filepath"
)
func main() {
ex, err := os.Executable()
if err != nil {
panic(err)
}
appDir := filepath.Dir(ex)
command := exec.Command(filepath.Join(appDir, "node.exe"), filepath.Join(appDir, "app", "main.js"))
command.Dir = appDir
//command.Stdout = os.Stderr
//command.Stderr = os.Stderr
err = command.Run()
if err != nil {
panic(err)
}
}
you still have to rebuild |
One question guys, will these executable (i.e. .exe) be nodejs independent, no node platform installed needed in the target machine, or am I still gonna need node installed to run it? Which is, as of right now, the more straight forward solution? This #43 (comment) ? |
They don't require node to be installed. And by now, electron-builder supports Windows with proton-native (so all platforms). |
There was something I did not understand well, do I run that script over the folder (no matter how many js files are conforming the app) or do I have to consolidate everything in a single js file as was done for notepad 1.0.1 example? |
If you have installed proton native with create-proton-app, then you can just run |
Is there any way to create a single .exe file instead of an application folder full of dlls? I found it https://www.electron.build/configuration/nsis Portable¶ To build portable app, set target to portable (or pass --win portable). For portable app, following environment variables are available:
|
For some reason on the website it says that
See https://www.electron.build/configuration/configuration#proton-native Is that an outdated doc or still not officially fixed? |
I'm having some strange issues with proton native and native packages (keytar), Maybe anyone has a quick idea on how to approach it? I have tried to build it on Win 10 with Node 8 and Node 11 |
I have built a cli tool to package proton apps (currently only macOS bundles are supported).
Maybe there is someone who knows how the linux (or windows) packaging should work and would like to contribute (platform-independent parts can be reused).
https://github.com/mischnic/proton-packager
This could be added the Mac section of the "Packaging" docs.
#39 @gordygordy This will create a proper .app bundle.
The main thing on macOS, that is keeping bundles from being indistinguishable from native apps, is #13.
The text was updated successfully, but these errors were encountered: