diff --git a/README.md b/README.md index dcce85fe..21df99ec 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/add-game-entry.js b/add-game-entry.js index 732c1d2c..27f5dddc 100644 --- a/add-game-entry.js +++ b/add-game-entry.js @@ -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); })();