Skip to content

Commit

Permalink
Fix tsconfig stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
sodic committed Oct 9, 2024
1 parent 67f1f9e commit 522e131
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions waspc/src/Wasp/Project/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ module Wasp.Project.Common
nodeModulesDirInWaspProjectDir,
srcDirInWaspProjectDir,
extPublicDirInWaspProjectDir,
tsconfigInWaspProjectDir,
prismaSchemaFileInWaspProjectDir,
getSrcTsConfigInWaspProjectDir,
tsConfigInWaspLangProject,
)
where

Expand Down Expand Up @@ -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|]
Expand All @@ -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) ->
Expand Down
4 changes: 2 additions & 2 deletions waspc/waspls/src/Wasp/LSP/ExtImport/ExportsCache.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 522e131

Please sign in to comment.