Add website version in index
abashmak opened this issue · 3 comments
Not sure how feasible this is, but it would be cool to embed a hidden field in the generated index.html with the current build version. Obviously it can be done manually, but is there a way to have it auto-populated?
What's the point of having it hidden?
The site should really have a link somewhere to the Github repository. Following the link, anyone could easily take a peek at package.json
and find out version. This would basically work the same as a hidden version.
If you actually do want to show the version, it's pretty easy to make a request to get the package.json
and to parse out the version. Then you can easily bind it to the property of a component and display it.
We could also introduce a custom script during the prod build that would do the steps from above and put the result into a local file, say version.json
. Then the component would simply read from that file.
But then again, why bother if it's hidden and you can simply include a link to Github repo?
Github repo may not reflect what's in production, especially if someone clones it downstream and modifies it. So it must be embedded locally. I think your suggestion of a script to write out version.json is a good one.
Fixed in master