2019-02-10 15:26:50 +03:00
|
|
|
import fs from 'fs'
|
|
|
|
import browserify from 'browserify'
|
2019-02-20 00:57:09 +03:00
|
|
|
import envify from 'envify/custom'
|
|
|
|
import dotenv from 'dotenv'
|
2019-02-10 15:26:50 +03:00
|
|
|
|
|
|
|
import log from '@/helpers/log'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build web app
|
|
|
|
*/
|
|
|
|
export default () => new Promise((resolve) => {
|
2019-02-20 00:57:09 +03:00
|
|
|
// read .env file from leon root directory
|
|
|
|
dotenv.config()
|
2019-02-10 15:26:50 +03:00
|
|
|
browserify('app/js/main.es6.js')
|
|
|
|
.transform('babelify')
|
2019-02-20 00:57:09 +03:00
|
|
|
.transform(envify(process.env))
|
2019-02-10 15:26:50 +03:00
|
|
|
.bundle()
|
|
|
|
.on('error', err => log.error(`[${err.name}] ${err.message}`))
|
|
|
|
.pipe(fs.createWriteStream('app/js/main.js'))
|
|
|
|
|
|
|
|
log.success('Web app built')
|
|
|
|
resolve()
|
|
|
|
})
|