{"size": 896, "ext": "js", "max_stars_repo_path": "build.js", "max_stars_repo_name": "OS4OpenScience/OS4OpenScience", "max_stars_repo_stars_event_min_datetime": "2017-05-08T03:31:15.000Z", "max_stars_repo_stars_event_max_datetime": "2017-05-08T03:31:15.000Z", "max_issues_repo_path": "build.js", "max_issues_repo_name": "OS4OpenScience/OS4OpenScience", "max_issues_repo_issues_event_min_datetime": "2017-05-08T03:33:18.000Z", "max_issues_repo_issues_event_max_datetime": "2019-10-29T18:05:04.000Z", "max_forks_repo_path": "build.js", "max_forks_repo_name": "OS4OpenScience/OS4OpenScience", "max_forks_repo_forks_event_min_datetime": "2017-05-04T17:57:31.000Z", "max_forks_repo_forks_event_max_datetime": "2017-05-04T17:57:31.000Z"}
{"max_stars_count": 1, "max_issues_count": 2, "max_forks_count": 1, "avg_line_length": 27.1515151515, "max_line_length": 66, "alphanum_fraction": 0.7198660714}
const browserify = require('browserify')()
const fs = require('fs')
const path = require('path')

const resolve = (file) => path.join(__dirname, file)

// ADD: Add app entry point
browserify.add(resolve('./index.js'))

// TRANSFORM: Specify transforms to be applied before parsing code
//
// Allow a selection of nice features from modern JavaScript
// in old browsers: https://github.com/yoshuawuyts/es2020
browserify.transform('es2020')

// Make all the frontend element construction suuuuuper fast
browserify.transform('yo-yoify')

// Minify the compiled code
browserify.transform('uglifyify', {
  global: true
})

browserify.bundle().pipe(
  fs.createWriteStream(resolve('bundle.js'))
).on('end',
  () => console.log('Build completed successfully')
).on('error',
  (err) => console.error('Error during build process', err)
).on('finish',
  () => console.log('Build completed successfully')
)
