From 23994a6587a655f923ad0997ac7dba37a61a9d6d Mon Sep 17 00:00:00 2001 From: BluJ Date: Tue, 2 May 2023 15:00:58 -0600 Subject: [PATCH] feat: The write in the config will now tell if we need a restart --- lib/config/setupConfig.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/config/setupConfig.ts b/lib/config/setupConfig.ts index 05263e7..bc6c00a 100644 --- a/lib/config/setupConfig.ts +++ b/lib/config/setupConfig.ts @@ -20,7 +20,10 @@ export type Save< input: ExtractConfigType & Record utils: Utils dependencies: D.Dependencies -}) => Promise +}) => Promise<{ + dependenciesReceipt: DependenciesReceipt + restart: boolean +}> export type Read< WD, A extends Record | Config, any>, @@ -52,12 +55,15 @@ export function setupConfig< await effects.console.error(String(validator.errorMessage(input))) return { error: "Set config type error for config" } } - await write({ + const { restart } = await write({ input: JSON.parse(JSON.stringify(input)), effects, utils: utils(effects), dependencies: D.dependenciesSet(), }) + if (restart) { + await effects.restart() + } }) as ExpectedExports.setConfig, getConfig: (async ({ effects }) => { const myUtils = utils(effects)