Skip to content

Commit c15d703

Browse files
committed
Remove ext-src leftovers in code
1 parent ccb7c63 commit c15d703

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

waspc/data/Generator/templates/react-app/tsconfig.node.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"allowSyntheticDefaultImports": true,
99
},
1010
"include": [
11-
"vite.config.ts",
12-
"./src/ext-src/vite.config.ts"
11+
"vite.config.ts"
1312
]
14-
}
13+
}

waspc/src/Wasp/Generator/ExternalCodeGenerator/Common.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ module Wasp.Generator.ExternalCodeGenerator.Common
33
)
44
where
55

6-
-- todo(filip): Where should I put this?
6+
-- TODO: (filip) Where should we put this?
77
-- TODO: consider refactoring the usage of GeneratedExternalCodeDir since
8-
-- generated code might end up in multiple places (e.g. ext-src/ but also public/).
9-
-- Name should probably be narrowed down to something that represent only the ext-src/
10-
-- directory. Maybe GeneratedExtSrcDir?
8+
-- generated code might end up in multiple places (e.g. src/ but also public/).
9+
-- Name should probably be narrowed down to something that represents only the
10+
-- src/ directory. Maybe GeneratedExtSrcDir?
1111

12-
-- | Path to the directory where ext code will be generated.
12+
-- | Path to the directory where we generate the external user code.
1313
data GeneratedExternalCodeDir

waspc/src/Wasp/Generator/ServerGenerator/JsImport.hs

+5-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ extImportToJsImport ::
5252
JsImport
5353
extImportToJsImport = GJI.extImportToJsImport serverExtDir
5454
where
55-
-- filip: Instead of generating the ext-src folder with the user's code and referencing that, we reference user code directly.
56-
-- This gives us proper error messages (with user's file names and line numbers).
57-
-- It works great with Vite (Vite outputs absolute file paths), but less great on the server (TS outputs relative paths, resulting in ../../src/something)
55+
-- NOTE: Instead of generating the `src` folder with the user's code and
56+
-- referencing that, we reference user code directly. This gives us proper
57+
-- error messages (with user's file names and line numbers). It works great
58+
-- with Vite (Vite outputs absolute file paths), but less great on the
59+
-- server (TS outputs relative paths, resulting in ../../src/something).
5860
serverExtDir = [reldirP|../../../../src|]

waspc/test/Generator/JsImportTest.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Wasp.JsImport as JI
1212
spec_GeneratorJsImportTest :: Spec
1313
spec_GeneratorJsImportTest = do
1414
describe "extImportToJsImport" $ do
15-
let pathToExtCodeDir = [SP.reldirP|ext-src|] :: (Path Posix (Rel ServerSrcDir) (Dir GeneratedExternalCodeDir))
15+
let pathToExtCodeDir = [SP.reldirP|src|] :: (Path Posix (Rel ServerSrcDir) (Dir GeneratedExternalCodeDir))
1616
pathFromImportLocationToExtCodeDir = [SP.reldirP|../|]
1717
extImport =
1818
ExtImport
@@ -22,7 +22,7 @@ spec_GeneratorJsImportTest = do
2222
it "makes a JsImport from ExtImport" $ do
2323
extImportToJsImport pathToExtCodeDir pathFromImportLocationToExtCodeDir extImport
2424
`shouldBe` JI.JsImport
25-
{ JI._path = JI.RelativeImportPath [SP.relfileP|../ext-src/folder/test.js|],
25+
{ JI._path = JI.RelativeImportPath [SP.relfileP|../src/folder/test.js|],
2626
JI._name = JsImportModule "test",
2727
JI._importAlias = Nothing
2828
}

waspc/test/JsImportTest.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ spec_JsImportTest = do
5050
`shouldBe` ("import test from '" ++ generatedImportPathForModuleImportPath ++ "'", "test")
5151
where
5252
testRelativeImportPath :: JsImportPath
53-
testRelativeImportPath = RelativeImportPath $ [SP.reldirP|ext-src|] </> [SP.relfileP|folder/test.js|]
53+
testRelativeImportPath = RelativeImportPath $ [SP.reldirP|src|] </> [SP.relfileP|folder/test.js|]
5454

55-
generatedImportPathForRelativeImportPath = "./ext-src/folder/test.js"
55+
generatedImportPathForRelativeImportPath = "./src/folder/test.js"
5656

5757
testModuleImportPath :: JsImportPath
5858
testModuleImportPath = ModuleImportPath [SP.relfileP|wasp/server/api|]

0 commit comments

Comments
 (0)