Skip to content

Commit 5b6aaf0

Browse files
TehShrikelukeed
andauthored
feat: allow async config file (#9)
* Allow async config file exports This allows config files to be CommonJS files that pull in connection details from ESM files using dynamic imports * fix(types): update `config` resolver Co-authored-by: Luke Edwards <[email protected]>
1 parent 6a7b743 commit 5b6aaf0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function wrap(act) {
1010
return async (opts, tmp) => {
1111
if (tmp = local(opts.config, opts.cwd)) {
1212
$.info('Loading configuration');
13-
opts.config = typeof tmp === 'function' ? tmp() : tmp;
13+
opts.config = await (typeof tmp === 'function' ? tmp() : tmp);
1414
}
1515
await ley[act](opts).then(done).catch($.bail);
1616
};

ley.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare namespace Options {
22
declare type Config = Record<string, unknown>;
3-
declare type Resolver = () => Config;
3+
declare type Resolver = Promise<Config> | () => Config;
44

55
declare interface Base {
66
cwd?: string;

0 commit comments

Comments
 (0)