<commit_before>var gulp = require('gulp');
var bower = require('gulp-bower');
var ts = require('gulp-typescript');
var typescript = require('typescript');
var merge = require('merge2');
var concat = require('gulp-concat');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var clean = require('gulp-clean');
var sourcemaps = require('gulp-sourcemaps');
var karmaServer = require('karma').Server;
var rev = require('gulp-rev');
var revReplace = require('gulp-rev-replace');
var gulpFilter = require('gulp-filter');


var tmpDir = function(path) {return './tmp/' + path};
var testTmpDir = function(path) {return './tmp/test/' + path};
var appDir = function(path) {return './app/' + path};
var bowerDir = function(path) {return './bower_components/' + path};
var nodeDir = function(path) {return './node_modules/' + path};
var releaseTmpDir = function(path) {return './tmp/release/' + path};
var releaseDir = function(path) {return './release/' + path};


gulp.task('bower', function() {
  return bower()
});

// HTML
gulp.task('html', ['bower'], function() {
    return gulp.src('app/*.html')
        .pipe(gulp.dest(releaseTmpDir('')))
});


gulp.task('scripts-libs', ['bower'], function() {
    var min = '';
    return gulp.src([
        nodeDir('react/dist/react'+min+'.js'),
        nodeDir('react-dom/dist/react-dom'+min+'.js'),
        nodeDir('history/umd/History' +min+ '.js'),
        nodeDir('react-router/umd/ReactRouter' +min+ '.js'),
        nodeDir('classnames/index.js'),
        bowerDir('jquery/dist/jquery'+min+'.js'),
        bowerDir('bootstrap-sass/assets/javascripts/bootstrap'+min+'.js'),
        nodeDir('immutable/dist/immutable' +min+ '.js')
    ]).pipe(concat('libs.js')).pipe(gulp.dest(releaseTmpDir('scripts/')))
});


gulp.task('scripts', ['bower'], function () {

    var tsResult = gulp.src([appDir('scripts/main/**/*.ts*'), appDir('scripts/main/libs.d/**/*.d.ts')])
        .pipe(ts({
            'module': 'amd',
            'noImplicitAny': true,
            'removeComments': true,
            'preserveConstEnums': true,
            'sourceMap': true,
            'declaration': true,
            'target': 'ES5',
            'jsx': 'React',
            sortOutput: true,
            gulpConcat: true,
            gulpSourcemaps: true,
            noExternalResolve: true,
            typescript: typescript
        }));


    return merge([
        tsResult.dts.pipe(concat('main.d.ts')).pipe(gulp.dest(releaseTmpDir('scripts'))),
        tsResult.js.pipe(concat('main.js')).pipe(gulp.dest(releaseTmpDir('scripts')))
    ]);
});


gulp.task('test-scripts', function () {

    var tsResult = gulp.src([appDir('scripts/test/**/*.ts'), appDir('scripts/test/libs.d/**/*.d.ts'),
                             appDir('scripts/main/utils/*.ts*'), appDir('scripts/main/libs.d/**/*.d.ts')],
                            {base: appDir('scripts')})
        .pipe(ts({
            'module': 'amd',
            'noImplicitAny': true,
            'removeComments': true,
            'preserveConstEnums': true,
            'sourceMap': true,
            'declaration': true,
            'target': 'ES5',
            'jsx': 'React',
            sortOutput: true,
            gulpConcat: true,
            gulpSourcemaps: true,
            noExternalResolve: true,
            typescript: typescript
        }));


    return merge([
        tsResult.dts.pipe(gulp.dest(testTmpDir('scripts'))),
        tsResult.js.pipe(gulp.dest(testTmpDir('scripts')))
    ]);
});



