<commit_before>import gulp from 'gulp'
import gulpLoadPlugins from 'gulp-load-plugins'
import path from 'path'
import del from 'del'
import runSequence from 'run-sequence'
import babel from 'babel-core/register'

const plugins = gulpLoadPlugins()
const assets = require('./assets')

const paths = {
  js: ['./**/*.js', '!coverage/**', '!dist/**', '!node_modules/**', '!static/**', '!test/**'],
}

gulp.task('clean', () =>
  del(['dist/**', 'coverage/**', '!dist', '!coverage'])
)

gulp.task('assets', () => {
  gulp.src(assets.css)
    .pipe(plugins.newer('dist/public/assets/css'))
    .pipe(plugins.concat('app.css'))
    .pipe(plugins.minifyCss())
    .pipe(gulp.dest('dist/public/assets/css'))
    .pipe(plugins.zopfli())
    .pipe(gulp.dest('dist/public/assets/css'))

  gulp.src(assets.js)
    .pipe(plugins.newer('dist/public/assets/js'))
    .pipe(plugins.concat('app.js'))
    .pipe(plugins.uglify())
    .pipe(gulp.dest('dist/public/assets/js'))
    .pipe(plugins.zopfli())
    .pipe(gulp.dest('dist/public/assets/js'))

  gulp.src(assets.fonts)
    .pipe(plugins.newer('dist/public/assets/fonts'))
    .pipe(gulp.dest('dist/public/assets/fonts'))
    .pipe(plugins.zopfli())
    .pipe(gulp.dest('dist/public/assets/fonts'))

  gulp.src('static/assets/images/*')
    .pipe(plugins.newer('dist/public/assets/images'))
    .pipe(plugins.imagemin())
    .pipe(gulp.dest('dist/public/assets/images'))
})

gulp.task('babel', () => {
  const sourcemaps = {
    includeContent: false,
    sourceRoot(file) {
      return path.relative(file.path, __dirname)
    }
  }

  return gulp.src([...paths.js, '!gulpfile.babel.js'], { base: '.' })
    .pipe(plugins.newer('dist'))
    .pipe(plugins.sourcemaps.init())
    .pipe(plugins.babel())
    .pipe(plugins.sourcemaps.write('.', sourcemaps))<commit_msg>add static root files to assets pipeline<commit_after>import gulp from 'gulp'
import gulpLoadPlugins from 'gulp-load-plugins'
import path from 'path'
import del from 'del'
import runSequence from 'run-sequence'
import babel from 'babel-core/register'

const plugins = gulpLoadPlugins()
const assets = require('./assets')

const paths = {
  js: ['./**/*.js', '!coverage/**', '!dist/**', '!node_modules/**', '!static/**', '!test/**'],
}

gulp.task('clean', () =>
  del(['dist/**', 'coverage/**', '!dist', '!coverage'])
)

gulp.task('assets', () => {
  gulp.src(assets.css)
    .pipe(plugins.newer('dist/public/assets/css'))
    .pipe(plugins.concat('app.css'))
    .pipe(plugins.minifyCss())
    .pipe(gulp.dest('dist/public/assets/css'))
    .pipe(plugins.zopfli())
    .pipe(gulp.dest('dist/public/assets/css'))

  gulp.src(assets.js)
    .pipe(plugins.newer('dist/public/assets/js'))
    .pipe(plugins.concat('app.js'))
    .pipe(plugins.uglify())
    .pipe(gulp.dest('dist/public/assets/js'))
    .pipe(plugins.zopfli())
    .pipe(gulp.dest('dist/public/assets/js'))

  gulp.src(assets.fonts)
    .pipe(plugins.newer('dist/public/assets/fonts'))
    .pipe(gulp.dest('dist/public/assets/fonts'))
    .pipe(plugins.zopfli())
    .pipe(gulp.dest('dist/public/assets/fonts'))

  gulp.src('static/assets/images/*')
    .pipe(plugins.newer('dist/public/assets/images'))
    .pipe(plugins.imagemin())
    .pipe(gulp.dest('dist/public/assets/images'))

  gulp.src('static/*')
    .pipe(plugins.newer('dist/public'))
    .pipe(gulp.dest('dist/public'))
})

gulp.task('babel', () => {
  const sourcemaps = {
    includeContent: false,
    sourceRoot(file) {
      return path.relative(file.path, __dirname)
    }
  }

  return gulp.src([...paths.js, '!gulpfile.babel.js'], { base: '.' })
    .pipe(plugins.newer('dist'))
    .pipe(plugins.sourcemaps.init())
    .pipe(plugins.babel())
    .pipe(plugins.sourcemaps.write('.', sourcemaps))
{'fraction_non_alphanumeric': 0.2211203430715626, 'fraction_numerical': 0.0, 'mean_word_length': 3.8530559167750327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5065354', 'n_tokens_mistral': 1380, 'n_tokens_neox': 1346, 'n_words': 180}