This readme covers the typescript environment used to create client-side javascript.
💡 For the webserver and API definitions, look at
sjautobidder/webserver.py
The frontend is written in Typescript, which is a typed superset of javascript. Typescript compiles down to javascript (including optimizations) for the browser. Rollup is used to compile all generated javascript into one bundle file, to save on space, and package all dependencies. Rollup also performs it's own optimizations, including branch-shaking (removing unused code).
The GUI components used for the frontend is Shoelace. These are not served with the bundled javascript.
- You must have already installed Node.js (includes npm)
- Navigate to the webpage folder (this folder)
- Run
npm install -g yarn
to install Yarn globally - Run
yarn
to install required dependencies. - Use the following command to compile typescript, and then use rollup to
create bundles:
yarn run tsc; yarn run rollup -c
- You should now have an updated
js/index.js
containing your new code. - Use the webserver to access the website
- Make sure you have a working python development environment for this project
- Host the webserver
- Use
python sjautobidder/webserver.py
- Or Use the Docker container (involved needing to network containers)
- Or use gunicorn (linux only, take a look at the docker startup script)
- Use
- Navigate to the website with your browser
💡 Compiling typescript may throw up errors, however, typescript is designed to always compile, and so it will still produce a result. We Highly Recommend reading any error output.
Linting is ran via ESlint. It is recommended to use an IDE that supports this for automatically linting as you go.
Comments are linted in according to (TSDoc)[https://tsdoc.org/]