<commit_before>var assign = require('object-assign');
var cwd = process.cwd();
var fs = require('fs');
var gat = require('gulp-auto-task');
var path = require('path');
var pkg = require(path.join(cwd, '/package.json'));
var semver = require('semver');
var sh = require('shelljs');

function replace (file, pattern, replacement) {
  var str = fs.readFileSync(file).toString();
  str = str.replace(pattern, replacement);
  fs.writeFileSync(file, str);
}

module.exports = function (done) {
  var opts = assign({
    type: 'patch'
  }, gat.opts());
  var currentVersion = pkg.version;
  var nextVersion = opts.semver || semver.inc(
    currentVersion,
    opts.type
  );

  sh.exec('gulp lint');
  sh.exec('gulp test');
  replace('bower.json', currentVersion, nextVersion);
  replace('package.json', currentVersion, nextVersion);
  sh.exec('gulp build');
  sh.exec('git commit -am "' + currentVersion + ' -> ' + nextVersion + '"');
  sh.exec('git tag -a ' + nextVersion + ' -m ' + nextVersion);
  sh.exec('git push');
  sh.exec('git push --tags');
  sh.exec('npm publish');
  done();
};<commit_msg>Automatically add / remove any dist and lib files before committing.<commit_after>var assign = require('object-assign');
var cwd = process.cwd();
var fs = require('fs');
var gat = require('gulp-auto-task');
var path = require('path');
var pkg = require(path.join(cwd, '/package.json'));
var semver = require('semver');
var sh = require('shelljs');

function replace (file, pattern, replacement) {
  var str = fs.readFileSync(file).toString();
  str = str.replace(pattern, replacement);
  fs.writeFileSync(file, str);
}

module.exports = function (done) {
  var opts = assign({
    type: 'patch'
  }, gat.opts());
  var currentVersion = pkg.version;
  var nextVersion = opts.semver || semver.inc(
    currentVersion,
    opts.type
  );

  sh.exec('gulp lint');
  sh.exec('gulp test');
  replace('bower.json', currentVersion, nextVersion);
  replace('package.json', currentVersion, nextVersion);
  sh.exec('gulp build');
  sh.exec('git add dist/ lib/');
  sh.exec('git commit -am "' + currentVersion + ' -> ' + nextVersion + '"');
  sh.exec('git tag -a ' + nextVersion + ' -m ' + nextVersion);
  sh.exec('git push');
  sh.exec('git push --tags');
  sh.exec('npm publish');
  done();
};
{'fraction_non_alphanumeric': 0.18525021949078138, 'fraction_numerical': 0.0, 'mean_word_length': 4.203196347031963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2830709', 'n_tokens_mistral': 756, 'n_tokens_neox': 746, 'n_words': 187}