silphius/app/ecs/components/index.js
2024-08-04 23:08:46 -05:00

19 lines
452 B
JavaScript

import gather from '@/util/gather.js';
const Gathered = gather(
import.meta.glob(['./*.js', '!./*.test.js'], {eager: true, import: 'default'}),
);
const Components = {};
for (const componentName in Gathered) {
Components[componentName] = eval(`
((Gathered) => (
class ${componentName} extends Gathered['${componentName}'] {
static componentName = '${componentName}';
}
))
`)(Gathered);
}
export default Components;