<commit_before>var connect = require('connect'),
    fs = require("fs"),
    path = require("path"),
    sys = require("sys");

build(path.resolve(__dirname, "../../package.json"));

connect.createServer(
  connect.staticProvider({ root: path.join(__dirname, "files"), cache: true })
).listen(3000);

sys.puts("visit http://127.0.0.1:3000/vis.html");

function build(pkgFile, name, dest) {
  sys.puts("building...");
  var pkg = JSON.parse(fs.readFileSync(pkgFile || "package.json"));
  name = name || pkg.name;
  dest = dest || name + ".js";

  var code = "var " + name + " = " + getCode(pkg.main + ".js", " ");
  fs.writeFileSync(dest, code, "utf-8");
  sys.puts("> " + dest);
};

function getCode(file, indent) {
  sys.puts(indent + file);
  var code = fs.readFileSync(file, "utf-8");

  // replace all the require("mod")s with their code
  // can't handle dep cycles<commit_msg>put built browser file into root dir for visual test<commit_after>var connect = require('connect'),
    fs = require("fs"),
    path = require("path"),
    sys = require("sys");

var root = path.join(__dirname, "files");
build(path.resolve(__dirname, "../../package.json"));

connect.createServer(
  connect.staticProvider({ root: root, cache: true })
).listen(3000);

sys.puts("visit http://127.0.0.1:3000/vis.html");

function build(pkgFile, name, dest) {
  sys.puts("building...");
  var pkg = JSON.parse(fs.readFileSync(pkgFile || "package.json"));
  name = name || pkg.name;
  dest = dest || path.join(root, name + ".js");
  var code = "var " + name + " = " + getCode(pkg.main + ".js", " ");
  fs.writeFileSync(dest, code, "utf-8");
  sys.puts("> " + dest);
};

function getCode(file, indent) {
  sys.puts(indent + file);
  var code = fs.readFileSync(file, "utf-8");

  // replace all the require("mod")s with their code
  // can't handle dep cycles
{'fraction_non_alphanumeric': 0.2047930283224401, 'fraction_numerical': 0.017429193899782137, 'mean_word_length': 3.8215223097112863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3710299', 'n_tokens_mistral': 647, 'n_tokens_neox': 623, 'n_words': 148}