<commit_before>import { app, BrowserWindow } from 'electron';
import { enableLiveReload } from 'electron-compile';
import * as electronDebug from 'electron-debug';
import installExtension from 'electron-devtools-installer';
import { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';
import { config } from 'dotenv';
import { initializeEvalHandler } from 'electron-remote';
import { startTracing, stopTracing } from './profiler';

config();

let mainWindow = null;
electronDebug({enabled: true});
enableLiveReload({strategy: 'react-hmr'});

const isDevMode = process.execPath.match(/[\\/]electron/);
const traceMode = process.env['TRICKLINE_HEAPSHOT_AND_BAIL'];

global.tracingControl = {
  startTracing,
  stopTracing: async (shouldExit = false) => {
    await stopTracing();
    if (shouldExit) app.quit();
  }
};

app.on('window-all-closed', () => {
  app.quit();
});

app.on('ready', async () => {
  initializeEvalHandler();
  if (traceMode) await startTracing();

  mainWindow = new BrowserWindow({
    width: 1024, height: 768,
  });

  mainWindow.loadURL(`file://${__dirname}/index.html`);

  if (traceMode) return;

  // Open the DevTools.
  if (isDevMode) {
    await installExtension(REACT_DEVELOPER_TOOLS);
    mainWindow.webContents.openDevTools();
  } else {
    mainWindow.webContents.openDevTools();
  }
});<commit_msg>Allow us to opt-out of devtools on start<commit_after>import { app, BrowserWindow } from 'electron';
import { enableLiveReload } from 'electron-compile';
import * as electronDebug from 'electron-debug';
import installExtension from 'electron-devtools-installer';
import { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';
import { config } from 'dotenv';
import { initializeEvalHandler } from 'electron-remote';
import { startTracing, stopTracing } from './profiler';

config();

let mainWindow = null;
electronDebug({enabled: true});
enableLiveReload({strategy: 'react-hmr'});

const isDevMode = process.execPath.match(/[\\/]electron/);
const traceMode = process.env['TRICKLINE_HEAPSHOT_AND_BAIL'];

global.tracingControl = {
  startTracing,
  stopTracing: async (shouldExit = false) => {
    await stopTracing();
    if (shouldExit) app.quit();
  }
};

app.on('window-all-closed', () => {
  app.quit();
});

app.on('ready', async () => {
  initializeEvalHandler();
  if (traceMode) await startTracing();

  mainWindow = new BrowserWindow({
    width: 1024, height: 768,
  });

  mainWindow.loadURL(`file://${__dirname}/index.html`);

  if (traceMode) return;

  // Open the DevTools.
  if (isDevMode) {
    await installExtension(REACT_DEVELOPER_TOOLS);
    mainWindow.webContents.openDevTools();
  } else {
    if (!process.env.TRICKLINE_DONT_DEVTOOLS) mainWindow.webContents.openDevTools();
  }
});
{'fraction_non_alphanumeric': 0.14954627949183302, 'fraction_numerical': 0.005081669691470054, 'mean_word_length': 4.926881720430107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6362009', 'n_tokens_mistral': 929, 'n_tokens_neox': 881, 'n_words': 189}