-
Notifications
You must be signed in to change notification settings - Fork 32
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
package the Echogarden project into a standalone executable #17
Comments
Hi, thanks for your interest in trying to make a standalone executable! That is something I'd eventually want to have. I tried running Actually, this isn't something I've tried to do, yet, since I know that given all the complexities of the dependencies, like static resource files I load, path resolutions I perform, workarounds to dependency package bugs, a few native executables I use, internal package system, optional native bindings that can be installed (for example, SAPI support on Windows etc.) it would probably require several days of work, a week, or possibly be impossible using a tool like The choices I've made, to use a global package, and to avoid native bindings as much as possible, means that all it takes is to install Node.js (no extra compilation tools needed), and then I did think about a standalone deployment approach, that may make it easier for some users to run, also since I have server capabilities in development, and I want to allow users to easily download and install it locally, and then interface with the server using a web UI or browser extension. The direction I was heading towards was to bundle a portable Node executable (and related files) with a directory containing the base package, plus a pre-installed That may work actually, since all the path resolutions done internally should be relative to the base package directory. Even if there's a problem it would most likely be easy to fix. There are downloadable portable distributions of the Node.js runtime (including https://nodejs.org/dist/v18.17.0/node-v18.17.0-win-x64.zip The internal structure looks like this: So all it may take is to ensure that the CLI Launcher script ( This is something I was planning to try at some future point, but since you're showing interest, I might work on it sooner. In any case, does a portable Edit: If the portable installation supports |
Thank you for your comprehensive response and for considering my request. I appreciate your detailed explanation about the challenges of creating a standalone executable, and I understand the complexities involved. I want to confirm that a portable Node.js bundled with a local installation of Echogarden is exactly what I need. This solution would perfectly suit my requirements, and I believe it would greatly simplify the deployment process for other users as well. Please proceed with this if it is feasible and doesn't impose too much of a burden on your current workload. Your work on Echogarden is greatly appreciated, and I'm looking forward to the future developments of this project. Best Regards |
I tested this and it seems to work (assuming you're using Windows, but it should be similar with other platforms):
( I uninstalled my global install of node.js to ensure it uses the local Node executable. Now what we need is any tool that bundles the 316MB (10,000 files) directory content to a single executable, and when run calls some bundled batch file (or shell script on Linux) that runs ( Edit: it could be that the portable distribution of Node doesn't actually include |
Yes, it works for me too when I add a path before npm.cmd. It executes as expected. Regarding the tool to bundle the directory content into a single executable, perhaps we could consult with ChatGPT for potential solutions |
Turns out there's a simpler method to start the CLI, using the auto-generated batch files that are created in the
If this works, I'd prefer to use it since it would adapt to whatever future changes are done in the The auto-generated script :find_dp0
SET dp0=%~dp0
...
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
) I don't exactly know what it means. I'm not an expert on batch files. Anyway, you can try to use this file as the target executable to run. Based on my searches, and answer from Claude 2 chatbot:
In general it's probably better to set the compression to "none", as otherwise it would be very slow to start. I'll keep looking for better solutions. (also: in the latest version I fixed an issue with module path detection for a particular library ( |
After asking Claude 2 about the batch file @ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\echogarden\dist\cli\CLILauncher.js" %* It explained that This means that it either looks for the node executable in the batch file directory itself, or uses the default Also, I was able to install Anyway, the scripts in Edit: I retried the entire process. The |
I managed to get a working single executable in Linux using makeself. (I used WSL2):
#!/bin/sh
./bin/node ./node_modules/.bin/echogarden "$@"
( The resulting executable is 407MB. The time to extract is less than 5 seconds (which is great for more than 10,000 files), and it correctly passes any command-line arguments. When the executable is started, there is a status showing the extraction process:
I don't think it's possible to silent it. I found an issue on the I also tried making a self-extracting 7-zip archive on Windows. It shows a prompt window (which may be possible to hide), and in general is much, much slower than
Edit: It seems that the extraction time is slow partially due to Windows antivirus. With real-time antivirus protection disabled, 7-zip self-extracted in about 15 seconds, which is much faster than than the 1 minute it took with the Antivirus enabled, but still slower than |
You are amazing. Thanks a lot |
Thanks, but it turns out this solution doesn't really work properly. This is an intentional decision by the developer. I don't think there's a technical barrier of some sort (looks like the protections he added may have taken more work than not having them). He says:
I made some conversations with Claude (chatbot) about how self-extracting archives work, so I have a better idea now. It's actually not that difficult to make a basic solution that would perform the extraction, and then run some command in the extracted directory. With a minimalist approach, omitting things like user-interface, compression, signatures, and verification, the core of what it does is not very big. I am surprised there are no simple solutions for this (that I know of, or GPT-4, or Claude 2, for the matter..). It's just some compiled extraction code, with some binary data appended to it. When I say "not that difficult".. I mean it would probably take at least a week of work though.. (from start, to a working debugged results, I mean) I can't see the benefit of doing something like this myself right now, compared to the benefit of this project. At least at this time. If at some point I feel it is strongly important, I might, but I still suspect it wouldn't be a great use of my time (may be seen as a distraction in retrospect). |
According to the latest information I have, the reason for the PKG packaging failure is that it does not support ES6. |
Yes, I noticed that was mentioned in the repository. But also, the way it performs the packaging would also require adding many special files, like binary files and modules (such as |
I can't package the Echogarden project into a standalone executable using tools like pkg. When I use pkg, I get the following warnings: Warning Babel parse has failed: 'await' is only allowed within async functions and at the top levels of modules. (2:12)
The text was updated successfully, but these errors were encountered: