mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-29 12:53:32 +03:00
Make server and client fields optional (#2351)
This commit is contained in:
parent
7ef2a34409
commit
01af22f6e3
@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 0.15.1
|
||||
|
||||
### 🐞 Bug fixes
|
||||
|
||||
- Server and Client setup props are no longer mandatory when using TS Config.
|
||||
|
||||
## 0.15.0
|
||||
|
||||
### 🎉 New Features and improvements
|
||||
|
@ -1,6 +1,6 @@
|
||||
app waspBuild {
|
||||
wasp: {
|
||||
version: "^0.15.0"
|
||||
version: "^0.15.1"
|
||||
},
|
||||
title: "waspBuild"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
app waspCompile {
|
||||
wasp: {
|
||||
version: "^0.15.0"
|
||||
version: "^0.15.1"
|
||||
},
|
||||
title: "waspCompile"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
app waspComplexTest {
|
||||
wasp: {
|
||||
version: "^0.15.0"
|
||||
version: "^0.15.1"
|
||||
},
|
||||
auth: {
|
||||
userEntity: User,
|
||||
|
@ -1,6 +1,6 @@
|
||||
app waspJob {
|
||||
wasp: {
|
||||
version: "^0.15.0"
|
||||
version: "^0.15.1"
|
||||
},
|
||||
title: "waspJob"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
app waspMigrate {
|
||||
wasp: {
|
||||
version: "^0.15.0"
|
||||
version: "^0.15.1"
|
||||
},
|
||||
title: "waspMigrate"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
app waspNew {
|
||||
wasp: {
|
||||
version: "^0.15.0"
|
||||
version: "^0.15.1"
|
||||
},
|
||||
title: "waspNew"
|
||||
}
|
||||
|
@ -143,12 +143,18 @@ function mapOperationConfig(
|
||||
|
||||
function mapExtImport(extImport: User.ExtImport): AppSpec.ExtImport {
|
||||
if ('import' in extImport) {
|
||||
return { kind: 'named', name: extImport.import, path: extImport.from };
|
||||
return { kind: 'named', name: extImport.import, path: extImport.from }
|
||||
} else if ('importDefault' in extImport) {
|
||||
return { kind: 'default', name: extImport.importDefault, path: extImport.from };
|
||||
return {
|
||||
kind: 'default',
|
||||
name: extImport.importDefault,
|
||||
path: extImport.from,
|
||||
}
|
||||
} else {
|
||||
const _exhaustiveCheck: never = extImport;
|
||||
throw new Error('Invalid ExtImport: neither `import` nor `importDefault` is defined');
|
||||
const _exhaustiveCheck: never = extImport
|
||||
throw new Error(
|
||||
'Invalid ExtImport: neither `import` nor `importDefault` is defined'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,16 +332,19 @@ function mapEmailSender(
|
||||
function mapServer(server: User.ServerConfig): AppSpec.Server {
|
||||
const { setupFn, middlewareConfigFn } = server
|
||||
return {
|
||||
setupFn: mapExtImport(setupFn),
|
||||
...(setupFn && { setupFn: mapExtImport(setupFn) }),
|
||||
...(middlewareConfigFn && {
|
||||
middlewareConfigFn: mapExtImport(middlewareConfigFn),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
function mapClient(client: User.ClientConfig): AppSpec.Client {
|
||||
const { setupFn, rootComponent } = client
|
||||
const { setupFn, rootComponent, baseDir } = client
|
||||
return {
|
||||
setupFn: mapExtImport(setupFn),
|
||||
rootComponent: mapExtImport(rootComponent),
|
||||
...(setupFn && { setupFn: mapExtImport(setupFn) }),
|
||||
...(rootComponent && { rootComponent: mapExtImport(rootComponent) }),
|
||||
...(baseDir && { baseDir }),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,17 +94,19 @@ export type WaspConfig = AppSpec.Wasp
|
||||
|
||||
export type AppConfig = Pick<AppSpec.App, 'title' | 'wasp' | 'head'>
|
||||
|
||||
export type ExtImport = {
|
||||
export type ExtImport =
|
||||
| {
|
||||
import: string
|
||||
from: AppSpec.ExtImport['path']
|
||||
} | {
|
||||
}
|
||||
| {
|
||||
importDefault: string
|
||||
from: AppSpec.ExtImport['path']
|
||||
}
|
||||
|
||||
export type ServerConfig = {
|
||||
setupFn: ExtImport
|
||||
middlewareConfigFn: ExtImport
|
||||
setupFn?: ExtImport
|
||||
middlewareConfigFn?: ExtImport
|
||||
}
|
||||
|
||||
export type PageConfig = {
|
||||
@ -118,8 +120,9 @@ export type WebsocketConfig = {
|
||||
}
|
||||
|
||||
export type ClientConfig = {
|
||||
rootComponent: ExtImport
|
||||
setupFn: ExtImport
|
||||
rootComponent?: ExtImport
|
||||
setupFn?: ExtImport
|
||||
baseDir?: `/${string}`
|
||||
}
|
||||
|
||||
export type DbConfig = {
|
||||
|
@ -20,8 +20,6 @@ where
|
||||
import Control.Arrow (left)
|
||||
import qualified Data.Aeson as Aeson
|
||||
import qualified Data.ByteString.Lazy.UTF8 as ByteStringLazyUTF8
|
||||
import Data.List (stripPrefix)
|
||||
import qualified StrongPath as SP
|
||||
import Wasp.Analyzer.Evaluator.Evaluation.Internal (evaluation, evaluation', runEvaluation)
|
||||
import Wasp.Analyzer.Evaluator.Evaluation.TypedExpr (TypedExprEvaluation)
|
||||
import qualified Wasp.Analyzer.Evaluator.EvaluationError as ER
|
||||
|
@ -6,7 +6,7 @@ cabal-version: 2.4
|
||||
-- Consider using hpack, or maybe even hpack-dhall.
|
||||
|
||||
name: waspc
|
||||
version: 0.15.0
|
||||
version: 0.15.1
|
||||
description: Please see the README on GitHub at <https://github.com/wasp-lang/wasp/waspc#readme>
|
||||
homepage: https://github.com/wasp-lang/wasp/waspc#readme
|
||||
bug-reports: https://github.com/wasp-lang/wasp/issues
|
||||
|
Loading…
Reference in New Issue
Block a user