File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @rnef/config ' : patch
3+ ---
4+
5+ Read validated config values to properly include default values.
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as fs from 'node:fs';
22import { createRequire } from 'node:module' ;
33import * as path from 'node:path' ;
44import { color , logger } from '@rnef/tools' ;
5+ import type { ValidationError } from 'joi' ;
56import { ConfigTypeSchema } from './schema.js' ;
67import { formatValidationError } from './utils.js' ;
78
@@ -102,7 +103,12 @@ export async function getConfig(
102103 // eslint-disable-next-line prefer-const
103104 let { config, filePathWithExt } = await importUp ( dir , 'rnef.config' ) ;
104105
105- const { error } = ConfigTypeSchema . validate ( config ) ;
106+ const { error, value : validatedConfig } = ConfigTypeSchema . validate (
107+ config
108+ ) as {
109+ error : ValidationError | null ;
110+ value : ConfigType ;
111+ } ;
106112
107113 if ( error ) {
108114 logger . error (
@@ -121,7 +127,7 @@ export async function getConfig(
121127 get reactNativeVersion ( ) {
122128 return getReactNativeVersion ( config . root || dir ) ;
123129 } ,
124- ...config ,
130+ ...validatedConfig ,
125131 } ;
126132
127133 const api = {
You can’t perform that action at this time.
0 commit comments