<commit_before>var _ = require('./lib/underscore'),
    config = require('./config'),
    fs = require('fs'),
    child_process = require('child_process');

var server_deps = config.SERVER_DEPS.slice();
var client_deps = config.CLIENT_DEPS.slice();
server_deps.push('index.html');

var server;
var start_server = _.debounce(function () {
	if (server)
		server.kill('SIGTERM');
	server = child_process.spawn('node', ['server.js']);
	server.stdout.pipe(process.stdout);
	server.stderr.pipe(process.stderr);
}, 500);

var build_client = _.debounce(function () {
	var make = child_process.execFile('make', ['-s', '-q', 'client']);
	make.once('exit', function (code) {
		if (!code)
			return;
		console.log('make client');
		var make = child_process.execFile('make', ['-q', 'client']);
		make.stdout.pipe(process.stdout);
		make.stderr.pipe(process.stderr);
	});
}, 500);

server_deps.forEach(monitor.bind(null, start_server));
client_deps.forEach(monitor.bind(null, build_client));

function monitor(func, dep) {
	var mtime = new Date;
	fs.watchFile(dep, function (event) {
		if (event.mtime > mtime) {
			func();
			mtime = event.mtime;
		}
	});
}

start_server();
build_client();
<commit_msg>Actually build the client in builder<commit_after>var _ = require('./lib/underscore'),
    config = require('./config'),
    fs = require('fs'),
    child_process = require('child_process');

var server_deps = config.SERVER_DEPS.slice();
var client_deps = config.CLIENT_DEPS.slice();
server_deps.push('index.html');

var server;
var start_server = _.debounce(function () {
	if (server)
		server.kill('SIGTERM');
	server = child_process.spawn('node', ['server.js']);
	server.stdout.pipe(process.stdout);
	server.stderr.pipe(process.stderr);
}, 500);

var build_client = _.debounce(function () {
	var make = child_process.execFile('make', ['-s', '-q', 'client']);
	make.once('exit', function (code) {
		if (!code)
			return;
		console.log('make client');
		var make = child_process.execFile('make', ['-s', 'client']);
		make.stdout.pipe(process.stdout);
		make.stderr.pipe(process.stderr);
	});
}, 500);

server_deps.forEach(monitor.bind(null, start_server));
client_deps.forEach(monitor.bind(null, build_client));

function monitor(func, dep) {
	var mtime = new Date;
	fs.watchFile(dep, function (event) {
		if (event.mtime > mtime) {
			func();
			mtime = event.mtime;
		}
	});
}

start_server();
build_client();

{'fraction_non_alphanumeric': 0.18643362463587182, 'fraction_numerical': 0.004993757802746567, 'mean_word_length': 4.921182266009852, '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': '5170999', 'n_tokens_mistral': 873, 'n_tokens_neox': 827, 'n_words': 157}