| 1 |
const workflowContext = require.context( |
| 2 |
'.', |
| 3 |
true, |
| 4 |
// Exclude this file and anything in tools/ or components/ |
| 5 |
/^(?!.*\/(tools|components)\/)(?!\.\/workflows\.js$).*\.js$/, |
| 6 |
); |
| 7 |
export const workflows = workflowContext |
| 8 |
.keys() |
| 9 |
.filter((key) => key !== './workflows.js') |
| 10 |
.map((key) => workflowContext(key).default || workflowContext(key)); |
| 11 |
|
| 12 |
// Dynamically pull in all tools |
| 13 |
const toolContext = require.context('.', true, /tools\/.*\.js$/); |
| 14 |
export const tools = toolContext.keys().reduce((acc, key) => { |
| 15 |
const id = key.split('/').pop().replace('.js', ''); |
| 16 |
acc[id] = toolContext(key).default || toolContext(key); |
| 17 |
return acc; |
| 18 |
}, {}); |
| 19 |
|