Skip to content
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

Zipping best practice #581

Closed
TheJaredWilcurt opened this issue Jun 22, 2022 · 5 comments · Fixed by #665
Closed

Zipping best practice #581

TheJaredWilcurt opened this issue Jun 22, 2022 · 5 comments · Fixed by #665
Labels
feature Priority: 2

Comments

@TheJaredWilcurt
Copy link
Member

Current Docs/API:

options.mergeZip

Type: Boolean Default value: true

WINDOWS AND LINUX ONLY: Merge the source file package with the Node Webkit executable.

This approach has come to be known as an anti-pattern, it should no longer be enabled by default or recommended in the new API.

This approach involves packaging your project code into a .zip then performing copy /b nw.exe+package.zip app.exe or cat nw package.zip > app && chmod +x app. Producing an executable with the zip file built-in to it.

When you double-click the executable, the first thing it does is extract the zip file contents to a temp folder, then launch the app from that location. This requires unzipping the project files on every launch, making the start up time for apps slow for no benefit.

A better approach is to store the project files in a package.nw folder and place the folder next to the nw.exe. So it just runs directly from the file system.

@ayushmanchhabra
Copy link
Collaborator

Thanks! I haven't even reached here but this is definitely good to know before getting into zip functionality.

@TheJaredWilcurt
Copy link
Member Author

TheJaredWilcurt commented Jul 7, 2022

If you put all your files in a package.nw folder next to nw.exe and then zip all of that together, that's fine, example:

Because the user downloads the zip file, then extracts everything once to a folder, then deletes the original zip. This has no impact on performance.

@ayushmanchhabra
Copy link
Collaborator

There are so many options for zip functionality that it sometimes gets confusing. To make sure I understand we have a package.nw folder which has all the source files. We place that next to the nw.exe executable. We then zip the folder (lets call it app) which contains these 2 things and other library files like 'ffmpeg`. To run it we unzip and run the executable.

@TheJaredWilcurt
Copy link
Member Author

You got it, you can download the example I linked above. but that's it:

  • App.zip
    • nw files (nw.exe, ffmpeg, libEGL, icudtl, etc)
    • package.nw
      • all your files (package.json, index.html, etc)

@ayushmanchhabra ayushmanchhabra changed the title v4 API change / best practices for builds Zipping best practice Jul 26, 2022
@ayushmanchhabra
Copy link
Collaborator

Closing this in favour of #623.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Priority: 2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants