1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-22 08:11:34 +03:00
leon/scripts/app/build-app.js

24 lines
565 B
JavaScript
Raw Normal View History

2019-02-10 15:26:50 +03:00
import fs from 'fs'
import browserify from 'browserify'
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) => {
// 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')
.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()
})