From 6d48aa001a520c23ec1473fb322e91de84dbaec5 Mon Sep 17 00:00:00 2001 From: Martin Koerwien <martin.koerwien@fokus.fraunhofer.de> Date: Fri, 28 Jun 2024 11:32:12 +0200 Subject: [PATCH] fix: docs and disable omitting workspace name --- CONTRIBUTING.md | 12 +++++++----- scripts/config-handling/createRuntimeConfig.ts | 9 +++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 72bad5b98..449f76d4c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -190,13 +190,15 @@ Below is an outline of steps to do when modifying the schema: 2. Add/modify/remove the keys as appropriate, following the same pattern as the other key schemas whenever possible. Consider marking new keys as optional by appending `.default(DEFAULT_VALUE)`. This helps reducing the amount of mandatory keys 3. When committing the changes, don't forget to mark the changes as a breaking change as per the commit message guidelines. -### Generate a runtime-config file +### Handling runtime-config and user-config files in apps -The Zod configuration is the single point of truth for the environment variable structure. There is a script which -can generate runtime-config.js files from the Zod schema and integrate it into the config folder of a Vue app: +The Zod configuration is the single point of truth for the environment variable structure. This script: ``` -npm run create-runtime-config <workspace-name> +npm run check-config <workspace-name> ``` -If `<workspace-name>` is omitted, runtime-config.js files will be created in all app workspaces. +first validates the file config/user-config.sample.js against the Zod schema +and prints out all issues. Second, it checks any issues of config/runtime-config.js +and if there are any, offers to generate a correct version of that file that +overwrites the existing one. diff --git a/scripts/config-handling/createRuntimeConfig.ts b/scripts/config-handling/createRuntimeConfig.ts index 043e0bb8a..60c097191 100644 --- a/scripts/config-handling/createRuntimeConfig.ts +++ b/scripts/config-handling/createRuntimeConfig.ts @@ -42,10 +42,11 @@ export function createRuntimeConfig(workspaceName) { if (workspaceName) { pathByWorkspaceName(workspaceName).then(filePath => createSingleRuntimeConfig(filePath, configObject, config)); } else { - doForApps((file: string, stats: Stats, folder: string) => { - // createSingleRuntimeConfig(`${folder}/${file}`, configObject, config) - writeRuntimeConfig(`${folder}/${file}/config/runtime-config.js`, config); - }); + console.log("Please provide workspace name!") + // doForApps((file: string, stats: Stats, folder: string) => { + // // createSingleRuntimeConfig(`${folder}/${file}`, configObject, config) + // writeRuntimeConfig(`${folder}/${file}/config/runtime-config.js`, config); + // }); } } -- GitLab