Skip to content

App packaging #251

Closed
Closed

Description

@YurySolovyov

It would be awesome to get packaging support with embedding resourses to executable file
Discussed a lot here: nwjs/nw.js#151 don't get confused with issue title btw

Activity

  1. zcbenz commented on May 7, 2014

    @zcbenz
    Contributor

    I'm not very positive on adding it, since anyway you would have to ship DLLs and resources files along with the exe file, and it won't prevent users unzip and change your source code.

  2. YurySolovyov commented on May 7, 2014

    @YurySolovyov
    ContributorAuthor

    At least it would be harder, for many people it's enough to just give up.

    So, current packagin will stay the same? I mean is there a plans for improving it or adding features?

    P.s. Personally, I'm ok with not embedding .dlls, main requerst is to embed resources and source code.

  3. zcbenz commented on May 7, 2014

    @zcbenz
    Contributor

    How about unzipping the .exe file to a temporary directory and then load the real app from it in the main.js, which is exactly what node-webkit does? The main.js is still visible to users though.

  4. YurySolovyov commented on May 7, 2014

    @YurySolovyov
    ContributorAuthor

    This might have problems with clean-up if main process crashes or closes in a way that makes clean-up hard or impossible. There is possible to workaround this, but it still not optimal IMO.

    What are main problems with embedding resources in executable and accessing them with a pseudo-protocol like app://index.html ? This need some kind of internal routing though(for relative paths in css for example), but seems more reliable and probably faster (since you don't have to unpack resources).

  5. zcbenz commented on May 8, 2014

    @zcbenz
    Contributor

    Embedding resources into executable is only possible on Windows, to make it cross-platform we have to compress resources into zip and concatenate it to the executable, and then unzip them from the executable latter.

    However packaging the resources into an external file and then use custom protocol to access the resources would possible, it also seems like a proper solution for app packaging to me.

  6. YurySolovyov commented on May 8, 2014

    @YurySolovyov
    ContributorAuthor

    When you saying " then unzip them from the executable latter", what will be destination of unzipping? If it is some temp folder, this is not far better then node-webkit approach.

    Is it possible to concatenate resources without compressing so you don't have to unpack them anywhere?

  7. zcbenz commented on May 8, 2014

    @zcbenz
    Contributor

    If it is some temp folder, this is not far better then node-webkit approach.

    The destination of unzipping is some temporary directory, and this is exactly the node-webkit approach, it is just in node-webkit the package system is implemented with C++ and the progress of unzipping is hidden from users.

    Is it possible to concatenate resources without compressing so you don't have to unpack them anywhere?

    In theory, yes, but with lots of efforts. And concatenating all resources to executable would make things slower because operating system need to read the whole executable into memory.

    Support packaging resources into an external file is what I plan to implement, if what you want is to hide source code from users and read resources without unpacking, it should be enough.

  8. YurySolovyov commented on May 8, 2014

    @YurySolovyov
    ContributorAuthor

    Ok, thanks, better than nothing.

  9. YurySolovyov commented on May 8, 2014

    @YurySolovyov
    ContributorAuthor

    If I understood you correctly, there will be executable, and resource container, so when app starts, it will look for resources there, right? no packing/unpacking?

  10. zcbenz commented on May 9, 2014

    @zcbenz
    Contributor

    Almost yes, except that developers still need to pack the resources into one file.

  11. kevyworks commented on May 18, 2014

    @kevyworks

    I think the .pak file is fine imho, just don't forget to emit app.on("unpacking") so that we can have the ability to show something while it is doing so.

    or is the hierarchy of the app events like this?
    -> will-finish-launching
    -> ready

  12. YurySolovyov commented on May 18, 2014

    @YurySolovyov
    ContributorAuthor

    I was trying to say that packing in terms off splitting runtime and resources is fine (e.g. external file with resources). Problem with packing is in terms of compressing (zip files, archives of any type). This is problematic because it requires some temporary directory to unpack to, and clean-up after app closes.

    If that would be the case in future, events should not be changed I think, because there is no additional unpacking phase.

  13. 16 remaining items

  14. bwin commented on Jan 30, 2015

    @bwin
    Contributor

    @reggi: the average person can't look into these files (don't confuse this with security of any kind) and it can speed up installation (because you have a lot less files). Also there are plans for an atom-shell-runtime and this would (edit: probably) be the app-format of choice.

  15. reggi commented on Jan 30, 2015

    @reggi

    @bwin Is there any way to hide my source code? I have a package.json with a github token in it that points to a private libs repo for my app, something like this. I'd have to remove stuff this before the app gets released publicly and thats a bummer.

    "package-name": "git+https://<github_token>:[email protected]/<user>/<repo>.git"
    
  16. bwin commented on Jan 30, 2015

    @bwin
    Contributor

    First thing I can think of right now, would be a grunt (or gulp or whatever) task, that replaces this line before release. (You would have to make a copy of your working dir for releases to not overwrite your "original" package.json; I would anyway suggest a release-dir).

    About encryption: since the encrypted file has to be decrypted on the user's machine, the key/password would also have to be on the users machine. So having this info even in an encrypted state would still be dangerous. So maybe stripping this info beforehand is the better solution.
    (Also your "secret" file could end up in the users temp dir ...)
    (edit: Also IMO this auth info doesn't belong on a users machine. Encrypted or not. You're never npm installing on a user's machine anyway.)

    Edit: I'm not sure (never had private lib dependencies), but wouldn't ssh access to github with a key also solve your problem? (But maybe you just don't want that.)

  17. anaisbetts commented on Jan 30, 2015

    @anaisbetts
    Contributor

    and it can speed up installation (because you have a lot less files)

    On WIndows this is most likely a huge benefit, file operations on Windows are much slower than on Linux (because Windows supports way more features); writing 10000 1KB files is going to be orders of magnitude slower than writing one 10MB file, even though it's the same amount of data.

  18. thedaniel commented on Jan 30, 2015

    @thedaniel
    Contributor

    Doing a ton of file reads to load a large JS app is also a performance killer. One of our startup time speedup strategies in Atom involves concatting files for this reason.

  19. bmeck commented on Jan 30, 2015

    @bmeck

    I'd love to get on a call about this as it is a different format than my archive loader and we can discuss things. Particularly I have concerns with implementing a fake fs module that is not fully featured/compatible.

    I can be awake during Asia's daylight hours if that helps.

  20. YurySolovyov commented on Feb 23, 2015

    @YurySolovyov
    ContributorAuthor
    1. It is already mentioned that it is enough to prevent just average person messing with code. it is just handy, and you should not rely on that for security. 100% agree with you here.
    2. When somebody says asar gives performance increase, I think they refer to faster reads for large number of files, not faster read of one big resource. Though, I'm not I got it right. /cc @zcbenz
    3. As docs states, asar archives are indeed read-only, so yeah, for auto-update you have to re-create them yourself.
    4. not sure what you mean.

    I mostly agree with you, asar could be better, but hey, we need to start somewhere.
    Possibly related: #673

  21. YurySolovyov commented on Feb 23, 2015

    @YurySolovyov
    ContributorAuthor

    3 Looking at asar archive structure, I think yes, you need files to be on disk at archive creation time, so yes, if you want to convert github release .zip into .asar, you need to do it manually, which, I agree, is not great.

  22. YurySolovyov commented on Feb 23, 2015

    @YurySolovyov
    ContributorAuthor

    I am also thinking if monkey-patching node's fs module for transparent .asar support was a good idea, isn't it better to have separate asar-fs module to deal with asar-related tasks? It can be smaller and easier to maintain, and add features incrementally. ATM fs module can be treated as asar-fs (with known limitations), and node's fs is original-fs. Maybe it is just me, but it seems weird.

  23. added 2 commits that reference this issue on May 9, 2017
  24. added a commit that references this issue on Jul 6, 2017
  25. smallscript commented on Feb 28, 2021

    @smallscript

    Except that ZIP does support all the above, is extremely efficient for random access, does have symlinks, custom attrs, and zillions of tools that support that. I use it all the time for the exact use case you're describing including having it utilize a binary search to locate files, directories etc with NO requirement to pre-sort on load. ZIP can be located any position within a binary (front, middle, back). That, and sqlite together are components of EFS supporting versioning, replication, and single binary deployment.

    Use with "https://github.com/richgel999/miniz" for efficient single file "C" (or has a header only) implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions