From 522e13163765a04d7945baa6438deb854979ff34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Sodi=C4=87?= Date: Wed, 9 Oct 2024 13:27:35 +0200 Subject: [PATCH] Fix tsconfig stuff --- waspc/src/Wasp/Project/Common.hs | 16 ++++++++++------ .../src/Wasp/LSP/ExtImport/ExportsCache.hs | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/waspc/src/Wasp/Project/Common.hs b/waspc/src/Wasp/Project/Common.hs index 8fb6c6f21f..25b9496c18 100644 --- a/waspc/src/Wasp/Project/Common.hs +++ b/waspc/src/Wasp/Project/Common.hs @@ -21,9 +21,9 @@ module Wasp.Project.Common nodeModulesDirInWaspProjectDir, srcDirInWaspProjectDir, extPublicDirInWaspProjectDir, - tsconfigInWaspProjectDir, prismaSchemaFileInWaspProjectDir, getSrcTsConfigInWaspProjectDir, + tsConfigInWaspLangProject, ) where @@ -87,10 +87,17 @@ dotWaspInfoFileInGeneratedCodeDir = [relfile|.waspinfo|] packageJsonInWaspProjectDir :: Path' (Rel WaspProjectDir) (File PackageJsonFile) packageJsonInWaspProjectDir = [relfile|package.json|] +-- TODO: The entire tsconfig story is very fragile getSrcTsConfigInWaspProjectDir :: WaspFilePath -> Path' (Rel WaspProjectDir) (File SrcTsConfigFile) getSrcTsConfigInWaspProjectDir = \case - WaspTs _ -> [relfile|tsconfig.src.json|] - WaspLang _ -> [relfile|tsconfig.json|] + WaspTs _ -> tsConfigInWaspTsProject + WaspLang _ -> tsConfigInWaspLangProject + +tsConfigInWaspLangProject :: Path' (Rel WaspProjectDir) (File SrcTsConfigFile) +tsConfigInWaspLangProject = [relfile|tsconfig.json|] + +tsConfigInWaspTsProject :: Path' (Rel WaspProjectDir) (File SrcTsConfigFile) +tsConfigInWaspTsProject = [relfile|tsconfig.src.json|] packageLockJsonInWaspProjectDir :: Path' (Rel WaspProjectDir) File' packageLockJsonInWaspProjectDir = [relfile|package-lock.json|] @@ -104,9 +111,6 @@ srcDirInWaspProjectDir = [reldir|src|] extPublicDirInWaspProjectDir :: Path' (Rel WaspProjectDir) (Dir SourceExternalPublicDir) extPublicDirInWaspProjectDir = [reldir|public|] -tsconfigInWaspProjectDir :: Path' (Rel WaspProjectDir) File' -tsconfigInWaspProjectDir = [relfile|tsconfig.json|] - findFileInWaspProjectDir :: Path' Abs (Dir WaspProjectDir) -> Path' (Rel WaspProjectDir) (File f) -> diff --git a/waspc/waspls/src/Wasp/LSP/ExtImport/ExportsCache.hs b/waspc/waspls/src/Wasp/LSP/ExtImport/ExportsCache.hs index dba605eca6..abb7f75ced 100644 --- a/waspc/waspls/src/Wasp/LSP/ExtImport/ExportsCache.hs +++ b/waspc/waspls/src/Wasp/LSP/ExtImport/ExportsCache.hs @@ -22,7 +22,7 @@ import Wasp.LSP.ExtImport.Path (WaspStyleExtFilePath, absPathToCachePath, cacheP import Wasp.LSP.ExtImport.Syntax (ExtImportNode (einName, einPath), getAllExtImports) import Wasp.LSP.ServerMonads (HandlerM, ServerM, getProjectRootDir, handler, modify) import qualified Wasp.LSP.ServerState as State -import Wasp.Project.Common (tsconfigInWaspProjectDir) +import Wasp.Project.Common (tsConfigInWaspLangProject) import qualified Wasp.TypeScript.Inspect.Exports as TS -- | Based on the files imported in the external imports of the current concrete @@ -63,7 +63,7 @@ refreshExportsOfFiles files = do getExportRequestForFile projectRootDir file = TS.TsExportsRequest { TS.filepaths = [SP.fromAbsFile file], - TS.tsconfig = Just $ SP.fromAbsFile $ projectRootDir tsconfigInWaspProjectDir + TS.tsconfig = Just $ SP.fromAbsFile $ projectRootDir tsConfigInWaspLangProject } -- Replaces entries in the exports cache with the exports lists in the