Skip to content

Commit 78c8380

Browse files
authored
Merge pull request #40 from pinanks/DOT-1390
DOT-1390
2 parents dec7123 + 272d33b commit 78c8380

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

commands/utils/validate.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,13 @@ function validateConfig(configFile) {
142142
}
143143
});
144144

145-
if (storybookConfig.waitForTimeout <= 0) {
146-
console.log('[smartui] Error: Invalid value of waitForTimeout. Must be > 0');
147-
console.log('If you do not wish to include waitForTimeout parameter, remove it from the config file.')
148-
process.exit(0);
149-
}
150-
if (storybookConfig.waitForTimeout > 30000) {
151-
console.log('[smartui] Error: Invalid value of waitForTimeout. Must be <= 30000');
152-
process.exit(0);
145+
// Sanity check waitForTimeout
146+
if (!Object.hasOwn(storybookConfig, 'waitForTimeout')) {
147+
storybookConfig.waitForTimeout = 0;
148+
} else if (storybookConfig.waitForTimeout <= 0 || storybookConfig.waitForTimeout > 30000) {
149+
console.log('[smartui] Warning: Invalid config, value of waitForTimeout must be > 0 and <= 30000');
150+
console.log('If you do not wish to include waitForTimeout parameter, remove it from the config file.');
151+
storybookConfig.waitForTimeout = 0;
153152
}
154153

155154
return storybookConfig

index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ program.command('storybook')
3636
.option('--force-rebuild', 'Force a rebuild of an already existing build.', false)
3737
.action(async function(serve, options) {
3838
options.env = program.opts().env || 'prod';
39-
if (options.config) {
40-
options.config = validateConfig(options.config);
41-
}
42-
39+
4340
console.log('SmartUI Storybook CLI v' + version);
4441
await checkUpdate(version, options);
4542
console.log('\n');
4643

44+
if (options.config) {
45+
options.config = validateConfig(options.config);
46+
}
47+
4748
await validateProjectToken(options);
4849
if (!options.forceRebuild) await validateLatestBuild(options);
4950
storybook(serve, options);

0 commit comments

Comments
 (0)