gulp.task('styles', ['bower'], function () {
    gulp.src(appDir('styles/**/*.scss'))
        .pipe(sourcemaps.init())<commit_msg>Source maps added to built javascript<commit_after>var gulp = require('gulp');
var bower = require('gulp-bower');
var ts = require('gulp-typescript');
var typescript = require('typescript');
var merge = require('merge2');
var concat = require('gulp-concat');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var clean = require('gulp-clean');
var sourcemaps = require('gulp-sourcemaps');
var karmaServer = require('karma').Server;
var rev = require('gulp-rev');
var revReplace = require('gulp-rev-replace');
var gulpFilter = require('gulp-filter');


var tmpDir = function(path) {return './tmp/' + path};
var testTmpDir = function(path) {return './tmp/test/' + path};
var appDir = function(path) {return './app/' + path};
var bowerDir = function(path) {return './bower_components/' + path};
var nodeDir = function(path) {return './node_modules/' + path};
var releaseTmpDir = function(path) {return './tmp/release/' + path};
var releaseDir = function(path) {return './release/' + path};


gulp.task('bower', function() {
  return bower()
});

// HTML
gulp.task('html', ['bower'], function() {
    return gulp.src('app/*.html')
        .pipe(gulp.dest(releaseTmpDir('')))
});


gulp.task('scripts-libs', ['bower'], function() {
    var min = '';
    return gulp.src([
        nodeDir('react/dist/react'+min+'.js'),
        nodeDir('react-dom/dist/react-dom'+min+'.js'),
        nodeDir('history/umd/History' +min+ '.js'),
        nodeDir('react-router/umd/ReactRouter' +min+ '.js'),
        nodeDir('classnames/index.js'),
        bowerDir('jquery/dist/jquery'+min+'.js'),
        bowerDir('bootstrap-sass/assets/javascripts/bootstrap'+min+'.js'),
        nodeDir('immutable/dist/immutable' +min+ '.js')
    ]).pipe(concat('libs.js')).pipe(gulp.dest(releaseTmpDir('scripts/')))
});


gulp.task('scripts', ['bower'], function () {

    var tsResult = gulp.src([appDir('scripts/main/**/*.ts*'), appDir('scripts/main/libs.d/**/*.d.ts')])
        .pipe(sourcemaps.init()) // This means sourcemaps will be generated
        .pipe(ts({
            'module': 'amd',
            'noImplicitAny': true,
            'removeComments': true,
            'preserveConstEnums': true,
            'declaration': true,
            'target': 'ES5',
            'jsx': 'React',
            sortOutput: true,
            gulpConcat: true,
            gulpSourcemaps: true,
            noExternalResolve: true,
            typescript: typescript
        }));


    return merge([
        tsResult.dts.pipe(concat('main.d.ts')).pipe(gulp.dest(releaseTmpDir('scripts'))),
        tsResult.js
            .pipe(concat('main.js'))
            .pipe(sourcemaps.write("../maps")) // Now the sourcemaps are added to the .js file
            .pipe(gulp.dest(releaseTmpDir('scripts')))
    ]);
});


gulp.task('test-scripts', function () {

    var tsResult = gulp.src([appDir('scripts/test/**/*.ts'), appDir('scripts/test/libs.d/**/*.d.ts'),
                             appDir('scripts/main/utils/*.ts*'), appDir('scripts/main/libs.d/**/*.d.ts')],
                            {base: appDir('scripts')})
        .pipe(ts({
            'module': 'amd',
            'noImplicitAny': true,
            'removeComments': true,
            'preserveConstEnums': true,
            'declaration': true,
            'target': 'ES5',
            'jsx': 'React',
            sortOutput: true,
            gulpConcat: true,
            gulpSourcemaps: true,
            noExternalResolve: true,
            typescript: typescript
        }));


    return merge([
        tsResult.dts.pipe(gulp.dest(testTmpDir('scripts'))),
        tsResult.js.pipe(gulp.dest(testTmpDir('scripts')))
    ]);
});



gulp.task('styles', ['bower'], function () {
    gulp.src(appDir('styles/**/*.scss'))
        .pipe(sourcemaps.init())
{'fraction_non_alphanumeric': 0.19450770261219022, 'fraction_numerical': 0.0008037508372404555, 'mean_word_length': 2.723690773067332, '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': '4278510', 'n_tokens_mistral': 2392, 'n_tokens_neox': 2370, 'n_words': 421}