You will need Node.js installed. Install dependencies via npm install/npm i.
Successful compilation requires some generated types, as these are used to provide type safety for unique constraints and other features. However, the project needs to be built first to be able to generate the types. Since TypeScript compiles even with errors, you will need to build first, then generate the types, and then build a second time with the generated types.
- Build TypeScript:
npm run build - Generate Types:
npm run generate
Generated files will be saved to the /gen folder; compiled JavaScript files will be saved to the /lib folder.
You can also watch for changes when you are working on the schema. For this, there are two commands you can run in parallel. You do not need to care about build passes in that case, as the watcher processes will take care of it.
- Watch TypeScript:
npm run watch - Watch Generate Types:
npm run generate:watch
In order to test changes with the actual database, one approach could be to install the schema as a local npm package in the database. To do so, go to your local database copy and run npm i ../path/to/schema, where you just point to your local working copy of the database schema repository (the one this document belongs to).
Make sure to always restart the editor when you make changes, as the database schema is not automatically reloaded. If the editor UI does not update properly, try resetting the browser cache by holding shift while reloading the page.
If you create branches in this repository, use either feature/<topic> or fix/<topic> as the branch name and replace <topic> with a kebab case version of what the branch is going to do. Branches are merged using squash merge, so commits within a pull request do not have to follow any naming convention, just do what you can work with best.
Alternatively, you can fork the repository and create pull requests from there.
If you add new entities, there are some additional steps to take.
- Add the corresponding identifier to the
src/types/_Identifier.tsfile. Just duplicate an existing one, adjust the referenced entity at the end and make sure the variable/function name is the entity name plusIdentifierand is inserted into the list of identifiers in alphabetical order. - Check
src/types/_IdentifierGroup.tsif you need to add the entity to any existing identifier group. For example, if you add another special ability entity, add it to theSpecialAbilityIdentifiergroup; if it is a combat-related special ability, add it to theCombatRelatedSpecialAbilityIdentifiergroup as well. - If it is not a child entity: Export the entity declaration alone from
src/types/index.ts. - If it is not a child entity: Add the entity declaration to the schema definition in
src/main.tsin alphabetical order.
This repository makes use of linting via ESLint and formatting via Prettier. It can be helpful to use available editor extensions when contributing to fix errors before they appear in your PR. Formatting and linting is checked for every pull request and must succeed in order to be able to accept your PR.