mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-03 12:28:13 +03:00
* docs: migrate from mkdocs to mdbook - Rename old mkdocs docs/ to old-docs/ for reference - Set up new docs/ with mdbook (book.toml + src/ tree) - Mirror full nav structure from mkdocs.yml into SUMMARY.md - Add Justfile-docs with docs-serve, docs-build, docs-check, docs-install recipes - Import Justfile-docs from root Justfile - Rewrite .github/workflows/docs.yml: build step uses taiki-e/install-action to install mdbook, split into separate build + deploy jobs, PR builds run the check step too * ci(docs): pin actions to SHAs, install mdbook via release binary * ci(docs): install mdbook from apt instead of curling a release binary * dev: replace mkdocs python stack with mdbook in dev image * ci(docs): apt only works on Debian; restore release binary install for Ubuntu CI * docs: fix duplicate file entries in SUMMARY.md * docs: remove docs-install recipe * docs: remove site-url from book.toml to fix asset loading * dev: install mdbook from upstream release binary, not Debian apt The Debian package (0.4.x+ds) strips bundled font assets, leaving the built site without fonts/fonts.css. Use the upstream tarball (same as CI) so the theme is complete. Handles x86_64 and aarch64. * docs: vendor mdbook tarballs in dev/mdbook/, install from there Dockerfile.dev uses COPY + tar to install the right arch at build time. CI extracts the x86_64 tarball directly from the checkout. No network access required for either — and no stripped-fonts Debian package. * fix: unwritten
99 lines
3.3 KiB
Markdown
99 lines
3.3 KiB
Markdown
# Adding Seeds
|
|
|
|
With a [Common Configuration](./common-config/index.md) defined, we know what the songs and charts for this game should look like.
|
|
|
|
Lets load them into the database seeds.
|
|
|
|
## Quick Primer
|
|
|
|
The database seeds are a folder in the monorepo: `seeds/collections`, which contain JSON files.
|
|
|
|
These JSON files contain the state of a lot of our databases that need to be loaded. When changes are made to these seeds and committed to the main repository, a script will automatically apply those changes to the database.
|
|
|
|
!!! info
|
|
For local usage, you can use `pnpm sync-database-local` in the terminal to sync
|
|
the database with your local seeds.
|
|
|
|
## Adding songs and charts
|
|
|
|
If they don't already exist, create new files for `songs-GAMENAME.json` and `charts-GAMENAME.json`. Place `[]` inside those files, as they should be arrays.
|
|
|
|
It's left as an exercise for the reader to source the song and chart data for their game. You will likely need to write your own scripts.
|
|
|
|
Once you've gotten that data, you need to convert it into Tachi's song/chart format.
|
|
|
|
## Writing the files
|
|
|
|
You can modify the JSON files however you want. It really doesn't matter. However, there is a `seeds/scripts/` folder with a bunch of scripts you can use
|
|
to ease this process.
|
|
|
|
For things you only want to run a single time, place the script in the `seeds/scripts/personal` folder.
|
|
For things you want to keep around, place the script in the `seeds/rerunners` folder. Simple.
|
|
|
|
The file `util.js` contains a bunch of miscellaneous utils for helping out, like `CreateChartID` or `MutateCollection`.
|
|
|
|
## What do songs and charts look like?
|
|
|
|
A song in Tachi looks like this:
|
|
|
|
```json
|
|
{
|
|
"altTitles": [],
|
|
"artist": "dj nagureo",
|
|
"data": {
|
|
// the things you defined in GAME_CONFIG.songData go here
|
|
},
|
|
"id": 1,
|
|
"searchTerms": [],
|
|
"title": "5.1.1."
|
|
},
|
|
```
|
|
|
|
For information on what each of these properties mean, see [Song Document](../schemas/song.md).
|
|
|
|
A chart in Tachi looks like this:
|
|
|
|
```json
|
|
{
|
|
// This is a randomly generated 20 byte string.
|
|
// The utility function `CreateChartID` should be used.
|
|
"chartID": "70b80da02a2037d556026b412c386b2fd1e57dbd",
|
|
|
|
"data": {
|
|
// this should be what you defined in GPT_CONFIG.chartData.
|
|
},
|
|
|
|
// If your difficulties are "FIXED", this should be one of the expected difficulties.
|
|
// Otherwise, any string goes here.
|
|
"difficulty": "Green",
|
|
|
|
"level": "3",
|
|
"levelNum": 3,
|
|
|
|
// this should be one of the playtypes for your game.
|
|
"playtype": "Single",
|
|
"songID": 1,
|
|
|
|
// This should be an array of the versions this chart appears in.
|
|
// For more information, see Common Config's Versions documentation.
|
|
"versions": [
|
|
"1.5",
|
|
"1.5-b"
|
|
],
|
|
// See Common Config's Versions documentation.
|
|
"isPrimary": true
|
|
}
|
|
```
|
|
|
|
## Tables and Folders
|
|
|
|
You'll probably want to create at least one table and some folders for your game.
|
|
|
|
There are various utilities for this, like `scripts/rerunners/add-level-version-folders.js` for creating a traditional "Level 1, Level 2, Level 3" kind of table.
|
|
|
|
## Loading the seeds
|
|
|
|
Once you've modified the database seeds, test them with `pnpm test` inside the `seeds/scripts` folder. This will check a bunch of properties about the songs and charts you just made.
|
|
|
|
If they fail, read why and make appropriate changes. If they pass, move to the root of the Tachi repository and run `pnpm sync-database-local`. This will load the changes into your MongoDB instance.
|