<commit_before>/**
 * Copyright (c) <NAME>. All rights reserved.
 *
 * Licensed under the MIT License.
 * Please see LICENSE file located in the project root for more information.
 */

'use strict';

const childProcess = require('node:child_process');
const fs = require('node:fs');
const path = require('node:path');

const electron = require('electron');
const grunt = require('grunt');
const rimraf = require('rimraf');

const {ROOT_DIR} = require('./constant');
const {buildRelease} = require('./builder-wrapper');

function onRendererExit(code) {
    grunt.log.writeln(`Electron exited with code ${code}.`);
}

/* eslint-disable no-console */
function cleanBuild() {
    const done = this.async();

    rimraf(path.join(ROOT_DIR, '{out,dist}'), {disableGlob: false}, (error) => {
        if (error) {
            grunt.log.errorlns([`Could not clean-up: ${error}`]);
            return false;
        }

        grunt.log.oklns(['Cleaned up output directories.']);
        done();

        return true;
    });
}

/* eslint-disable no-console */
function startRenderer() {
    const child = childProcess.spawn(electron, [ROOT_DIR, '--trace-warnings'], {
        stdio: ['pipe', process.stdout, process.stderr]
    });

    child.on('close', onRendererExit);
    child.on('exit', onRendererExit);
    child.on('SIGTERM', onRendererExit);
}

function makeRelease() {
    if (!fs.existsSync(path.join(ROOT_DIR, 'out/platform/main.js'))) {
        grunt.fail.fatal('Project not compiled yet! Run `yarn run compile` first.', 0);
        return 0;
    }

    const done = this.async();
    const release = buildRelease();

    release.then((path) => {
        grunt.log.oklns([`Created release: ${path}`]);
    });

    release.catch((error) => {
        grunt.log.errorlns([`Unable to make release: ${error}`]);
    });
<commit_msg>fix: startRenderer process<commit_after>/**
 * Copyright (c) <NAME>. All rights reserved.
 *
 * Licensed under the MIT License.
 * Please see LICENSE file located in the project root for more information.
 */

'use strict';

const childProcess = require('node:child_process');
const fs = require('node:fs');
const path = require('node:path');

const electron = require('electron');
const grunt = require('grunt');
const rimraf = require('rimraf');

const {ROOT_DIR} = require('./constant');
const {buildRelease} = require('./builder-wrapper');

function onRendererExit(code) {}

/* eslint-disable no-console */
function cleanBuild() {
    const done = this.async();

    rimraf(path.join(ROOT_DIR, '{out,dist}'), {disableGlob: false}, (error) => {
        if (error) {
            grunt.log.errorlns([`Could not clean-up: ${error}`]);
            return false;
        }

        grunt.log.oklns(['Cleaned up output directories.']);
        done();

        return true;
    });
}

/* eslint-disable no-console */
function startRenderer() {
    const done = this.async();

    const child = childProcess.spawn(electron, [ROOT_DIR, '--trace-warnings'], {
        stdio: ['pipe', process.stdout, process.stderr]
    });

    child.on('close', (code) => {
        grunt.log.writeln(`Renderer exited with code ${code}.`);
        done();
    });
}

function makeRelease() {
    if (!fs.existsSync(path.join(ROOT_DIR, 'out/platform/main.js'))) {
        grunt.fail.fatal('Project not compiled yet! Run `yarn run compile` first.', 0);
        return 0;
    }

    const done = this.async();
    const release = buildRelease();

    release.then((path) => {
        grunt.log.oklns([`Created release: ${path}`]);
    });

    release.catch((error) => {
        grunt.log.errorlns([`Unable to make release: ${error}`]);
    });

{'fraction_non_alphanumeric': 0.17223439211391017, 'fraction_numerical': 0.001095290251916758, 'mean_word_length': 3.2085253456221197, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '723931', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1108, 'n_words': 274}