From 9a67c12cb36098450f0b275ec13a5ec28e90e67f Mon Sep 17 00:00:00 2001 From: Helder Oliveira Date: Mon, 4 Nov 2024 13:15:23 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Sites=20save=20configurat?= =?UTF-8?q?ion=20path=20resolution=20(#64)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Why? Save configuration revision ## How? - Fix configuration template path ## Tickets? - [PLAT-1728](https://linear.app/fleekxyz/issue/PLAT-1728/save-configuration-paths-for-js-and-ts) - ## Contribution checklist? - [ ] The commit messages are detailed - [ ] The `build` command runs locally - [ ] Assets or static content are linked and stored in the project - [ ] You have manually tested - [ ] You have provided tests ## Security checklist? - [ ] Sensitive data has been identified and is being protected properly - [ ] Injection has been prevented (parameterized queries, no eval or system calls) ## Preview? Optionally, provide the preview url here --------- Co-authored-by: GitHub Action --- src/utils/configuration/saveConfiguration.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/utils/configuration/saveConfiguration.ts b/src/utils/configuration/saveConfiguration.ts index 942594b..e33a040 100644 --- a/src/utils/configuration/saveConfiguration.ts +++ b/src/utils/configuration/saveConfiguration.ts @@ -22,15 +22,22 @@ export type SaveConfigurationArgs = { type ConfigFilePath = string; +const DEV_SRC_UTILS_PATH = '/src/utils'; +const basePath = path.dirname(__filename).includes(DEV_SRC_UTILS_PATH) + ? '../..' + : ''; + const filePathForTypescriptConfig = path.resolve( path.dirname(__filename), - '../../templates/sites/config', + basePath, + 'templates/sites/config', getConfigTemplateByTypeName('Typescript'), ); const filePathForJavascriptConfig = path.resolve( path.dirname(__filename), - '../../templates/sites/config', + basePath, + 'templates/sites/config', getConfigTemplateByTypeName('Javascript'), );