<commit_before>(function () {
    'use strict';

    /*jshint -W079 */

    var jsonfile = require('jsonfile');
    var path = require('path');
    var fs = require('fs');
    var fsExt = require('fs-extra');
    var rmdir = require('rmdir');
    var child_process = require('child_process');
    var open = require('open');

    var devboxConfig, projectConfig, archiveName;
    var devboxPath = path.dirname(require.resolve('appsngen-dev-box'));
    var devboxCachePath = path.join(devboxPath, 'views', 'config.json');
    var devboxConfigPath = path.join(devboxPath, '/serverConfig.json');
    var errorHandler = function(error) {
        console.error(error.toString());
        process.exit(1);
    };

    try {
        devboxConfig = jsonfile.readFileSync(devboxConfigPath);
        projectConfig = jsonfile.readFileSync('./.appsngenrc');
    } catch (error) {
        errorHandler(error);
    }

    archiveName = path.basename(projectConfig.zipFilePath);
    rmdir(path.join(devboxPath, '/widgets'), function(error) {
        if (error) {
            errorHandler(error);
        }
        fs.mkdirSync(path.join(devboxPath, '/widgets'));
        fsExt.copySync(path.resolve(projectConfig.zipFilePath), path.join(devboxPath, '/widgets/', archiveName));
        devboxConfig.widgets = [path.join('/widgets/', archiveName)];
        jsonfile.writeFileSync(devboxConfigPath, devboxConfig, {
            spaces: 4
        });
        try {
            if (fs.statSync(devboxCachePath).isFile()) {
                fs.unlinkSync(devboxCachePath);
            }
        } catch (error) {
            if (error.code !== 'ENOENT') {
                errorHandler(error);
            }
        }
        child_process.fork('server.js', {
            cwd: devboxPath
        });
        open(devboxConfig.viewerProtocol + '://' + devboxConfig.devBoxHost + ':' + devboxConfig.devBoxPort +
        '/views/index.html');
        console.log('CTRL + C to shutdown dev-box server');
    });
})();<commit_msg>Fix widget preview command<commit_after>(function () {
    'use strict';

    /*jshint -W079 */

    var jsonfile = require('jsonfile');
    var path = require('path');
    var fs = require('fs');
    var fsExt = require('fs-extra');
    var child_process = require('child_process');
    var open = require('open');

    var devboxConfig, projectConfig, archiveName;
    var devboxPath = path.dirname(require.resolve('appsngen-dev-box'));
    var devboxCachePath = path.join(devboxPath, 'views', 'config.json');
    var devboxConfigPath = path.join(devboxPath, '/serverConfig.json');
    var errorHandler = function(error) {
        console.error(error.toString());
        process.exit(1);
    };

    try {
        devboxConfig = jsonfile.readFileSync(devboxConfigPath);
        projectConfig = jsonfile.readFileSync('./.appsngenrc');
    } catch (error) {
        errorHandler(error);
    }

    archiveName = path.basename(projectConfig.zipFilePath);
    fsExt.remove(path.join(devboxPath, '/widgets'), function(error) {
        if (error) {
            errorHandler(error);
        }
        fs.mkdirSync(path.join(devboxPath, '/widgets'));
        fsExt.copySync(path.resolve(projectConfig.zipFilePath), path.join(devboxPath, '/widgets/', archiveName));
        devboxConfig.widgets = [path.join('/widgets/', archiveName)];
        jsonfile.writeFileSync(devboxConfigPath, devboxConfig, {
            spaces: 4
        });
        try {
            if (fs.statSync(devboxCachePath).isFile()) {
                fs.unlinkSync(devboxCachePath);
            }
        } catch (err) {
            if (err.code !== 'ENOENT') {
                errorHandler(err);
            }
        }
        child_process.fork('server.js', {
            cwd: devboxPath
        });
        open(devboxConfig.viewerProtocol + '://' + devboxConfig.devBoxHost + ':' + devboxConfig.devBoxPort +
        '/views/index.html');
        console.log('CTRL + C to shutdown dev-box server');
    });
})();
{'fraction_non_alphanumeric': 0.14748743718592966, 'fraction_numerical': 0.002512562814070352, 'mean_word_length': 2.5136804942630184, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6521553', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1167, 'n_words': 198}