Skip to content

Conversation

@necrogami
Copy link
Contributor

@necrogami necrogami commented Dec 12, 2025

Summary

  • Replace manual imports in catalog aggregators with Vite's import.meta.glob for automatic file discovery
  • Adding new software or configurations now only requires creating a single file in the appropriate folder
  • No more manual editing of software-catalog.js or configurations.js

Changes

  • software-catalog.js: ~320 lines → ~50 lines using import.meta.glob('./software/**/*.js', { eager: true })
  • configurations.js: ~260 lines → ~50 lines using import.meta.glob('./configurations/**/*.js', { eager: true })
  • Test helpers: Added Node.js glob-based loaders for Jest compatibility (Jest doesn't support import.meta.glob)
  • Tests: Updated to use async loading via beforeAll

Benefits

  • Simpler workflow: Create a new .js file in the right folder and it's automatically included
  • Less maintenance: No risk of forgetting to update aggregator files
  • Cleaner code: Reduced ~570 lines of boilerplate imports

Test plan

  • npm run build passes
  • npm test passes (17 tests)
  • npm run dev starts correctly
  • Manual verification of software/configuration selection in UI

Replace manual imports in software-catalog.js and configurations.js
with Vite's import.meta.glob for automatic discovery of items from
their folder structure.

Benefits:
- Adding new software/config only requires creating a single file
- No more manual editing of aggregator files
- Reduces maintenance burden and prevents missed updates

Changes:
- Refactor software-catalog.js to use import.meta.glob (~320 -> ~50 lines)
- Refactor configurations.js to use import.meta.glob (~260 -> ~50 lines)
- Add Jest test helpers using Node.js glob for test compatibility
- Update tests to use async loading in beforeAll
- Add glob as dev dependency
@kaic
Copy link
Owner

kaic commented Dec 15, 2025

Great PR man, approved. This will save a lot of work. Thanks.

@kaic kaic merged commit cb09d7d into kaic:main Dec 15, 2025
3 checks passed
@kaic kaic added enhancement New feature or request catalog Anything related to the catalog labels Dec 15, 2025
@kaic kaic self-assigned this Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

catalog Anything related to the catalog enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants