<commit_before>"use strict";

// ShellJS.
require('shelljs/global');

// Colors.
const chalk = require('chalk');


echo('Start building...');


/* TSLint with Codelyzer */
// https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts
// https://github.com/mgechev/codelyzer
echo('Start TSLint');

const Linter = require("tslint");
const configuration = require('./tslint.json');
const options = {
    formatter: 'json',
    configuration: configuration
};
let program = Linter.createProgram("tsconfig.json", "src/");
let files = Linter.getFileNames(program);
let results = files.map(file => {
    let fileContents = program.getSourceFile(file).getFullText();
    let linter = new Linter(file, fileContents, options, program);
    let result = linter.lint();

    if (result.failureCount > 0) {

        let failures = JSON.parse(result.output);
        for (let i = 0; i < failures.length; i++) {
            echo('TSLint:',
                chalk.yellow(failures[i].failure),
                chalk.white('[' + failures[i].startPosition.line +
                    ', ' + failures[i].startPosition.character + ']'),
                failures[i].name);
        }

    }

});

echo(chalk.green('TSLint completed'));


/* Cleans dist folder */
rm('-Rf', 'dist/*');


/* Aot compilation */
echo('Start AoT compilation');
echo('ngc -p tsconfig-build.json');

exec('ngc -p tsconfig-build.json');

echo(chalk.green('AoT compilation completed'));


/* Creates umd bundle */
echo('Start bundling');
echo('rollup -c rollup.config.js');

exec('rollup -c rollup.config.js');

echo(chalk.green('Bundling completed'));


/* Minimizes umd bundle */
echo('Start minification');

exec('uglifyjs ./dist/bundles/angular2localization.umd.js -o ./dist/bundles/angular2localization.umd.min.js');

echo(chalk.green('Minification completed'));


/* Copies files */
cp('-Rf', ['package.json', 'LICENSE', 'README.md'], 'dist');


echo('End building');
<commit_msg>Fix Linter<commit_after>"use strict";

// ShellJS.
require('shelljs/global');

// Colors.
const chalk = require('chalk');


echo('Start building...');


/* TSLint with Codelyzer */
// https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts
// https://github.com/mgechev/codelyzer
echo('Start TSLint');

const Linter = require("tslint");
const configuration = require('./tslint.json');
const options = {
    formatter: 'json',
    configuration: configuration
};
let program = Linter.createProgram("tsconfig.json", "src/");
let files = Linter.getFileNames(program);
let results = files.map(file => {
    let fileContents = program.getSourceFile(file).getFullText();
    let linter = new Linter(file, fileContents, options, program);
    let result = linter.lint();

    if (result.failureCount > 0) {

        let failures = JSON.parse(result.output);
        for (let i = 0; i < failures.length; i++) {
            echo('TSLint:',
                chalk.yellow(failures[i].failure),
                chalk.white('[' + (failures[i].startPosition.line + 1) +
                    ', ' + (failures[i].startPosition.character + 1) + ']'),
                failures[i].name);
        }

    }

});

echo(chalk.green('TSLint completed'));


/* Cleans dist folder */
rm('-Rf', 'dist/*');


/* Aot compilation */
echo('Start AoT compilation');
echo('ngc -p tsconfig-build.json');

exec('ngc -p tsconfig-build.json');

echo(chalk.green('AoT compilation completed'));


/* Creates umd bundle */
echo('Start bundling');
echo('rollup -c rollup.config.js');

exec('rollup -c rollup.config.js');

echo(chalk.green('Bundling completed'));


/* Minimizes umd bundle */
echo('Start minification');

exec('uglifyjs ./dist/bundles/angular2localization.umd.js -o ./dist/bundles/angular2localization.umd.min.js');

echo(chalk.green('Minification completed'));


/* Copies files */
cp('-Rf', ['package.json', 'LICENSE', 'README.md'], 'dist');


echo('End building');

{'fraction_non_alphanumeric': 0.18265541059094398, 'fraction_numerical': 0.0025581990278843694, 'mean_word_length': 3.4839449541284404, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '689063', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1258, 'n_words': 253}