<commit_before>'use strict';

module.exports = function(grunt) {
	let isTravisCi = (process.env.TRAVIS === 'true');

	const jsFiles = [
		// Connectors
		'connectors/**/*.js',
		// Core files
		'*.js', 'core/**/*.js', 'options/*.js', 'popups/*.js',
		// Scripts
		'scripts/*.js',
		// Tests
		'tests/**/*.js'
	];
	const jsonFiles = ['*.json', '.stylelintrc'];
	const htmlFiles = ['options/*.html', 'popups/*.html', 'dialogs/**/*.html'];
	const cssFiles = [
		'options/options.css', 'popups/*.css'
	];

	const extensionSources = [
		'connectors/**', 'core/**', 'icons/**',
		'options/**', 'popups/**', 'vendor/**',
		'manifest.json', 'README.md', 'LICENSE.txt',
		// Skip files
		'!core/content/testReporter.js', '!icons/src/**',
	];
	const buildDir = 'build';
	const packageName = 'web-scrobbler.zip';
	const packageSrcName = 'web-scrobbler-src.zip';

	grunt.initConfig({
		/**
		 * Configs of build tasks.
		 */

		clean: {
			build: buildDir,
			package: [packageName, packageSrcName],
			chrome: [
				`${buildDir}/icons/icon128_firefox.png`,
				`${buildDir}/icons/icon48_firefox.png`
			],
		},
		copy: {
			project_files: {
				expand: true,
				src: extensionSources,
				dest: buildDir,
			},
		},
		compress: {
			main: {
				options: {
					archive: packageName,
					pretty: true
				},
				expand: true,
				cwd: buildDir,
				src: '**/*',
			}
		},
		imagemin: {
			static: {
				options: {
					svgoPlugins: [{
						removeViewBox: false
					}],
				},
				files: [{
					expand: true,
					src: [
						`${buildDir}/icons/*.svg`,
						`${buildDir}/icons/*.png`
					]
				}]
			}
		},
		preprocess: {
			firefox: {
				src: `${buildDir}/**/*.js`,
				expand: true,
				options: {
					inline: true,
					context: {
						FIREFOX: true,
					}
				}
			},
			chrome: {
				src: `${buildDir}/**/*.js`,
				expand: true,
				options: {
					inline: true,
					context: {
						CHROME: true,
					}
				}
			}
		},
		rename: {
			firefox: {
				files: [{
					src: `${buildDir}/icons/icon128_firefox.png`,
					dest: `${buildDir}/icons/icon128.png`
				}, {
					src: `${buildDir}/icons/icon48_firefox.png`,
					dest: `${buildDir}/icons/icon48.png`
				}]
			}
		},
		replace_json: {
			firefox: {
				src: `${buildDir}/manifest.json`,
				changes: {
					'applications.gecko.id': '{799c0914-748b-41df-a25c-22d008f9e83f}'
				}
			},
		},

		/**
		 * Linter configs.<commit_msg>Include min Firefox version in manifest file<commit_after>'use strict';

module.exports = function(grunt) {
	let isTravisCi = (process.env.TRAVIS === 'true');

	const jsFiles = [
		// Connectors
		'connectors/**/*.js',
		// Core files
		'*.js', 'core/**/*.js', 'options/*.js', 'popups/*.js',
		// Scripts
		'scripts/*.js',
		// Tests
		'tests/**/*.js'
	];
	const jsonFiles = ['*.json', '.stylelintrc'];
	const htmlFiles = ['options/*.html', 'popups/*.html', 'dialogs/**/*.html'];
	const cssFiles = [
		'options/options.css', 'popups/*.css'
	];

	const extensionSources = [
		'connectors/**', 'core/**', 'icons/**',
		'options/**', 'popups/**', 'vendor/**',
		'manifest.json', 'README.md', 'LICENSE.txt',
		// Skip files
		'!core/content/testReporter.js', '!icons/src/**',
	];
	const buildDir = 'build';
	const packageName = 'web-scrobbler.zip';
	const packageSrcName = 'web-scrobbler-src.zip';

	grunt.initConfig({
		/**
		 * Configs of build tasks.
		 */

		clean: {
			build: buildDir,
			package: [packageName, packageSrcName],
			chrome: [
				`${buildDir}/icons/icon128_firefox.png`,
				`${buildDir}/icons/icon48_firefox.png`
			],
		},
		copy: {
			project_files: {
				expand: true,
				src: extensionSources,
				dest: buildDir,
			},
		},
		compress: {
			main: {
				options: {
					archive: packageName,
					pretty: true
				},
				expand: true,
				cwd: buildDir,
				src: '**/*',
			}
		},
		imagemin: {
			static: {
				options: {
					svgoPlugins: [{
						removeViewBox: false
					}],
				},
				files: [{
					expand: true,
					src: [
						`${buildDir}/icons/*.svg`,
						`${buildDir}/icons/*.png`
					]
				}]
			}
		},
		preprocess: {
			firefox: {
				src: `${buildDir}/**/*.js`,
				expand: true,
				options: {
					inline: true,
					context: {
						FIREFOX: true,
					}
				}
			},
			chrome: {
				src: `${buildDir}/**/*.js`,
				expand: true,
				options: {
					inline: true,
					context: {
						CHROME: true,
					}
				}
			}
		},
		rename: {
			firefox: {
				files: [{
					src: `${buildDir}/icons/icon128_firefox.png`,
					dest: `${buildDir}/icons/icon128.png`
				}, {
					src: `${buildDir}/icons/icon48_firefox.png`,
					dest: `${buildDir}/icons/icon48.png`
				}]
			}
		},
		replace_json: {
			firefox: {
				src: `${buildDir}/manifest.json`,
				changes: {
					'applications.gecko.id': '{799c0914-748b-41df-a25c-22d008f9e83f}',
					'applications.gecko.strict_min_version': '48.0'
				}
			},
		},

		/**
		 * Linter configs.
{'fraction_non_alphanumeric': 0.20722941055658245, 'fraction_numerical': 0.015814335592524133, 'mean_word_length': 2.3890048712595684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6219121', 'n_tokens_mistral': 2405, 'n_tokens_neox': 1852, 'n_words': 303}