<commit_before>/* jshint node:true */

module.exports = function (grunt) {
	grunt.loadNpmTasks('grunt-ts');
	grunt.loadNpmTasks('grunt-peg');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('intern-geezer');

	grunt.initConfig({
		// TODO: Always build, or never build, tests
		all: [ '**/*.ts', '!node_modules/**/*.ts', '!**/tests/integration/**' ],
		ignoreDefinitions: [ '<%= all %>', '!**/*.d.ts' ],

		clean: {
			framework: {
				src: [
					'**/*.js', '**/*.d.ts', '**/*.js.map', '!node_modules/**/*'
				],
				filter: function (filepath) {
					// Only clean the file if there is an associated .ts file
					var sourceFile = filepath.match(/(.*)\.(?:js(?:\.map)?|d\.ts)$/)[1] + '.ts';

					return grunt.file.exists(filepath) && grunt.file.isFile(sourceFile);
				}<commit_msg>Improve clean operation to remove JS and map files for moved files<commit_after>/* jshint node:true */

module.exports = function (grunt) {
	grunt.loadNpmTasks('grunt-ts');
	grunt.loadNpmTasks('grunt-peg');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('intern-geezer');

	grunt.initConfig({
		// TODO: Always build, or never build, tests
		all: [ '**/*.ts', '!node_modules/**/*.ts', '!**/tests/integration/**' ],
		ignoreDefinitions: [ '<%= all %>', '!**/*.d.ts' ],

		clean: {
			framework: {
				src: [
					'**/{*.js,*.js.map}', '!node_modules/**/*', '!third-party/**/*'
				],
				filter: function (filepath) {
					var jsName = filepath.match(/(.*\.js)(?:\.map)?$/)[1];

					// Only clean .js and .js.map files if BOTH the JavaScript and the map file exist.
					// Since the only thing generating map files is grunt-ts, this targets only the
					// JavaScript files generated by that process (including JavaScript files
					// generated for TypeScript files that have been moved or deleted).
					return grunt.file.exists(jsName) && grunt.file.exists(jsName + '.map');
				}
{'fraction_non_alphanumeric': 0.20933734939759036, 'fraction_numerical': 0.001004016064257028, 'mean_word_length': 3.4586129753914987, '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': '2582683', 'n_tokens_mistral': 793, 'n_tokens_neox': 696, 'n_words': 154}