<commit_before>const gulp         = require("gulp");
const lesshint     = require("gulp-lesshint");
const less         = require("gulp-less");
const autoprefixer = require("gulp-autoprefixer");
const cleanCSS     = require("gulp-clean-css");
const tslint       = require("tslint");
const gulpTslint   = require("gulp-tslint");
const ts           = require("gulp-typescript");
const pump         = require("pump");
const uglify       = require("gulp-uglify");
const banner       = require("gulp-banner");
const rename       = require("gulp-rename");
const watch        = require("gulp-watch");
const run          = require("gulp-run");
const connect      = require("gulp-connect");
const runSequence  = require("run-sequence");

const pkg         = require("./package.json");
const tsconfig    = ts.createProject("./tsconfig.json", {outFile: `${pkg.name}.js`});
const comment     = `/*!
* ${pkg.title} v${pkg.version} (${pkg.homepage})
* Copyright ${new Date().getUTCFullYear()} ${pkg.author}
* Licensed under ${pkg.license} (${pkg.repository.url}/blob/master/LICENSE)
*/
`;

gulp.task("lesshint", () =>
  gulp.src("./less/*.less")
    .pipe(lesshint({
      configPath: "./.lesshintrc"
    }))
    .pipe(lesshint.reporter())
    .pipe(lesshint.failOnError())
);

gulp.task("less", (callback) => {
  pump([
    gulp.src(`./less/${pkg.name}.less`),
    less(),
    autoprefixer({
      browsers: ["last 2 versions"],
      cascade: false
    }),
    gulp.dest("./css")
  ], callback);
});

gulp.task("minify-css", () => {
  return gulp.src(`./css/${pkg.name}.css`)
    .pipe(cleanCSS({ compatibility: "ie9" }))
    .pipe(banner(comment))
    .pipe(rename({ suffix: ".min" }))
    .pipe(gulp.dest("./css"));
});

gulp.task("tslint", () => {
  const program = tslint.Linter.createProgram("./tslint.json");
  return gulp.src("./ts/**/*.ts")
    .pipe(gulpTslint({program}))
    .pipe(gulpTslint.report({
      emitError: false,
      summarizeFailureOutput: true
    }));
});

gulp.task("ts", () =>
   gulp.src(["./ts/**/*.ts"])
    .pipe(tsconfig()).js
    .pipe(gulp.dest("./js"))
);

gulp.task("minify-js", (callback) => {
  pump([
    gulp.src(`./js/${pkg.name}.js`),
    uglify({
      toplevel: true,
      warnings: true,
      compress: {
        passes: 2
      },
      output: {
        ascii_only: true
      }<commit_msg>[Improve] rename tsconfig.<commit_after>const gulp         = require("gulp");
const lesshint     = require("gulp-lesshint");
const less         = require("gulp-less");
const autoprefixer = require("gulp-autoprefixer");
const cleanCSS     = require("gulp-clean-css");
const tslint       = require("tslint");
const gulpTslint   = require("gulp-tslint");
const ts           = require("gulp-typescript");
const pump         = require("pump");
const uglify       = require("gulp-uglify");
const banner       = require("gulp-banner");
const rename       = require("gulp-rename");
const watch        = require("gulp-watch");
const run          = require("gulp-run");
const connect      = require("gulp-connect");
const runSequence  = require("run-sequence");

const pkg         = require("./package.json");
const tsProject   = ts.createProject("./tsconfig.json", {outFile: `${pkg.name}.js`});
const comment     = `/*!
* ${pkg.title} v${pkg.version} (${pkg.homepage})
* Copyright ${new Date().getUTCFullYear()} ${pkg.author}
* Licensed under ${pkg.license} (${pkg.repository.url}/blob/master/LICENSE)
*/
`;

gulp.task("lesshint", () =>
  gulp.src("./less/*.less")
    .pipe(lesshint({
      configPath: "./.lesshintrc"
    }))
    .pipe(lesshint.reporter())
    .pipe(lesshint.failOnError())
);

gulp.task("less", (callback) => {
  pump([
    gulp.src(`./less/${pkg.name}.less`),
    less(),
    autoprefixer({
      browsers: ["last 2 versions"],
      cascade: false
    }),
    gulp.dest("./css")
  ], callback);
});

gulp.task("minify-css", () => {
  return gulp.src(`./css/${pkg.name}.css`)
    .pipe(cleanCSS({ compatibility: "ie9" }))
    .pipe(banner(comment))
    .pipe(rename({ suffix: ".min" }))
    .pipe(gulp.dest("./css"));
});

gulp.task("tslint", () => {
  const program = tslint.Linter.createProgram("./tslint.json");
  return gulp.src("./ts/**/*.ts")
    .pipe(gulpTslint({program}))
    .pipe(gulpTslint.report({
      emitError: false,
      summarizeFailureOutput: true
    }));
});

gulp.task("ts", () =>
  gulp.src(["./ts/**/*.ts"])
    .pipe(tsProject(ts.reporter.longReporter())).js
    .pipe(gulp.dest("./js"))
);

gulp.task("minify-js", (callback) => {
  pump([
    gulp.src(`./js/${pkg.name}.js`),
    uglify({
      toplevel: true,
      warnings: true,
      compress: {
        passes: 2
      },
      output: {
        ascii_only: true
      }
{'fraction_non_alphanumeric': 0.21439216521183735, 'fraction_numerical': 0.0012774111134766872, 'mean_word_length': 2.9746192893401013, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '2697656', 'n_tokens_mistral': 1647, 'n_tokens_neox': 1656, 'n_words': 266}