const fs = require('fs')
const path = require('path')
const schemasPath = path.join(__dirname, 'dist')

// Assemble compiled schema files into an object
// keys are shorthand names, values are schemas
const schemas = {}
fs.readdirSync(schemasPath)
  .filter(filename => filename.endsWith('.json'))
  .map(filename => {
    const key = filename.replace('.json', '')
    const value = require(path.join(schemasPath, filename))
    schemas[key] = value
  })

module.exports = { schemas }
