diff --git a/cli/tauri.js/helpers/tauri-config.js b/cli/tauri.js/helpers/tauri-config.js index 05fc94664..c8d7812fa 100644 --- a/cli/tauri.js/helpers/tauri-config.js +++ b/cli/tauri.js/helpers/tauri-config.js @@ -1,8 +1,22 @@ const appPaths = require('./app-paths') const merge = require('webpack-merge') +const error = require('../helpers/logger')('ERROR:', 'red') +const { existsSync } = require('fs-extra') module.exports = cfg => { - const tauriConf = require(appPaths.resolve.app('tauri.conf.js'))(cfg.ctx) + 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) + const config = merge({ build: { distDir: './dist' @@ -19,7 +33,7 @@ module.exports = cfg => { all: false }, window: { - title: require(appPaths.resolve.app('package.json')).productName + title: pkg.productName }, security: { csp: 'default-src data: filesystem: ws: http: https: \'unsafe-eval\' \'unsafe-inline\''