|
| 1 | +import { defineConfig } from 'jsrepo'; |
| 2 | +import { distributed } from 'jsrepo/outputs'; |
| 3 | +import fs from 'fs'; |
| 4 | +import path from 'path'; |
| 5 | + |
| 6 | +function getItems(cwd: string) { |
| 7 | + const contentDir = path.join(cwd, 'src/content'); |
| 8 | + const categories = fs.readdirSync(contentDir).filter((f) => { |
| 9 | + return fs.statSync(path.join(contentDir, f)).isDirectory(); |
| 10 | + }); |
| 11 | + |
| 12 | + const items: Array<{ |
| 13 | + name: string; |
| 14 | + type: string; |
| 15 | + files: Array<{ path: string }>; |
| 16 | + }> = []; |
| 17 | + |
| 18 | + for (const category of categories) { |
| 19 | + const categoryPath = path.join(contentDir, category); |
| 20 | + const components = fs.readdirSync(categoryPath).filter((f) => { |
| 21 | + return fs.statSync(path.join(categoryPath, f)).isDirectory(); |
| 22 | + }); |
| 23 | + |
| 24 | + for (const component of components) { |
| 25 | + items.push({ |
| 26 | + name: `${category}/${component}`, |
| 27 | + type: category, |
| 28 | + files: [{ path: `src/content/${category}/${component}` }] |
| 29 | + }); |
| 30 | + } |
| 31 | + } |
| 32 | + |
| 33 | + return items; |
| 34 | +} |
| 35 | + |
| 36 | +export default defineConfig({ |
| 37 | + registry: ({ cwd }) => ({ |
| 38 | + name: 'vue-bits', |
| 39 | + description: |
| 40 | + 'An open source collection of animated, interactive & fully customizable Vue components for building stunning, memorable user interfaces.', |
| 41 | + authors: ['David Haz'], |
| 42 | + homepage: 'https://vue-bits.dev', |
| 43 | + repository: 'https://github.com/DavidHDev/vue-bits', |
| 44 | + bugs: 'https://github.com/DavidHDev/vue-bits/issues', |
| 45 | + tags: [ |
| 46 | + 'vue', |
| 47 | + 'javascript', |
| 48 | + 'components', |
| 49 | + 'web', |
| 50 | + 'vuejs', |
| 51 | + 'css-animations', |
| 52 | + 'component-library', |
| 53 | + 'ui-components', |
| 54 | + '3d', |
| 55 | + 'ui-library', |
| 56 | + 'tailwind', |
| 57 | + 'tailwindcss', |
| 58 | + 'components-library' |
| 59 | + ], |
| 60 | + outputs: [distributed({ dir: './public/ui' })], |
| 61 | + excludeDeps: ['vue'], |
| 62 | + defaultPaths: { |
| 63 | + Animations: 'src/components/Animations', |
| 64 | + Backgrounds: 'src/components/Backgrounds', |
| 65 | + Components: 'src/components/Components', |
| 66 | + TextAnimations: 'src/components/TextAnimations' |
| 67 | + }, |
| 68 | + items: getItems(cwd) |
| 69 | + }) |
| 70 | +}); |
0 commit comments