<commit_before>var fs = require("fs");
var path = require("path");
var babel = require("babel");
var uglify = require("uglify-js");

var sourceDir = "src/";
var outputDir = "js/";

fs.readdir(sourceDir, function(err, files){
	if(err){
		throw err;
	}
	console.log("Packing code ...");
	var packedCode = "";

	packedCode += "(window)=>{";
	files.forEach(function(file, index, files){
		console.log("Reading " + file + " ...");
		packedCode += fs.readFileSync(path.join(sourceDir, file));
	});
	packedCode += "}(window);";

	console.log("Compiling code ...");
	var result = babel.transform(packedCode);
	var outputPath = path.join(outputDir, "vnwe");
	fs.writeFile(outputPath+".js", result.code, function(err){
		if(err){
			throw err;
		}
		console.log("Code has been compiled into vnwe.js !");
	});
	var minifiedCode = uglify.minify(result.code, {fromString: true}).code;
	fs.writeFile(outputPath+".min.js", minifiedCode, function (err) {
		if(err){
			throw err;
		}
		console.log("Code has been minified into vnwe.min.js !");
	});
});<commit_msg>Add license and remove comment in output files<commit_after>var fs = require("fs");
var path = require("path");
var babel = require("babel");
var uglify = require("uglify-js");

var sourceDir = "src/";
var outputDir = "js/";

fs.readdir(sourceDir, function(err, files){
	if(err){
		throw err;
	}
	console.log("Packing code ...");
	var license = "/** @license\n" + fs.readFileSync("LICENSE") + "*/\n\n";
	var packedCode = "";

	packedCode += "(window)=>{";
	files.forEach(function(file, index, files){
		console.log("Reading " + file + " ...");
		packedCode += fs.readFileSync(path.join(sourceDir, file));
	});
	packedCode += "}(window);";

	console.log("Compiling code ...");
	var result = babel.transform(packedCode, {comments: false});
	var outputPath = path.join(outputDir, "vnwe");
	fs.writeFile(outputPath+".js", license+result.code, function(err){
		if(err){
			throw err;
		}
		console.log("Code has been compiled into vnwe.js !");
	});
	var minifiedCode = uglify.minify(result.code, {fromString: true}).code;
	fs.writeFile(outputPath+".min.js", license+minifiedCode, function(err){
		if(err){
			throw err;
		}
		console.log("Code has been minified into vnwe.min.js !");
	});
});
{'fraction_non_alphanumeric': 0.19865771812080538, 'fraction_numerical': 0.0, 'mean_word_length': 4.59, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4339381', 'n_tokens_mistral': 831, 'n_tokens_neox': 785, 'n_words': 171}