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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 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 dist = path.resolve(root, 'dist'); const componentsDist = path.resolve(dist, 'components'); // Ensure components directory exists fs.ensureDirSync(componentsDist); // Find all slds2 component directories const componentDirs = glob.sync(path.resolve(root, 'src/slds2/*'), { onlyDirectories: true, }); // Filter function to exclude underscore directories, JS files, and UIF files const filterFunc = (src, dest) => { const relativePath = path.relative(path.resolve(root, 'src/slds2'), src); const pathParts = relativePath.split(path.sep); // Skip if any part of the path starts with underscore if (pathParts.some((part) => part.startsWith('__'))) { return false; } // Skip JS files if (path.extname(src) === '.js') { return false; } // Skip UIF files (Universal Interface Format) if (path.basename(src).endsWith('.uif.json')) { return false; } return true; }; // Copy each component directory to dist/components/ componentDirs.forEach((componentDir) => { const componentName = path.basename(componentDir); const destDir = path.resolve(componentsDist, componentName); console.log(`Copying component: ${componentName}`); // Ensure destination exists before copying (handles race condition with build:uif) fs.ensureDirSync(destDir); fs.copySync(componentDir, destDir, { filter: filterFunc, overwrite: true, }); }); console.log('Component files copied to dist/components/'); |