documented config better, add-game-entry has option to call build-config.js (resolves #295 on github)

This commit is contained in:
avsc-sid
2025-12-08 16:47:48 -05:00
parent 55125b473e
commit 018d79a72b
2 changed files with 20 additions and 2 deletions
+6 -1
View File
@@ -81,7 +81,12 @@ This is why the script `add-game-entry.js` was created, an easy way to add a new
# For this demonstration bun will be used as dependencies are automatically installed
bun add-game-script.js
# Answer the prompts that follow and the configuration will be updated
# If you said 'N(o)' to rebuilding the config, then you need to run the following command before the site can find the game
bun build-config.js
```
As `add-game-script.js` is built to work with alphanumerically-ordered lists, expect unintended behavior if the games list is not alphanumerically sorted.
Additionally, **do not** manually edit the `js/config.js` file. That is generated by the `build-config.js` script based off of `config.jsonc`. **Any changes to `js/config.js` will be overwritten.**
#### Themes
@@ -89,7 +94,7 @@ Theme standard not implemented yet (TODO)
#### Proxy
Proxy configuration options are under the **"config"** key.
Proxy configuration options are under the **"config"** key.
The value for key `"proxy"` is a boolean value that enables or disables the proxy function. If `"proxy"` is set to false, then the user will be greeted with an error dialog when attempting to access the proxy.
The value for key `"proxyPath"` is the path to the proxy. It can be an absolute path or a relative path, but the proxy must support **CORS** as the proxy page will be displayed as an iframe on the site.
+14 -1
View File
@@ -1,6 +1,7 @@
import { exit } from 'process';
import { fork } from 'child_process'
import { readFileSync, existsSync, writeFileSync } from 'fs';
import { input } from '@inquirer/prompts';
import { input, confirm } from '@inquirer/prompts';
if (!existsSync('config.jsonc')) {
console.log('config.jsonc not found! Are you in the right directory?');
@@ -102,5 +103,17 @@ if (!existsSync('config.jsonc')) {
writeFileSync('config.jsonc', jsonc);
console.log('Saved to config.jsonc!');
const shouldRebuildConfig = await confirm({ message: 'Do you want to rebuild the config now? (the site will not see the game until you do this)' });
if (shouldRebuildConfig) {
if (!existsSync('build-config.js')) {
console.log("`build-config.js` not found! Are you in the right directory?");
} else {
fork("build-config.js");
};
}
exit(0);
})();