<commit_before>const fs = require('fs-extra')
const ts = require('typescript')
const async = require('async')

const postcss = require('postcss')

const path = require('path')
const exec = require('child_process').exec;

const { PROJECT_ROOT, destFilePath, ensureWrite, copy } = require('./util')

function compile(files, production) {
	return new Promise(function(resolve, reject) {
		async.each(files, (fileName, done) => {
			// ignore tests in production
			if(production && fileName.match(/.*(\/|\\)test(\/|\\).*/)) {
				done()
				return 
			}
			var ext = path.extname(fileName)
			let relPath = path.relative(PROJECT_ROOT, fileName)
			switch(ext) {
				case '.ts':
				case '.tsx':
					compileTs(fileName, production)
					if(relPath.match(/^(\.(\/|\\))?frontend(\/|\\)(app|admin).*/)) {
						compileTsToES6(fileName, production)
					}
					done()
					break;
				case '.pcss':
					compilePostCSS(fileName, production)
					.then(() => {
						done()
					})
					break;
				default:
					copy(relPath, production)
					done()
					break;
			}
		},
		err => {
			if(err) {
				console.log(err)
				reject(err)
			} else {<commit_msg>Fixed error in es6 compile.<commit_after>const fs = require('fs-extra')
const ts = require('typescript')
const async = require('async')

const postcss = require('postcss')

const path = require('path')
const exec = require('child_process').exec;

const { PROJECT_ROOT, destFilePath, ensureWrite, copy } = require('./util')

function compile(files, production) {
	return new Promise(function(resolve, reject) {
		async.each(files, (fileName, done) => {
			// ignore tests in production
			if(production && fileName.match(/.*(\/|\\)test(\/|\\).*/)) {
				done()
				return 
			}
			var ext = path.extname(fileName)
			let relPath = path.relative(PROJECT_ROOT, fileName)
			switch(ext) {
				case '.ts':
				case '.tsx':
					compileTs(fileName, production)
					if(relPath.match(/^(\.(\/|\\))?frontend(\/|\\).*/)) {
						compileTsToES6(fileName, production)
					}
					done()
					break;
				case '.pcss':
					compilePostCSS(fileName, production)
					.then(() => {
						done()
					})
					break;
				default:
					copy(relPath, production)
					done()
					break;
			}
		},
		err => {
			if(err) {
				console.log(err)
				reject(err)
			} else {
{'fraction_non_alphanumeric': 0.17675228558989986, 'fraction_numerical': 0.00130605137135394, 'mean_word_length': 2.8817567567567566, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3059296', 'n_tokens_mistral': 962, 'n_tokens_neox': 763, 'n_words': 160}