Skip to content

Commit

Permalink
chore: export Config type
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Nov 11, 2024
1 parent 9768a15 commit 19d1a4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ConfigOptions } from './types'
import type { Config } from './types'
import { resolve } from 'node:path'
import process from 'node:process'
import { deepMerge } from './utils'
Expand All @@ -15,7 +15,7 @@ import { deepMerge } from './utils'
* // imports from example.config.{ts,js} and merges with default config
* await loadConfig({ name: 'example', defaultConfig: { foo: 'bar' } })
*/
export async function loadConfig<T extends Record<string, unknown>>({ name, cwd, defaultConfig }: ConfigOptions<T>): Promise<T> {
export async function loadConfig<T extends Record<string, unknown>>({ name, cwd, defaultConfig }: Config<T>): Promise<T> {
const configPath = resolve(cwd || process.cwd(), `${name}.config`)

try {
Expand All @@ -28,3 +28,5 @@ export async function loadConfig<T extends Record<string, unknown>>({ name, cwd,
return defaultConfig
}
}

export * from './types'
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @param cwd - The current working directory.
* @param defaultConfig - The default configuration.
*/
export interface ConfigOptions<T> {
export interface Config<T> {
name: string
cwd?: string
defaultConfig: T
Expand Down

0 comments on commit 19d1a4e

Please sign in to comment.