This repository contains all the front-end code to the Williams Student Online web-app. Core technologies include React (built with Vite), Redux, and Router5. If you're interested in learning more about React and Redux, we recommend this tutorial.
- Production Build: https://wso.williams.edu/
- Development Build: https://wso-dev.williams.edu/
Interested in the back-end instead? Head over to our backend wso-go repository.
We would love to hear from you and discuss them. File an issue here with one of the templates, and our developers will get back to you shortly!
Steps for a 10/10 development workflow:
- Notice an issue/feature and create a GitHub issue, or assign yourself to one.
- Checkout a feature branch: the name should be something like
feature/YOUR-FEATURE-HERE. - Write the code and accompanying tests.
- Use stacked pull requests to split large changes into multiple reviewable chunks.
- Make a pull request and link your original issue.
- The pull request will be automatically tested, with results displayed in a pinned comment on your PR. More detailed logs are available under Actions.
- After approval, add the PR (or stack) to the merge queue. After a few minutes, it should be live on our dev server!
- (optional) After extensive testing on wso-dev.williams.edu, when you feel your changes are ready for the broader Williams user base, run
make sync-prodto open a[DEPLOY]PR. By default, this will synchronize prod to the latest commit on remote master, though you can also point it to a different commit SHA (e.g. for rollbacks). To deploy to prod, we update a file which essentially points to the version of WSO that will be live on our main server. Note that this process may also pull in unrelated changes; as a result, you may find that admins mostly end up doing this step for you.
1) Check for your Node version
$ node -v
If the above command results in an error, download the latest Node version here.
2) Check for your Yarn version
$ yarn -v
If the above command results in an error, download the latest Yarn version here.
3) Clone the repo into your working directory
$ git clone git@github.com:WilliamsStudentsOnline/wso-react.git
4) Install the necessary dependencies
$ yarn
You should be all set! To get started, run
$ yarn start
to launch a development build, which includes Hot Module Reload(HMR), where changes you make will be instantly reflected without having to restart the server. Open http://localhost:3000 to view it in the browser.
5) Communicating with the Backend
By default, the development server will communicate with wso-dev.williams.edu. This is fine for most frontend-focused development!
However, you may wish to set up the backend to allow our client to get the information from a local server. To do so, set up the backend as per the instructions in the wso-go repository, and run the wso-go server alongside the React development server. If you're working in VSCode, you should see ports :8080 (backend) and :3000 (frontend) in use on your machine. You should then change apiProxy in vite.config.mjs to point to localhost:8080 (instead of wso-dev) to access your local development backend.
The dev-server proxy in vite.config.mjs enables all HTTP requests to be made to /path/to/endpoint without further settings--so don't worry about changing URL paths!
To pull in a new version of our API, run
# interactive
yarn codegen
# manual
yarn codegen --tag vYYYY.MM.DD
yarn codegen --latestTo aid in your development process, we also suggest installing the following:
- React Developer Tools (Chrome, Firefox)
- Redux DevTools
- Configuring Prettier to work with your editor. We have a pre-commit hook which automatically formats your code before commit so that the repo will have consistent formatting, but it is helpful to know how to configure Prettier to format your code on save so it looks nice as you're typing it up!
- Configuring ES-Lint to work with your editor. Like Prettier, we have a pre-commit hook to ensure that your code fits our standards, but unlike the Prettier hook, the commit will fail if there are errors, so it will help your development loop if it is configured with your editor.
Styling is currently done via vanilla CSS. Edit existing stylesheets or, for larger features, create new ones, and make sure to include them in the appropriate .tsx/.jsx files. If you add a color, it must go into Colors.css, otherwise you will feel the weight of your heavy karmic debt forever and ever for the sin of having broken the dark theme. Ignore this warning only at your own peril!