<commit_before>'use strict';

var browserSync = require('browser-sync');
var browserify = require('browserify');
var gulp = require('gulp');
var gutil = require('gulp-util');
var ignore = require('gulp-ignore');
var imagemin = require('gulp-imagemin');
var jade = require('gulp-jade');
var linter = require('gulp-jshint');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var cfg = require('../../config');

var DEBUG = process.env.NODE_ENV === 'dev';

gulp.task('build-all', [
  'build-assets', 'build-markup', 'build-scripts', 'build-stylesheets',
  'build-vendors'
]);

gulp.task('build-assets', ['build-audio', 'build-fonts', 'build-images']);

gulp.task('build-audio', ['clean-audio'], function () {
  gulp.src('./assets/audio/**/*')
    .pipe(gulp.dest('./dist/assets/audio/'))
    .pipe(browserSync.reload({stream: true, once: true}));
});

gulp.task('build-fonts', ['clean-fonts'], function () {
  gulp.src('./assets/fonts/**/*')
    .pipe(gulp.dest('./dist/assets/fonts'))
    .pipe(browserSync.reload({stream: true, once: true}));
});

gulp.task('build-images', ['clean-images'], function () {
  gulp.src(['./assets/*.jpg', './assets/*.png'])
    .pipe(imagemin())
    .pipe(gulp.dest('./dist/assets/'))
    .pipe(browserSync.reload({stream: true, once: true}));
});

gulp.task('build-markup', ['clean-markup'], function () {
  gulp.src('./src/*jade')
    .pipe(jade({
      pretty: DEBUG,
      data: {
        name: cfg.name,
        debug: DEBUG
      }
    }))
    .pipe(gulp.dest('./dist/'))
    .pipe(browserSync.reload({stream: true}));
});

gulp.task('build-scripts', ['lint', 'clean-scripts'], function () {
  browserify('./src/scripts/main.js', {debug: DEBUG})
    .bundle()
    .on('error', function (err) {
      gutil.log(err.message);
    })
    .pipe(source('game.js'))
    .pipe(gulp.dest('./dist/js/'))
    .pipe(browserSync.reload({stream: true, once: true}));
});

gulp.task('build-stylesheets', ['clean-stylesheets'], function () {
  gulp.src('./src/stylesheets/*.scss')
    .pipe(sass())
    .pipe(gulp.dest('./dist/css/'))
    .pipe(browserSync.reload({stream: true}));
});

gulp.task('build-vendors', ['clean-vendors'], function () {
  gulp.src('./bower_components/phaser-official/build/phaser*')
    .pipe(ignore('*.ts'))
    .pipe(gulp.dest('./dist/js/'));
});

gulp.task('lint', function () {
  gulp.src('./src/scripts/**/*.js')
    .pipe(linter())
    .pipe(linter.reporter('jshint-stylish'));
});

gulp.task('uglify', ['clean-uglified'], function () {
  gulp.src('./dist/js/game.js')
    .pipe(rename('game.min.js'))
    .pipe(uglify())
    .pipe(gulp.dest('./dist/js/'));
});<commit_msg>The build-vendors task doesn't depend anymore on a hardcoded bower_components directory<commit_after>'use strict';

var fs = require('fs');
var browserSync = require('browser-sync');
var browserify = require('browserify');
var gulp = require('gulp');
var gutil = require('gulp-util');
var ignore = require('gulp-ignore');
var imagemin = require('gulp-imagemin');
var jade = require('gulp-jade');
var linter = require('gulp-jshint');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var cfg = require('../../config');

var DEBUG = process.env.NODE_ENV === 'dev';

gulp.task('build-all', [
  'build-assets', 'build-markup', 'build-scripts', 'build-stylesheets',
  'build-vendors'
]);

gulp.task('build-assets', ['build-audio', 'build-fonts', 'build-images']);

gulp.task('build-audio', ['clean-audio'], function () {
  gulp.src('./assets/audio/**/*')
    .pipe(gulp.dest('./dist/assets/audio/'))
    .pipe(browserSync.reload({stream: true, once: true}));
});

gulp.task('build-fonts', ['clean-fonts'], function () {
  gulp.src('./assets/fonts/**/*')
    .pipe(gulp.dest('./dist/assets/fonts'))
    .pipe(browserSync.reload({stream: true, once: true}));
});

gulp.task('build-images', ['clean-images'], function () {
  gulp.src(['./assets/*.jpg', './assets/*.png'])
    .pipe(imagemin())
    .pipe(gulp.dest('./dist/assets/'))
    .pipe(browserSync.reload({stream: true, once: true}));
});

gulp.task('build-markup', ['clean-markup'], function () {
  gulp.src('./src/*jade')
    .pipe(jade({
      pretty: DEBUG,
      data: {
        name: cfg.name,
        debug: DEBUG
      }
    }))
    .pipe(gulp.dest('./dist/'))
    .pipe(browserSync.reload({stream: true}));
});

gulp.task('build-scripts', ['lint', 'clean-scripts'], function () {
  browserify('./src/scripts/main.js', {debug: DEBUG})
    .bundle()
    .on('error', function (err) {
      gutil.log(err.message);
    })
    .pipe(source('game.js'))
    .pipe(gulp.dest('./dist/js/'))
    .pipe(browserSync.reload({stream: true, once: true}));
});

gulp.task('build-stylesheets', ['clean-stylesheets'], function () {
  gulp.src('./src/stylesheets/*.scss')
    .pipe(sass())
    .pipe(gulp.dest('./dist/css/'))
    .pipe(browserSync.reload({stream: true}));
});

gulp.task('build-vendors', ['clean-vendors'], function () {
  var bowerConfig = JSON.parse(fs.readFileSync('./.bowerrc', 'utf8'));

  gulp.src('./' + bowerConfig['directory'] + '/phaser/build/phaser*')
    .pipe(ignore('*.ts'))
    .pipe(gulp.dest('./dist/js/'));
});

gulp.task('lint', function () {
  gulp.src('./src/scripts/**/*.js')
    .pipe(linter())
    .pipe(linter.reporter('jshint-stylish'));
});

gulp.task('uglify', ['clean-uglified'], function () {
  gulp.src('./dist/js/game.js')
    .pipe(rename('game.min.js'))
    .pipe(uglify())
    .pipe(gulp.dest('./dist/js/'));
});
{'fraction_non_alphanumeric': 0.2496894409937888, 'fraction_numerical': 0.0001774622892635315, 'mean_word_length': 3.8502581755593805, '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': '7129707', 'n_tokens_mistral': 2041, 'n_tokens_neox': 2012, 'n_words': 305}