nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.22k stars 3.88k forks source link

Supply a manifest for available versions #4037

Closed adam-lynch closed 7 years ago

adam-lynch commented 8 years ago

@rogerwang, I could've sworn we spoke somewhere about this before but I can't find it in my email. Hmm, anyway...

The idea is that a JSON file would be hosted somewhere and would contain a list of all available versions, whether it's an alpha build or not, and paths to the platform-specific files.

I'm open to helping in any way I can.

Todo

This would make it a lot easier for other modules to build on top of this. Especially nw-builder which has been getting a few complaints related to this. This is how nw-builder figures out which versions are available right now (roughly, from memory):

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

rogerwang commented 8 years ago

Thanks Adam. Yes we should provide it.

Adam Lynch notifications@github.com于2015年12月6日周日 上午9:19写道:

@rogerwang https://github.com/rogerwang, I could've sworn we spoke somewhere about this before but I can't find it in my email. Hmm, anyway...

The idea is that a JSON file would be hosted somewhere and would contain a list of all available versions, whether it's an alpha build or not, and paths to the platform-specific files.

I'm open to helping in any way I can. Todo

  • Agree on a format.
  • Publish it somewhere.
  • Should be updated when a new version is released. I'm not sure what the release process is like right now but it should be possible to add in this step I'm guessing.
  • Document it. This would be nice so others could easily use it.

Why bother?

This would make it a lot easier for other modules to build on top of this. Especially nw-builder https://github.com/nwjs/nw-builder which has been getting a few complaints related to this. This is how nw-builder figures out which versions are available right now (roughly, from memory):

  • Scrapes http://dl.nwjs.io/ (or somewhere similar) to get a list of versions.
  • Sends a HEAD request to where it exists the Windows 32 ZIP to validate that this version is usable (i.e. isn't an alpha build). This is done because nw-builder's version option defaults to latest.

Issues which arise from this

  • Some people want to build with the alpha build, even if it doesn't have a Windows 32 ZIP.
  • The alpha build has a Windows 32 build which gives a false positive validation and builds might fail then if a different platform's ZIP doesn't exist.
  • The ZIPs filename patterns can change between versions and break nw-builder. This would be fixed by this because each version would have to explicitly point to where each platform's own ZIP is located at.
  • Other issues I can't remember right now.

— Reply to this email directly or view it on GitHub https://github.com/nwjs/nw.js/issues/4037.

adam-lynch commented 8 years ago

Great @rogerwang.

Looking at http://dl.nwjs.io/v0.12.3/), should we include everything here in the manifest? Is it all needed?

Another thing I realised, it would also be good if each versions specified which files its ZIP contains which are required to run it. It would save nw-builder from doing stuff like this.

rogerwang commented 8 years ago

The header file and the libraries files are not needed. Maybe we need to split them into build flavors starting from 0.13. And yes, it's good to include the list of contents.

rogerwang commented 8 years ago

Now there is : http://nwjs.io/versions.json

adam-lynch commented 8 years ago

@rogerwang Thanks! I've a few small comments:

  1. Could we have all versions in versions.json? People definitely use nw-builder with older versions. Or if not all versions then maybe we could agree that the last N versions would always be in there? Then nw-builder could limit support to that many versions back.

2. Would it better to specify the URL to the ZIP? The way it is now, the consumer needs to make assumptions. This way if you guys ever decide to change the name format of the ZIPs (intentionally or accidentally) then no one else's parsing would break. Another option would be to supply a template like https://github.com/nwjs/nw-builder/blob/master/lib/platforms.js#L12. If you were to give older versions (like I ask in point number 1), then this would help with older versions as they might have node-webkit instead of nwjs.

Nevermind, because there are different flavours now, this is too complicated to be worth it.


The header file and the libraries files are not needed. Maybe we need to split them into build flavors starting from 0.13. And yes, it's good to include the list of contents.

I just want to confirm this, to be extra safe. We've had a good few PRs, etc. in nw-builder (& grunt-nw-builder) to alter our handling of the contents inside the ZIPs.

As you can see, this is especially important if versions.json were to contain older versions.

So, if they are needed, then I guess we would need something like this:

files: {
  "win-x64": {
    "url": "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-win-x64.zip",
    "files": ["nw.exe", "exampleA", "exampleB"]
  },
  ... 
}
rogerwang commented 8 years ago

CC @ghostoy who built this file for the official website.

ghostoy commented 8 years ago

@adam-lynch

Following is how to interpret versions.json:

You can composite the URL of NW packages, headers, libs, chromedrivers and symbols from each item listed in versions field.

I think it's ok to reuse it for legacy versions since 0.8.0. However some tricks based on the version should be done when composing the URLs. For example, since 0.12.0, node-webkit is renamed to nwjs. And macappstore flavor is currently only available for 0.12.3 x64 build.

ghostoy commented 8 years ago

@adam-lynch As for the list of files in ZIPs, it's version specific. You can hard code as a list.

ghostoy commented 8 years ago

@adam-lynch For 0.13.0 or later, all files are needed to be redistributed with the app except followings for SDK flavour:

I think it's better to list excluded files instead of included files. What do you think?

arhangelsoft commented 8 years ago

Hello, nice idea :)

Why this issue not closedif it was done?