Skip to content

Commit aaf9790

Browse files
committed
Add checks in validateStorybookDir
1 parent 8f4cc58 commit aaf9790

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

commands/utils/validate.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,20 @@ function validateStorybookUrl(url) {
5454
};
5555

5656
async function validateStorybookDir(dir) {
57-
// verify the storybook static directory exists
57+
// verify the directory exists
5858
if (!fs.existsSync(dir)) {
5959
console.log(`[smartui] Error: No directory found: ${dir}`);
6060
process.exit(1);
6161
}
62+
// Verify project.json and stories.json exist to confirm it's a storybook-static dir
63+
if (!fs.existsSync(dir + '/index.html')) {
64+
console.log(`[smartui] Given directory is not a storybook static directory. Error: No index.html found`);
65+
process.exit(1);
66+
}
67+
if (!fs.existsSync(dir + '/stories.json')) {
68+
console.log(`[smartui] Given directory is not a storybook static directory. Error: No stories.json found`);
69+
process.exit(1);
70+
}
6271
};
6372

6473
async function validateLatestBuild(options) {

0 commit comments

Comments
 (0)