<commit_before>/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author <NAME> @sokra
*/
require = require("enhanced-require")(module);

var cp = require('child_process');
var tc = require("./template-common");
var formatOutput = require("../lib/formatOutput");
var createFilenameShortener = require("../lib/createFilenameShortener");
var webpackGraph = require("webpack-graph");

var extraArgs = "";
if(require("fs").existsSync(require("path").join(process.cwd(), "webpackOptions.js")))
	extraArgs += "--options webpackOptions.js ";

cp.exec("node ../../bin/webpack.js --verbose --min "+extraArgs+" example.js js/output.js", function (error, stdout, stderr) {
	if(stderr)
		console.log(stderr);
	if (error !== null)
		console.log(error);
	var readme = tc(require("raw!"+require("path").join(process.cwd(), "template.md")), require.context("raw!"+process.cwd()), stdout.replace(/[\r\n]*$/, ""), "min");
	cp.exec("node ../../bin/webpack.js --filenames --verbose "+extraArgs+" example.js js/output.js --json", function (error, stdout, stderr) {
		if(stderr)
			console.log(stderr);
		if (error !== null)
			console.log(error);
		var stats = JSON.parse(stdout);
		var formatedStats = formatOutput(stats, {
			context: process.cwd(),
			verbose: true
		});
		var filenameShortener = createFilenameShortener(process.cwd());
		readme = tc(readme, require.context("raw!val!raw!"+process.cwd()), formatedStats.replace(/[\r\n]*$/, ""));
		readme = readme.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
		require("fs").writeFile("README.md", readme, "utf-8", function() {});
		require("fs").writeFile("graph.svg", webpackGraph(stats, {
			nameShortener: filenameShortener,
			width: 500,
			height: 300
		}), "utf-8", function() {});
	});
});<commit_msg>fixed building<commit_after>/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author <NAME> @sokra
*/
require = require("enhanced-require")(module);

var cp = require('child_process');
var tc = require("./template-common");
var formatOutput = require("../lib/formatOutput");
var createFilenameShortener = require("../lib/createFilenameShortener");
var webpackGraph = require("webpack-graph");
var fs = require("fs");

var extraArgs = "";
if(fs.existsSync(require("path").join(process.cwd(), "webpackOptions.js")))
	extraArgs += "--options webpackOptions.js ";

cp.exec("node ../../bin/webpack.js --verbose --min "+extraArgs+" example.js js/output.js", function (error, stdout, stderr) {
	if(stderr)
		console.log(stderr);
	if (error !== null)
		console.log(error);
	var readme = tc(require("raw!"+require("path").join(process.cwd(), "template.md")), require.context("raw!"+process.cwd()), stdout.replace(/[\r\n]*$/, ""), "min");
	cp.exec("node ../../bin/webpack.js --filenames --verbose "+extraArgs+" example.js js/output.js --json", function (error, stdout, stderr) {
		clean(require.contentCache);
		clean(require.sourceCache);
		clean(require.cache);
		if(stderr)
			console.log(stderr);
		if (error !== null)
			console.log(error);
		var stats = JSON.parse(stdout);
		var formatedStats = formatOutput(stats, {
			context: process.cwd(),
			verbose: true
		});
		var filenameShortener = createFilenameShortener(process.cwd());
		readme = tc(readme, require.context("raw!"+process.cwd()), formatedStats.replace(/[\r\n]*$/, ""));
		readme = readme.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
		fs.writeFile("README.md", readme, "utf-8", function() {});
		fs.writeFile("graph.svg", webpackGraph(stats, {
			nameShortener: filenameShortener,
			width: 500,
			height: 300
		}), "utf-8", function() {});
	});
});

function clean(obj) {
	for(var name in obj) {
		delete obj[name];
	}
}
{'fraction_non_alphanumeric': 0.2149685878175362, 'fraction_numerical': 0.004370390603660202, 'mean_word_length': 4.748822605965463, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6166710', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1227, 'n_words': 231}