Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import fs from 'fs-extra'; import path from 'node:path'; import * as glob from 'glob'; import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const root = path.resolve(__dirname, '../'); const publicDir = path.join(root, 'public/'); // Find all image assets and clone to root folder so storybook can load them correctly const assets = glob.sync(path.resolve(root, 'src/**/*.@(jpeg|jpg|png|webp|svg)')); // Copy images to public directory to make them available to Storybook if (assets.length > 0) { fs.ensureDir(publicDir, (err) => { if (err) throw err; assets.forEach((asset) => { const file = `${path.parse(asset).name}${path.parse(asset).ext}`; fs.copySync(asset, path.join(publicDir, file)); }); }); } |