Skip to content

Commit

Permalink
Allow overriding appDir
Browse files Browse the repository at this point in the history
  • Loading branch information
robertherber committed Jul 22, 2024
1 parent 5e7bc1e commit 6846bbd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-fishes-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zemble/core": patch
---

Allow overriding appDir
9 changes: 6 additions & 3 deletions packages/core/createApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type Configure = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
readonly plugins: readonly (Plugin<any, any, any>)[],
readonly providerStrategies?: Zemble.ProviderStrategies
readonly appDir?: string
}

const debuggah = debug('@zemble/core')
Expand All @@ -32,7 +33,11 @@ const filterConfig = (config: Zemble.GlobalConfig) => Object.keys(config).reduce
}
}, {})

export const createApp = async ({ plugins: pluginsBeforeResolvingDeps, providerStrategies: providerStrategiesIn }: Configure) => {
export const createApp = async ({
plugins: pluginsBeforeResolvingDeps,
providerStrategies: providerStrategiesIn,
appDir = process.cwd(),
}: Configure) => {
const hono = new Hono<Zemble.HonoEnv>()

// maybe this should be later - how about middleware that overrides logger?
Expand Down Expand Up @@ -105,8 +110,6 @@ export const createApp = async ({ plugins: pluginsBeforeResolvingDeps, providerS
debuggah(`Loading ${plugin.pluginName} with config: ${JSON.stringify(filterConfig(plugin.config), null, 2)}`)
})

const appDir = process.cwd()

const multiProviders = defaultMultiProviders as unknown as Zemble.MultiProviders

const preInitApp = {
Expand Down

0 comments on commit 6846bbd

Please sign in to comment.