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";
66import { parse } from "yaml" ;
77
88const CONFIG_VERSION = 1 ;
9+ const DEFAULT_YAML_PATHS = [ "jtr.yml" , "jtr.yaml" ] ;
10+
911const rkebab = / - ( [ a - z ] ) / g;
1012
1113export default async function readYAML ( path ) {
1214 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+ }
1919 }
2020 }
21+ if ( ! path ) {
22+ return { } ;
23+ }
2124
2225 const contents = await readFile ( resolve ( process . cwd ( ) , path ) , "utf8" ) ;
2326 let config = await parse ( contents ) ;
You can’t perform that action at this time.
0 commit comments