File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -6,18 +6,21 @@ import { resolve } from "node:path";
6
6
import { parse } from "yaml" ;
7
7
8
8
const CONFIG_VERSION = 1 ;
9
+ const DEFAULT_YAML_PATHS = [ "jtr.yml" , "jtr.yaml" ] ;
10
+
9
11
const rkebab = / - ( [ a - z ] ) / g;
10
12
11
13
export default async function readYAML ( path ) {
12
14
if ( ! path ) {
13
- if ( await stat ( resolve ( process . cwd ( ) , "jtr.yml" ) ) . catch ( ( ) => false ) ) {
14
- path = "jtr.yml" ;
15
- } else if ( await stat ( resolve ( process . cwd ( ) , "jtr.yaml" ) ) . catch ( ( ) => false ) ) {
16
- path = "jtr.yaml" ;
17
- } else {
18
- return { } ;
15
+ for ( const defaultPath of DEFAULT_YAML_PATHS ) {
16
+ if ( await stat ( resolve ( process . cwd ( ) , defaultPath ) ) . catch ( ( ) => false ) ) {
17
+ path = defaultPath ;
18
+ }
19
19
}
20
20
}
21
+ if ( ! path ) {
22
+ return { } ;
23
+ }
21
24
22
25
const contents = await readFile ( resolve ( process . cwd ( ) , path ) , "utf8" ) ;
23
26
let config = await parse ( contents ) ;
You can’t perform that action at this time.
0 commit comments