<commit_before>import gulp from "gulp";
import babel from "gulp-babel";
import less from 'gulp-less';
import concat from 'gulp-concat';
import eslint from 'gulp-eslint';
import childProcess from 'child_process';
import electron from 'electron-prebuilt';
import del from 'del';
import env from 'gulp-env';
import packager from 'electron-packager';

import config from './src/config';
import npmPkgs from './package.json';

gulp.task("babel", ['lint'], () => {
  return gulp.src("src/**/*.js")
    .pipe(babel())
    .pipe(gulp.dest("dist"));
});

gulp.task('styles', ['lint'], () => {
  return gulp.src('src/source.less')
    .pipe(less())
    .pipe(gulp.dest('dist'));
});

gulp.task('lint', () => {
  return gulp.src('./src/**/*.js')
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());
});

gulp.task('run', [ 'babel', 'styles' ],
  () => {
    childProcess.spawn(electron, ['.'], { stdio: 'inherit' }); 
  });

gulp.task('clear-db', () => {
  return del([
    'dot-ansel/db.sqlite3',
    'dot-ansel/settings.json',
    'versions/**/*',
    'dot-ansel/thumbs/**/*',
    'dot-ansel/thumbs-250/**/*',
  ]);
});

gulp.task('clear-build', () => {
  return del([ 'build/**/*' ]);
});

gulp.task('set-env', () => {
  env({
    vars: {
      ANSEL_DEV_MODE: true
    }
  })
});

gulp.task('prepare-src', [ 'babel', 'styles', 'clear-build' ], 
  () => {
    return gulp
      .src([
        "dist/**/*", 
        "static/**/*",
        "menus/**/*",
        "migrations/**/*",
        "knexfile.js",
        "package.json"
      ], { base: '.' })
      .pipe(gulp.dest("build/prepared"));
  });

gulp.task('prepare-modules', [ 'prepare-src' ], () => {
  let modulesSrc = Object.keys(npmPkgs.dependencies)
    .filter((dependency) => (dependency != 'electron-prebuilt'))
    .map((dependency) => `node_modules/${dependency}/**/*`)

  return gulp.src(modulesSrc, { base: 'node_modules' })
    .pipe(gulp.dest("build/prepared/node_modules"))
});

gulp.task('package', [ 'prepare-src', 'prepare-modules' ], (cb) => {
  let opts = {
    arch: 'x64',
    dir: './build/prepared',
    ignore: /(txt$|md$|jpg$|jpeg$|cc$|license|example|sample|tests)/i,
    platform: 'linux',
    asar: false,
    out: './build',
    version: npmPkgs.dependencies['electron-prebuilt']
  };

  packager(opts, function done (err, appPath) { 
    console.log('done packaging', appPath);
    cb();
    process.exit(0);
  });
});

gulp.task('default', [ 'set-env', 'lint', 'babel', 'styles', 'run' ]);

gulp.task('build', [ 
  'lint', 
  'clear-build', 
  'babel', 
  'styles', 
  'prepare-src', 
  'prepare-modules', 
  'package' 
]);

gulp.task('clear', [
  'set-env',
  'clear-db',
  'babel',
  'styles',
  'run'
]);
<commit_msg>Copy sample folders otherwise create issues with bookshelfjs<commit_after>import gulp from "gulp";
import babel from "gulp-babel";
import less from 'gulp-less';
import concat from 'gulp-concat';
import eslint from 'gulp-eslint';
import childProcess from 'child_process';
import electron from 'electron-prebuilt';
import del from 'del';
import env from 'gulp-env';
import packager from 'electron-packager';

import config from './src/config';
import npmPkgs from './package.json';

gulp.task("babel", ['lint'], () => {
  return gulp.src("src/**/*.js")
    .pipe(babel())
    .pipe(gulp.dest("dist"));
});

gulp.task('styles', ['lint'], () => {
  return gulp.src('src/source.less')
    .pipe(less())
    .pipe(gulp.dest('dist'));
});

gulp.task('lint', () => {
  return gulp.src('./src/**/*.js')
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());
});

gulp.task('run', [ 'babel', 'styles' ],
  () => {
    childProcess.spawn(electron, ['.'], { stdio: 'inherit' }); 
  });

gulp.task('clear-db', () => {
  return del([
    'dot-ansel/db.sqlite3',
    'dot-ansel/settings.json',
    'versions/**/*',
    'dot-ansel/thumbs/**/*',
    'dot-ansel/thumbs-250/**/*',
  ]);
});

gulp.task('clear-build', () => {
  return del([ 'build/**/*' ]);
});

gulp.task('set-env', () => {
  env({
    vars: {
      ANSEL_DEV_MODE: true
    }
  })
});

gulp.task('prepare-src', [ 'babel', 'styles', 'clear-build' ], 
  () => {
    return gulp
      .src([
        "dist/**/*", 
        "static/**/*",
        "menus/**/*",
        "migrations/**/*",
        "knexfile.js",
        "package.json"
      ], { base: '.' })
      .pipe(gulp.dest("build/prepared"));
  });

gulp.task('prepare-modules', [ 'prepare-src' ], () => {
  let modulesSrc = Object.keys(npmPkgs.dependencies)
    .filter((dependency) => (dependency != 'electron-prebuilt'))
    .map((dependency) => `node_modules/${dependency}/**/*`)

  return gulp.src(modulesSrc, { base: 'node_modules' })
    .pipe(gulp.dest("build/prepared/node_modules"))
});

gulp.task('package', [ 'prepare-src', 'prepare-modules' ], (cb) => {
  let opts = {
    arch: 'x64',
    dir: './build/prepared',
    ignore: /(txt$|md$|jpg$|jpeg$|cc$|license|example|tests)/i,
    platform: 'linux',
    asar: false,
    out: './build',
    version: npmPkgs.dependencies['electron-prebuilt']
  };

  packager(opts, function done (err, appPath) { 
    console.log('done packaging', appPath);
    cb();
    process.exit(0);
  });
});

gulp.task('default', [ 'set-env', 'lint', 'babel', 'styles', 'run' ]);

gulp.task('build', [ 
  'lint', 
  'clear-build', 
  'babel', 
  'styles', 
  'prepare-src', 
  'prepare-modules', 
  'package' 
]);

gulp.task('clear', [
  'set-env',
  'clear-db',
  'babel',
  'styles',
  'run'
]);

{'fraction_non_alphanumeric': 0.2423525127458121, 'fraction_numerical': 0.0025491624180626364, 'mean_word_length': 3.2253846153846153, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '3577078', 'n_tokens_mistral': 2098, 'n_tokens_neox': 2021, 'n_words': 345}