2019-11-16 21:51:46 +03:00
|
|
|
const appPaths = require('./app-paths')
|
|
|
|
const merge = require('webpack-merge')
|
2019-12-06 14:44:29 +03:00
|
|
|
const error = require('../helpers/logger')('ERROR:', 'red')
|
|
|
|
const { existsSync } = require('fs-extra')
|
2019-08-20 00:09:29 +03:00
|
|
|
|
|
|
|
module.exports = cfg => {
|
2019-12-06 14:44:29 +03:00
|
|
|
const pkgPath = appPaths.resolve.app('package.json')
|
|
|
|
const tauriConfPath = appPaths.resolve.app('tauri.conf.js')
|
|
|
|
if (!existsSync(pkgPath)) {
|
|
|
|
error('Could not find a package.json in your app\'s directory.')
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
if (!existsSync(tauriConfPath)) {
|
|
|
|
error('Could not find a tauri config (tauri.conf.js) in your app\'s directory.')
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
const tauriConf = require(tauriConfPath)(cfg.ctx)
|
|
|
|
const pkg = require(pkgPath)
|
|
|
|
|
2019-08-20 00:09:29 +03:00
|
|
|
const config = merge({
|
2019-12-18 00:39:34 +03:00
|
|
|
build: {},
|
2019-08-20 00:09:29 +03:00
|
|
|
ctx: {},
|
|
|
|
tauri: {
|
|
|
|
embeddedServer: {
|
|
|
|
active: true
|
|
|
|
},
|
|
|
|
bundle: {
|
|
|
|
active: true
|
|
|
|
},
|
2019-10-07 21:36:56 +03:00
|
|
|
whitelist: {
|
|
|
|
all: false
|
|
|
|
},
|
2019-08-20 00:09:29 +03:00
|
|
|
window: {
|
2019-12-06 14:44:29 +03:00
|
|
|
title: pkg.productName
|
2019-08-20 00:09:29 +03:00
|
|
|
},
|
|
|
|
security: {
|
|
|
|
csp: 'default-src data: filesystem: ws: http: https: \'unsafe-eval\' \'unsafe-inline\''
|
2019-11-24 18:11:06 +03:00
|
|
|
},
|
2019-11-30 14:48:39 +03:00
|
|
|
edge: {
|
|
|
|
active: true
|
2019-08-20 00:09:29 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}, tauriConf, cfg)
|
|
|
|
|
|
|
|
process.env.TAURI_DIST_DIR = appPaths.resolve.app(config.build.distDir)
|
2019-12-18 00:39:34 +03:00
|
|
|
process.env.TAURI_DIR = appPaths.tauriDir
|
2019-11-30 14:48:39 +03:00
|
|
|
|
2019-08-20 00:09:29 +03:00
|
|
|
return config
|
|
|
|
}
|