<commit_before>const gulp = require('gulp');
const postHTML = require('gulp-posthtml');
const attrsSorter = require('posthtml-attrs-sorter');
const pretty = require('gulp-pretty-html');
const ora = require('ora');

const hasher = require('../modules/posthtml/hasher');

module.exports = () => {
  const settings = require(`${process.cwd()}/marmelad/settings.marmelad`);

  const htmlFmtOpts = {
    html: {
      indent_size: 4,
      indent_char: '',
      indent_with_tabs: true,
      wrap_line_length: 0,
      preserve_newlines: false,
      unformatted: ['code', 'pre', 'em', 'strong', 'span', 'i', 'b', 'br', 'symbol'],
    },
    ...settings.pretty,
  };

  gulp.task('format:html', (done) => {
    const htmlSpinner = ora('Format HTML started').start();

    gulp.src(`${settings.paths.dist}/**/*.html`)
      .pipe(pretty(htmlFmtOpts.html))
      .pipe(gulp.dest(settings.paths.dist));

    htmlSpinner.succeed('Format HTML done');

    done();
  });

  gulp.task('posthtml', (done) => {
    const dist = settings.dist || {
      attrsSorter: {},
      hasher: {},
    };

    const attrsSorterOpts = {
      order: [
        'id', 'class', 'name',
        'data-.+', 'ng-.+', 'src',
        'for', 'type', 'href',
        'values', 'title', 'alt',
        'role', 'aria-.+',
        '$unknown$',
      ],
      ...dist.attrsSorter,
    };

    const hasherOpts = {
      attributes: [],
      path: settings.paths.dist,
      ...dist.hasher,
    };

    gulp.src(`${settings.paths.dist}/**/*.html`)
      .pipe(postHTML([
        attrsSorter(attrsSorterOpts),
        hasher(hasherOpts),
      ]))
      .pipe(gulp.dest(settings.paths.dist));

    done();
  });

  gulp.series('format:html', 'posthtml')();
};<commit_msg>фикс неработающей цепочки команд mmd dist<commit_after>const gulp = require('gulp');
const postHTML = require('gulp-posthtml');
const attrsSorter = require('posthtml-attrs-sorter');
const pretty = require('gulp-pretty-html');
const ora = require('ora');

const hasher = require('../modules/posthtml/hasher');

module.exports = () => {
  const settings = require(`${process.cwd()}/marmelad/settings.marmelad`);

  const htmlFmtOpts = {
    html: {
      indent_size: 4,
      indent_char: '',
      indent_with_tabs: true,
      wrap_line_length: 0,
      preserve_newlines: false,
      unformatted: ['code', 'pre', 'em', 'strong', 'span', 'i', 'b', 'br', 'symbol'],
    },
    ...settings.pretty,
  };

  gulp.task('format:html', () => {
    // const htmlSpinner = ora('Format HTML started').start();

    return gulp.src(`${settings.paths.dist}/*.html`)
      .pipe(pretty(htmlFmtOpts))
      .pipe(gulp.dest(settings.paths.dist));

    // htmlSpinner.succeed('Format HTML done');
  });

  gulp.task('posthtml:tools', () => {
    const dist = settings.dist || {
      attrsSorter: {},
      hasher: {},
    };

    const attrsSorterOpts = {
      order: [
        'id', 'class', 'name',
        'data-.+', 'ng-.+', 'src',
        'for', 'type', 'href',
        'values', 'title', 'alt',
        'role', 'aria-.+',
        '$unknown$',
      ],
      ...dist.attrsSorter,
    };

    const hasherOpts = {
      attributes: [],
      path: settings.paths.dist,
      ...dist.hasher,
    };

    return gulp.src(`${settings.paths.dist}/*.html`)
      .pipe(postHTML([
        attrsSorter(attrsSorterOpts),
        hasher(hasherOpts),
      ]))
      .pipe(gulp.dest(settings.paths.dist));
  });

  gulp.series('format:html', 'posthtml:tools')();
};
{'fraction_non_alphanumeric': 0.20379419373383156, 'fraction_numerical': 0.0011497556769186547, 'mean_word_length': 2.7060702875399363, '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': '605953', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1195, 'n_words': 201}