Introduce frontend build system using npm, Parcel and TypeScript #1565
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since the
sitebinary is now self-contained (and soon will be published on CI via nightly releases), we can now add some basic frontend tooling to make it easier to change the perf.RLO UI in the future.This PR adds a
npmproject (which is required to use common modern frontend technologies) and enables the use of TypeScript in UI components using theParcelbundler. I wanted to use only TypeScript at first, but it cannot bundle.vuesingle file components, which we will hopefully use to author the UI components, out of the box. And we will also want to bundle at least (S)CSS, so I chose to use a build system. Parcel doesn't require any configuration, is fast, works pretty much out of the box and very easily allows to build the app into multiple components (which is very useful, because the UI site will be a multi-page application, not a single-page application). I tried several other bundlers, but didn't encounter anything else that would have all these properties.Currently the transpilation step from TypeScript assumes ES2015, and e.g. keeps
asyncfunctions andawaitin the output. I was a bit worried about this, but then I realized that browsers have supported these things for a long time now.. so it should be fine. If there would be some problem, we can always switch back to a polyfill.(Btw the actual diff is like 150 lines of code, most of the added lines is just the
npmlockfile 😅).