This app is composed of three main sections:
- Generator
- Located in the
Generator
directory.
- Located in the
- Client
- Located in the
packages/client
directory.
- Located in the
- Server
- Located in the
packages/server
directory.
- Located in the
The Generator takes in settings and uses an algorithm to place items. The Generator also handles creating GCI file data. It is written in C#.
The Client is the client-side of the website. It is written in JS, CSS, and HTML.
The Server is the backend of the website. It is written in TypeScript.
For local development, you will need the following:
- Node (runs JS code)
- Yarn (JS package manager)
- dotNET (for Generator C# code)
If you need to interact with the deployment process, you will also need Docker. After completing the rest of this document, see docker.md for further instructions.
Install the latest LTS version of Node.
- Set
corepack manager
to "Entire feature will be unavailable" (do not install it). - You can leave the C/C++ modules part unchecked.
- Complete the Node installation.
Note: We leave corepack unchecked because it can cause problems, but if you already use it and have access to Node and Yarn, then you can skip these steps for Node and Yarn.
Install Yarn with the following command:
npm install -g yarn
Ignore any warnings about config global being deprecated. We will never use npm again, so it is not important.
You should now be able to run yarn
commands in command lines.
Note: You may need to open a new command line for yarn
to be available.
The backend of the generator code runs on dotnet
version 8.0
the SDK can be downloaded here
Run yarn
in the root directory of the repository.
This will install all javascript dependencies.
// TODO: Add better instructions for C# here
The Generator can be worked on by itself without going through the website.
If you need the Generator to be available to the server, you will need to build it after any changes.
Currently, I am doing this by putting a breakpoint near the start of the Program.cs file, then stopping the Generator once the breakpoint is hit. There is probably a way to just build the C# code with a single command, but I don't know it at the moment.
Here is a crappy configuration you can use in VSCode for this:
During development, the server is run by nodemon
.
Nodemon will watch for changes to files, and it will restart the server after any changes to server files.
Its output will also display any TypeScript errors, and it will display output which we print to the console.
The recommended steps for running the server are:
- Open a new command line.
- From the root directory, run
yarn server:debug
.
This will start the server, and you will be able to attach to it to debug with breakpoints (more on this later).
The website will be accessible at http://localhost:3500
.
Using VSCode, you can attach to the server with the following debug configuration:
{
"name": "Attach to server",
"port": 9229,
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"type": "pwa-node",
"restart": true
}
You can also start the server with command yarn server:debug-b
.
This will start the server, but it will pause immediately and wait for you to connect a debugger before continuing.
This is handy if you need to put a breakpoint near the very start of execution.
Note: This section will change after the client-side code is restructured in an update coming soon.
Assuming you are just making changes to existing client code, you can make a change to the file, then reload the page in your browser.
VSCode is the recommended tool for development.
In order to match the formatting, you should install the Prettier extension (the one with over 30 million installs): https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
- Prettier will format several file types for you, including HTML, JS, JSON, and Markdown.
- The
.prettierrc.json
file at the root of the repository defines the settings for Prettier.
For formatting CSharp code, you should install CSharpier: https://marketplace.visualstudio.com/items?itemName=csharpier.csharpier-vscode
It is based on Prettier, hence the name.
See docker.md for instructions on deploying a production build.