/**
 * @module apeman-asset-guides
 */
'use strict'

const pkg = require('./package.json')
const fs = require('fs')
const path = require('path')
const expandglob = require('expandglob')

exports.version = pkg.version
exports.guides = [ 'ja', 'en' ].reduce((guides, lang) => {
  let dirname = `dist/markdowns/${lang}`
  return Object.assign(guides, {
    [lang]: fs.readdirSync(dirname).map((subdirname) => {
      return {
        name: subdirname,
        files: expandglob.sync(subdirname + '/*.md', {
          cwd: dirname
        }).map((filename) => ({
          filename: filename,
          title: path.basename(filename, '.md')
        }))
      }
    })
  })
}, {})

