![Scott Nonnenberg](/assets/img/avatar_default.png)
* A number of fixes required for successful build after upgrades - extract now takes an absolute directory only - something changed, so we now need to force NODE_ENV=production; we use electron-is-dev for this - electron-builder, electron-publisher-s3, and electron-updater are now updated to their latest available versions * Add direct dependency on extract-zip, since we use it directly * Load 'config' module after we've modified NODE_ENV * Downgrade electron-builder due to bug, downgrade icon-maker too The latest electron-builder came with a fix for one of our bugs as well as a new bug that blocks builds on Windows: https://github.com/electron-userland/electron-builder/issues/2462 There's no good reason to upgrade icon-maker. And a good reason to keep at the version on github: https://github.com/jaretburkett/electron-icon-maker/issues/7
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
const path = require('path');
|
|
|
|
const electronIsDev = require('electron-is-dev');
|
|
|
|
const defaultEnvironment = electronIsDev ? 'development' : 'production';
|
|
const environment = process.env.NODE_ENV || defaultEnvironment;
|
|
|
|
// Set environment vars to configure node-config before requiring it
|
|
process.env.NODE_ENV = environment;
|
|
process.env.NODE_CONFIG_DIR = path.join(__dirname, '..', 'config');
|
|
|
|
if (environment === 'production') {
|
|
// harden production config against the local env
|
|
process.env.NODE_CONFIG = '';
|
|
process.env.NODE_CONFIG_STRICT_MODE = true;
|
|
process.env.HOSTNAME = '';
|
|
process.env.NODE_APP_INSTANCE = '';
|
|
process.env.ALLOW_CONFIG_MUTATIONS = '';
|
|
process.env.SUPPRESS_NO_CONFIG_WARNING = '';
|
|
}
|
|
|
|
// We load config after we've made our modifications to NODE_ENV
|
|
const config = require('config');
|
|
|
|
config.environment = environment;
|
|
|
|
// Log resulting env vars in use by config
|
|
[
|
|
'NODE_ENV',
|
|
'NODE_CONFIG_DIR',
|
|
'NODE_CONFIG',
|
|
'ALLOW_CONFIG_MUTATIONS',
|
|
'HOSTNAME',
|
|
'NODE_APP_INSTANCE',
|
|
'SUPPRESS_NO_CONFIG_WARNING',
|
|
].forEach((s) => {
|
|
console.log(`${s} ${config.util.getEnv(s)}`);
|
|
});
|
|
|
|
module.exports = config;
|