-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Copies public folder files into built storybook artefact folder
- Loading branch information
1 parent
2616971
commit f20bfbb
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const sourceDir = path.join(__dirname, '../', 'public'); | ||
const targetDir = path.join(__dirname, '../','storybook-static'); | ||
|
||
fs.readdir(sourceDir, (err, files) => { | ||
if (err) { | ||
console.error(`Unable to read directory: ${sourceDir}`); | ||
process.exit(1); | ||
} | ||
|
||
files.forEach(file => { | ||
const sourceFile = path.join(sourceDir, file); | ||
const targetFile = path.join(targetDir, file); | ||
|
||
if (!fs.existsSync(targetFile)) { | ||
fs.copyFile(sourceFile, targetFile, err => { | ||
if (err) { | ||
console.error(`Unable to copy file: ${sourceFile}`); | ||
process.exit(1); | ||
} | ||
}); | ||
} | ||
}); | ||
}); |