mirror of
https://github.com/leon-ai/leon.git
synced 2024-12-24 09:12:20 +03:00
a438d6f942
Enable environment variables by pulling in 'envify' as a dependency. 'envify' loads a file named '.env' lying in the leon root directory and replaces any occurence of process.env.FOO by the corresponding entry in '.env'.
24 lines
565 B
JavaScript
24 lines
565 B
JavaScript
import fs from 'fs'
|
|
import browserify from 'browserify'
|
|
import envify from 'envify/custom'
|
|
import dotenv from 'dotenv'
|
|
|
|
import log from '@/helpers/log'
|
|
|
|
/**
|
|
* Build web app
|
|
*/
|
|
export default () => new Promise((resolve) => {
|
|
// read .env file from leon root directory
|
|
dotenv.config()
|
|
browserify('app/js/main.es6.js')
|
|
.transform('babelify')
|
|
.transform(envify(process.env))
|
|
.bundle()
|
|
.on('error', err => log.error(`[${err.name}] ${err.message}`))
|
|
.pipe(fs.createWriteStream('app/js/main.js'))
|
|
|
|
log.success('Web app built')
|
|
resolve()
|
|
})
|