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

[question] Is there a way to update only a specific file? #3

Closed
CosmoMyzrailGorynych opened this issue Mar 31, 2017 · 11 comments
Closed

Comments

@CosmoMyzrailGorynych
Copy link

If I don't update nw itself, the only file I really need to update is an NW executable with a compressed app in it. Is there an easy way to do so??

@dsheiko
Copy link
Owner

dsheiko commented Mar 31, 2017

To say truth, I didn't think about this. So at the moment it simply downloads an archive from the list of the remote manifest and unpacks it to a temp folder. But I like the challenge, going to think of a possibility to specify explicitly what to take from the archive

@dsheiko
Copy link
Owner

dsheiko commented Apr 24, 2017

Since version 1.1.0 you can set via swapScript option your own swap script like:

rsync -a\${VERBOSE} --delete \${APP_PATH}/. \${BAK_PATH}/
rsync -a\${VERBOSE} \${UPDATE_PATH}/. \${APP_PATH}/package

that copies the downloaded/extracted HTML5 project files in package subfolder in application directory, given your app manually bundled and HTML5 project located in package

@dsheiko dsheiko closed this as completed Apr 24, 2017
@vinaynb
Copy link

vinaynb commented Jul 17, 2017

@dsheiko i am trying to achieve the same thing i.e. update just the html5 project but i don't understand what you mean by specifying the packages sub directory ?
How should the app be packaged and built for this technique to work ? Can you shed a bit more light on this ?

@dsheiko
Copy link
Owner

dsheiko commented Jul 17, 2017

This way it works if you do not bundle updates, but simply compress with zip or tar.gz. Thus updater, downloads the archive, unpack in TMP, takes project directory from there and replaces in the project. On macOS, NW.js app is kind of a folder, so it do it. On Windows/Linux, seems like the project shall not be bundled at all, but simply archived (usually with nw executable rebranded). In fact on Windows it even makes sense as it uncompress the package every time you run it and it takes considerably long time.

@vinaynb
Copy link

vinaynb commented Jul 17, 2017

I am at the moment using nw-builder to build my app.

This way it works if you do not bundle updates, but simply compress with zip or tar.gz.

Do you mean to say that this technique won't work if i bundle my app using the tool i mentioned above ?

@dsheiko
Copy link
Owner

dsheiko commented Jul 17, 2017

What OS do you target?

@vinaynb
Copy link

vinaynb commented Jul 17, 2017

Linux at the moment and Windows eventually. I mean i am developing on linux(ubuntu) right now but my end users are going to be mostly windows.

@vinaynb
Copy link

vinaynb commented Jul 17, 2017

@dsheiko The name of my app is testApp. Now when building with --flavor=sdk there is file named testApp which when executed from bash runs the app (Lets call this build A).

I made changes to code and rebuilt it (let's call this build B).

Now i simply replaced testApp in build A's folder with testApp from build B's folder and my code changes are available in the old build. While this satisfies my idea of updating just a single file which contains my source i don't think this is the correct way. Can you tell us which files contain the application code in the sdk build folder and if just replacing a single file and restarting the app will be the correct way to go about an update ?

@dsheiko
Copy link
Owner

dsheiko commented Jul 17, 2017

Well, nw-builder creates self-extracting executable for Windows, so the updater by default simply replaces that file with the downloaded one - thus it works. But it cannot currently modify the executable for updating let's project folder. At the moment I do not know for sure how to unpack that sort of bundle safely, update the folder and pack it back.

@dsheiko
Copy link
Owner

dsheiko commented Jul 17, 2017

In the nw-autoupdater examples I also refer to SDK version nwbuild -v 0.21.3-sdk , as I want DevTools available in the demo app. The problem again, you get the project sources bundled together with NW.js executable and so it distributes. So to update source one needs to unpack the bundle

@vinaynb
Copy link

vinaynb commented Jul 17, 2017

Filed an issue in nw-builder repo. Posting here just for reference nwutils/nw-builder#460

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

No branches or pull requests

3 participants