@@ -128,10 +128,19 @@ function validateConfig(configFile) {
128128
129129 try {
130130 validateConfigBrowsers ( storybookConfig . browsers ) ;
131- resolutions = storybookConfig . resolutions || storybookConfig . viewports
132- storybookConfig . resolutions = validateConfigResolutions ( resolutions ) ;
131+ let resolutions = storybookConfig . resolutions || storybookConfig . viewports
132+ if ( resolutions ) {
133+ storybookConfig . resolutions = validateConfigResolutions ( resolutions ) ;
134+ }
133135 storybookConfig . viewports = storybookConfig . resolutions ;
134- validateCustomViewPorts ( storybookConfig . customViewports )
136+ let customViewports = storybookConfig . customViewports ;
137+ if ( customViewports && customViewports . length > 0 ) {
138+ validateCustomViewPorts ( storybookConfig . customViewports )
139+ }
140+ if ( ! resolutions && ( ! customViewports || customViewports . length === 0 ) ) {
141+ console . log ( '[smartui] Error: No resolutions or customViewports found in config file' ) ;
142+ process . exit ( constants . ERROR_CATCHALL ) ;
143+ }
135144 } catch ( error ) {
136145 console . log ( `[smartui] Error: Invalid config, ${ error . message } ` ) ;
137146 process . exit ( constants . ERROR_CATCHALL ) ;
@@ -228,8 +237,8 @@ function validateCustomViewPorts(customViewports) {
228237 return
229238 }
230239 customViewports . forEach ( element => {
231- if ( ! Array . isArray ( element . stories ) || element . stories == 0 ) {
232- throw new ValidationError ( 'Missing `stories` in customViewports config. please check the config file ' ) ;
240+ if ( element . stories && element . stories . length !== 0 && element . exclude && element . exclude . length ! == 0 ) {
241+ throw new ValidationError ( 'Cannot specify both stories and excludeStories in customViewports ' ) ;
233242 }
234243 if ( element . styles ) {
235244 if ( ! element . styles ?. width ) {
0 commit comments