const fs = require('fs')
const path = require('path')
const browserify = require('browserify')
const babelify = require('babelify')
const disc = require('disc')

const title = '<title>Build Size Disc - Citation.js</title>'
const back = '<p><a style="color: inherit;" href="https://citation.js.org/">< Back</a></p>'
const attribution = '<p>Generated by <a style="color: inherit;" href="https://npmjs.com/package/disc">disc</a></p>'
const header = '<h1>Citation.js</h1>'

const opts = {
  header: `${title}<div style="padding-left: 1em">${back}${attribution}</div>`,
  footer: header
}

browserify({fullPaths: true})
  .add('./src/index.js')
  .transform(babelify)
  .bundle()
  .pipe(disc(opts))
  .pipe(fs.createWriteStream(path.join(__dirname, '../build/disc/index.html')))
