build.js
function buildDistTable() {
	var builds = getBuilds();

	var branch = getCurBranch();

	var colWidths = {
		build: 0,
		"min / gz": 0,
		contents: 0,
		descr: 0,
	};

	var appendix = [];

	builds.forEach(function(build, i) {
		var buildName = build.build;

		var path = "dist/" + buildName + "/domvm." + buildName + ".min.js";

		appendix.push("["+(i+1)+"]: https://github.com/domvm/domvm/blob/" + branch + "/" + path);

		var minified = fs.readFileSync("./" + path, 'utf8');
		var gzipped = zlib.gzipSync(minified, {level: 6});

		var minLen = (minified.length / 1024).toFixed(1);
		var gzLen = (gzipped.length / 1024).toFixed(1);

		build["min / gz"] = minLen + "k / " + gzLen + "k";
		build.build = "[" + buildName + "][" + (i+1) + "]";

		for (var colName in colWidths)
			colWidths[colName] = Math.max(colWidths[colName], build[colName].length);
	});

	var table = '';

	for (var colName in colWidths)
		table += "| " + padRight(colName, " ", colWidths[colName] + 1);
	table += "|\n";

	for (var colName in colWidths)
		table += "| " + padRight("", "-", colWidths[colName]) + " ";
	table += "|\n";

	builds.forEach(function(build, i) {
		for (var colName in colWidths)
			table += "| " + padRight(build[colName], " ", colWidths[colName] + 1);
		table += "|\n";
	});

	table += "\n" + appendix.join("\n");

	fs.writeFileSync("./dist/README.md", table, 'utf8');
}
function buildDistTable() {
	var builds = getBuilds();

	var branch = getCurBranch();

	var colWidths = {
		build: 0,
		"min / gz": 0,
		contents: 0,
		descr: 0,
	};

	var appendix = [];

	builds.forEach(function(build, i) {
		var buildName = build.build;

		var path = "dist/" + buildName + "/domvm." + buildName + ".min.js";

		appendix.push("["+(i+1)+"]: https://github.com/domvm/domvm/blob/" + branch + "/" + path);

		var minified = fs.readFileSync("./" + path, 'utf8');
		var gzipped = zlib.gzipSync(minified, {level: 6});

		var minLen = (minified.length / 1024).toFixed(1);
		var gzLen = (gzipped.length / 1024).toFixed(1);

		build["min / gz"] = minLen + "k / " + gzLen + "k";
		build.build = "[" + buildName + "][" + (i+1) + "]";

		for (var colName in colWidths)
			colWidths[colName] = Math.max(colWidths[colName], build[colName].length);
	});

	var table = '';

	for (var colName in colWidths)
		table += "| " + padRight(colName, " ", colWidths[colName] + 1);
	table += "|\n";

	for (var colName in colWidths)
		table += "| " + padRight("", "-", colWidths[colName]) + " ";
	table += "|\n";

	builds.forEach(function(build, i) {
		for (var colName in colWidths)
			table += "| " + padRight(build[colName], " ", colWidths[colName] + 1);
		table += "|\n";
	});

	table += "\n" + appendix.join("\n");

	fs.writeFileSync("./dist/README.md", table, 'utf8');
}
function buildDistTable ( ) { var builds = getBuilds ( ) ; var branch = getCurBranch ( ) ; var colWidths = { build : 0 , "min / gz" : 0 , contents : 0 , descr : 0 , } ; var appendix = [ ] ; builds . forEach ( function ( build , i ) { var buildName = build . build ; var path = "dist/" + buildName + "/domvm." + buildName + ".min.js" ; appendix . push ( "[" + ( i + 1 ) + "]: https://github.com/domvm/domvm/blob/" + branch + "/" + path ) ; var minified = fs . readFileSync ( "./" + path , 'utf8' ) ; var gzipped = zlib . gzipSync ( minified , { level : 6 } ) ; var minLen = ( minified . length / 1024 ) . toFixed ( 1 ) ; var gzLen = ( gzipped . length / 1024 ) . toFixed ( 1 ) ; build [ "min / gz" ] = minLen + "k / " + gzLen + "k" ; build . build = "[" + buildName + "][" + ( i + 1 ) + "]" ; for ( var colName in colWidths ) colWidths [ colName ] = Math . max ( colWidths [ colName ] , build [ colName ] . length ) ; } ) ; var table = '' ; for ( var colName in colWidths ) table += "| " + padRight ( colName , " " , colWidths [ colName ] + 1 ) ; table += "|\n" ; for ( var colName in colWidths ) table += "| " + padRight ( "" , "-" , colWidths [ colName ] ) + " " ; table += "|\n" ; builds . forEach ( function ( build , i ) { for ( var colName in colWidths ) table += "| " + padRight ( build [ colName ] , " " , colWidths [ colName ] + 1 ) ; table += "|\n" ; } ) ; table += "\n" + appendix . join ( "\n" ) ; fs . writeFileSync ( "./dist/README.md" , table , 'utf8' ) ; }
builds markdown table
builds markdown table