<commit_before>(function() {
	var components = getComponents();
	var localServerOptions = {
		port: 3000
	};
	createLocalServer(components, localServerOptions);
	generateGithubPage(components);
})();

/**
 * Get the components to serve, as an array looking like [{name, path}, ...]
 * @return {array} Components to serve
 */
function getComponents() {
	var componentsConfig = require('./package.json').components.sort(function(a, b){
		if(a.name > b.name){
			return 1;
		}
		if (a.name < b.name){
			return -1;
		}
		return 0;
	});
	return componentsConfig.reduce(function(components, component) {
		var path = '/src/' + component.path + '/example/';
		console.log('route', component.name, 'path', path);
		components[component.name] = path;
		return components;
	}, {});
}

/**
 * Create local web server.
 * @param  {array} components        components to serve
 * @param  {object} localServerOptions server options
 */
function createLocalServer(components, localServerOptions) {
	var express = require('express');
	var app = express();

	// Add static paths

	Object.keys(components).map(function(componentName) {
		var component = components[componentName];
		app.use('/' + componentName, express.static(__dirname + component));
	});

	app.use('/focus-components/example', express.static(__dirname + "/example"));
	app.use('/focus-components/dist', express.static(__dirname + "/dist"));

	// EXPERIMENTAL : showcase

	app.use('/showcase', express.static(__dirname + '/src/showcase'));

	// Generate content

	var localServerContent = buildPageHtml(localServerOptions, components);

	// Add a special 404 with all existing components and their urls.
	app.use(function(req, res, next) {
		res.status(404).send(localServerContent);
	});<commit_msg>[server] Remove static routes to individual components<commit_after>(function() {
	var components = getComponents();
	var localServerOptions = {
		port: 3000
	};
	createLocalServer(components, localServerOptions);
	generateGithubPage(components);
})();

/**
 * Get the components to serve, as an array looking like [{name, path}, ...]
 * @return {array} Components to serve
 */
function getComponents() {
	var componentsConfig = require('./package.json').components.sort(function(a, b){
		if(a.name > b.name){
			return 1;
		}
		if (a.name < b.name){
			return -1;
		}
		return 0;
	});
	return componentsConfig.reduce(function(components, component) {
		var path = '/src/' + component.path + '/example/';
		console.log('route', component.name, 'path', path);
		components[component.name] = path;
		return components;
	}, {});
}

/**
 * Create local web server.
 * @param  {array} components        components to serve
 * @param  {object} localServerOptions server options
 */
function createLocalServer(components, localServerOptions) {
	var express = require('express');
	var app = express();

	// Add static paths

	// EXPERIMENTAL : showcase

	app.use('/showcase', express.static(__dirname + '/showcase'));

	app.use('/focus-components/example', express.static(__dirname + "/example"));
	app.use('/focus-components/dist', express.static(__dirname + "/dist"));

{'fraction_non_alphanumeric': 0.15606936416184972, 'fraction_numerical': 0.006422607578676943, 'mean_word_length': 4.407986111111111, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7510640', 'n_tokens_mistral': 968, 'n_tokens_neox': 904, 'n_words': 233}