Skip to content

Commit a696688

Browse files
committed
chore: wip
1 parent 486734f commit a696688

File tree

8 files changed

+27
-25
lines changed

8 files changed

+27
-25
lines changed

storage/framework/core/config/src/config.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ export const config: StacksOptions = {
88
...overrides,
99
}
1010

11+
export function getConfig(): StacksOptions {
12+
return config
13+
}
14+
1115
export const ai: StacksOptions['ai'] = config.ai
1216
export const analytics: StacksOptions['analytics'] = config.analytics
1317
export const app: StacksOptions['app'] = config.app
@@ -37,13 +41,15 @@ export const ui: StacksOptions['ui'] = config.ui
3741

3842
export * from './helpers'
3943

40-
export function determineAppEnv(): string {
41-
if (app.env === 'local')
42-
return 'dev'
43-
if (app.env === 'development')
44+
type AppEnv = 'dev' | 'stage' | 'prod' | string
45+
46+
export function determineAppEnv(): AppEnv {
47+
if (app.env === 'local' || app.env === 'development')
4448
return 'dev'
49+
4550
if (app.env === 'staging')
4651
return 'stage'
52+
4753
if (app.env === 'production')
4854
return 'prod'
4955

storage/framework/core/config/src/defaults.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import type { StacksOptions } from '@stacksjs/types'
22
import { commandsPath, userDatabasePath } from '@stacksjs/path'
33

4-
// import { userConfig as overrides } from './overrides'
5-
6-
const config: StacksOptions = {
4+
const defaults: StacksOptions = {
75
ai: {
86
deploy: false,
97
models: [
@@ -687,4 +685,4 @@ const config: StacksOptions = {
687685
},
688686
}
689687

690-
export default config
688+
export default defaults

storage/framework/core/config/src/helpers.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import type {
1111
Events,
1212
GitConfig,
1313
HashingConfig,
14-
JobConfig,
1514
LibraryConfig,
1615
Model,
1716
NotificationConfig,
@@ -143,14 +142,6 @@ export function defineCli(config: CliConfig): CliConfig {
143142
return config
144143
}
145144

146-
export function defineJob(config: JobConfig): JobConfig {
147-
return config
148-
}
149-
150-
export function defineCronJob(config: JobConfig): JobConfig {
151-
return config
152-
}
153-
154145
export function defineDatabase(config: DatabaseConfig): DatabaseConfig {
155146
return config
156147
}

storage/framework/core/config/src/overrides.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* **Overrides**
3+
*
4+
* This file is what takes prepares the user config to be merged with
5+
* the default config. For anyone that uses this, ensure you define
6+
* the alias `~config/` in your tsconfig.json file.
7+
*/
8+
19
import type { StacksConfig } from '@stacksjs/types'
210
import ai from '~/config/ai'
311
import analytics from '~/config/analytics'

storage/framework/core/database/src/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Database } from '@stacksjs/orm'
22
import type { RawBuilder } from 'kysely'
3-
import { config } from '@stacksjs/config'
3+
import { getConfig } from '@stacksjs/config'
44
import { log } from '@stacksjs/logging'
55
import { projectPath } from '@stacksjs/path'
66
import { Kysely, MysqlDialect, PostgresDialect, sql } from 'kysely'
@@ -11,15 +11,15 @@ import { Pool } from 'pg'
1111

1212
// Simple functions with defensive defaults in case the imports failed
1313
function getEnv(): string {
14-
return config?.app?.env || 'local'
14+
return getConfig()?.app?.env || 'local'
1515
}
1616

1717
function getDriver(): string {
18-
return config?.database?.default || 'sqlite'
18+
return getConfig()?.database?.default || 'sqlite'
1919
}
2020

2121
function getDatabaseConfig() {
22-
return config?.database || { connections: {} }
22+
return getConfig()?.database || { connections: {} }
2323
}
2424

2525
export function getDialect(): MysqlDialect | PostgresDialect | BunWorkerDialect {

storage/framework/core/types/src/cloud.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ interface SiteConfig {
259259
path: string
260260
}
261261

262-
type InfrastuctureOptions = Partial<{
262+
type InfrastructureOptions = Partial<{
263263
type: 'serverless' // | 'server' coming soon
264264
driver: 'aws'
265265
api: ApiConfig
@@ -336,7 +336,7 @@ export interface CloudOptions {
336336
[site: string]: string | SiteConfig
337337
}
338338

339-
infrastructure: InfrastuctureOptions
339+
infrastructure: InfrastructureOptions
340340
}
341341

342342
export type CloudConfig = Partial<CloudOptions>

storage/framework/core/utils/src/config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ export {
44
defineCdn,
55
defineChat,
66
defineCli,
7-
defineCronJob,
87
defineDatabase,
98
defineDependencies,
109
defineDns,
1110
defineEmail,
1211
defineEmailConfig,
1312
defineGit,
1413
defineHashing,
15-
defineJob,
1614
defineLibrary,
1715
defineNotification,
1816
definePayment,

storage/framework/defaults/ide/dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ unimport
353353
universalify
354354
unmanaged
355355
unocss
356+
unplugin
356357
Unprefix
357358
Unprefixed
358359
unstorage

0 commit comments

Comments
 (0)