Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import rebuildMenus from './main/menus';
import shellEnv from 'shell-env';
import fixPath from 'fix-path';
import settings from './shared/settings';
let mainWindow = null;
const isDev = process.env.NODE_ENV === 'development';
if (isDev) {
require('electron-debug')(); // eslint-disable-line global-require
}
if (!isDev) {
// if we're running from the app package, we won't have access to env vars
// normally loaded in a shell, so work around with the shell-env module
const decoratedEnv = shellEnv.sync();
process.env = {...process.env, ...decoratedEnv};
// and we need to do the same thing with PATH
fixPath();
}
setSavedEnv();
app.on('window-all-closed', () => {
app.quit();
});
const installExtensions = async () => {
if (isDev) {
const installer = require('electron-devtools-installer'); // eslint-disable-line global-require
const extensions = [
app.on('ready', () => {
global.sharedObject = {
isDarkMode: 'darwin' == process.platform ? systemPreferences.isDarkMode() : false
}
const envVars = shellEnv.sync()
// Ask for root permissions
const serverpath = path.join(__dirname, 'dist', 'monday-server')
sudo.exec(`${serverpath} &`, {
name: 'Monday',
env: {
'HOME': envVars.HOME || '',
'GOPATH': envVars.GOPATH || '',
'MONDAY_CONFIG_PATH': envVars.MONDAY_CONFIG_PATH || '',
'MONDAY_KUBE_CONFIG': envVars.MONDAY_KUBE_CONFIG || '',
'PATH': envVars.PATH || '',
'TERM': 'xterm',
},
},
function (error, stdout, stderr) {
if (error) throw error
* (at your option) any later version.
*
* Moeditor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Moeditor. If not, see .
*/
'use strict';
// on darwin, to rewrite path
if (process.platform === "darwin") {
const shellEnvs = require('shell-env').sync()
process.env.PATH = shellEnvs.PATH;
}
const app = require('electron').app,
MoeditorApplication = require('./moe-app');
var moeApp = null, openFile = null;
app.on("ready", () => {
moeApp = new MoeditorApplication();
global.moeApp = moeApp;
global.app = app;
app.moeApp = moeApp;
if (openFile !== null)
moeApp.osxOpenFile = openFile;
moeApp.run();
module.exports.sync = () => shellEnv.sync().PATH;
const path = require("path");
const rimraf = require("rimraf");
const webpack = require("webpack");
const shell = require("shell-env");
const git = require("git-rev-sync");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const EventHooksPlugin = require("event-hooks-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const manifest = require("./package.json");
const shellEnv = Object(shell.sync());
const webpackPath = path.resolve(__dirname, "dist/webpack");
const releasePath = path.resolve(__dirname, "dist/release");
/**
* @readonly
* @desc Webpack/Custom Command Line Interface
*/
class CustomDefaultConfig {
static get argv() {
return {
mode: "production",
devtool: false,
};
}
static get env() {