Delete old js files when Versioning is used

When one uses the Versioning, it creates a new js file each time it is compiled.
They multiply like rabbits.

Suggestion

  1. Either increase the version only if the code is run
  2. Or delete the previous js file before compiling the new one.

We will reflect on this

Related suggestions.

  1. Seeing that 20 times more compiles are done to check that it compiles (and this increases the version number). Maybe add a menu option to compile without bumping the version,
  2. Is there a way to retrieve the version number of the js file in the client code?

Another blog post for you :blush: There's a section on Version Information showing one way to get the TMS WEB Core version into your project so you can use it.

I need to use the renaming of the js file, otherwise there are caching issues.

Another suggestion.

  • Perhaps only increment the version when a build is done (but not for normal compiles).

Yes, keeping the JS files and their constant revisions is important to ensure that nothing is cached unless nothing changes. Reporting the version number where users can see it (if they want) is a way to help ensure that things are updating. PWAs for example are notorious for not updating even when you think you've done everything right.

I usually have a script of some kind that I use to copy the compiled project for deployment, and in that script I delete all the extras. Likewise on the deployment side, another script is run which optimizes things a bit more and deletes the revisions. It is a process for sure.

Having the different build versions each time is a bit tedious. I'm not entirely sure why TMS didn't reuse the normal Delphi build numbers so we could do a "rebuild all" and get a new number, but it is likely because even in development, having the JS change numbers every time makes debugging them a lot easier due to the same caching issue.

Maybe having TMS build in an option to keep the last three or five or some configurable number would help, but even then you still have to deal with this when you deploy it as the renamed copies will just end up multiplying there if you're not careful.