<commit_before>module.exports = function(grunt) {

  var exec = require('child_process').exec;

  /**
   * Show content of the package to double check before publishing
   */
  grunt.registerTask('npm-show', 'Show files that would be published to npm.', function() {
    var done = this.async();

    exec('npm pack', function(err, pkgFile) {
      exec('tar -tf ' + pkgFile, function(err, pkgContent) {
        console.log(pkgContent);
        exec('rm ' + pkgFile, done);
      });
    });
  });


  /**
   * Publish to NPM
   */
  grunt.registerTask('npm-publish', 'Publish to NPM.', function() {
    this.requires('build');

    var done = this.async();
    var pkg = grunt.config('pkg');
    var minor = parseInt(pkg.version.split('.')[1], 10);
    var tag = minor % 2 ? 'canary' : 'latest';

    exec('npm publish --tag ' + tag, function(err, output, error) {
      if (err) return grunt.fail.fatal(err.message.replace(/\n$/, '.'));
      grunt.log.ok('Published to NPM @' + tag);
      done();
    });
  });
};
<commit_msg>Fix npm-publish grunt task<commit_after>module.exports = function(grunt) {

  var exec = require('child_process').exec;

  /**
   * Show content of the package to double check before publishing
   */
  grunt.registerTask('npm-show', 'Show files that would be published to npm.', function() {
    var done = this.async();

    exec('npm pack', function(err, pkgFile) {
      exec('tar -tf ' + pkgFile, function(err, pkgContent) {
        console.log(pkgContent);
        exec('rm ' + pkgFile, done);
      });
    });
  });


  /**
   * Publish to NPM
   */
  grunt.registerTask('npm-publish', 'Publish to NPM.', function() {
    this.requires('build');

    var done = this.async();
    var pkg = grunt.config('pkg');
    var minor = parseInt(pkg.version.split('.')[1], 10);
    var tag = (minor % 2) ? 'canary' : 'latest';

    exec('npm publish --tag ' + tag, function(err, output, error) {
      if (err) return grunt.fail.fatal(err.message.replace(/\n$/, '.'));
      grunt.log.ok('Published to NPM @' + tag);
      done();
    });
  });
};

{'fraction_non_alphanumeric': 0.18265060240963854, 'fraction_numerical': 0.0038554216867469878, 'mean_word_length': 2.7952468007312614, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1915396', 'n_tokens_mistral': 713, 'n_tokens_neox': 668, 'n_words': 167}