<commit_before>import { unlinkSync, renameSync } from 'fs';
import * as glob from 'glob';
import { Blueprint } from 'denali-cli';
import * as createDebug from 'debug';

const debug = createDebug('denali-typescript');

export default class DenaliTypescriptBlueprint extends Blueprint {
  static blueprintName = 'denali-typescript';
  static description = 'Installs denali-typescript';

  async postInstall() {
    debug('removing babel & eslint specific files');
    [
      '.babelrc',
      '.eslintignore',
      '.eslintrc',
      'test/.eslintrc'
    ].forEach((filepath) => {
      unlinkSync(filepath);
    });
    debug('renaming .js -> .ts');
    glob.sync('{app,config,test}/**/*.js').forEach((filepath) => {
      renameSync(filepath, filepath.replace(/\.js$/, '.ts'));
    });
    debug('uninstalling babel and eslint specific packages');
    this.uninstallPackages([
      'babel-eslint',
      'babel-plugin-syntax-async-functions',
      'babel-plugin-syntax-trailing-function-commas',
      'babel-plugin-transform-async-to-generator',
      'babel-plugin-transform-class-properties',
      'babel-plugin-transform-es2015-destructuring',
      'babel-plugin-transform-es2015-modules-commonjs',<commit_msg>ensure absent babel files do not kill the postinstall<commit_after>import { unlinkSync, renameSync } from 'fs';
import * as glob from 'glob';
import { Blueprint } from 'denali-cli';
import * as createDebug from 'debug';

const debug = createDebug('denali-typescript');

export default class DenaliTypescriptBlueprint extends Blueprint {
  static blueprintName = 'denali-typescript';
  static description = 'Installs denali-typescript';

  async postInstall() {
    debug('removing babel & eslint specific files');
    [
      '.babelrc',
      '.eslintignore',
      '.eslintrc',
      'test/.eslintrc'
    ].forEach((filepath) => {
      try {
        unlinkSync(filepath);
      } catch (e) {
        // ignore if the file doesn't exist
      }
    });
    debug('renaming .js -> .ts');
    glob.sync('{app,config,test}/**/*.js').forEach((filepath) => {
      renameSync(filepath, filepath.replace(/\.js$/, '.ts'));
    });
    debug('uninstalling babel and eslint specific packages');
    this.uninstallPackages([
      'babel-eslint',
      'babel-plugin-syntax-async-functions',
      'babel-plugin-syntax-trailing-function-commas',
      'babel-plugin-transform-async-to-generator',
      'babel-plugin-transform-class-properties',
      'babel-plugin-transform-es2015-destructuring',
      'babel-plugin-transform-es2015-modules-commonjs',
{'fraction_non_alphanumeric': 0.1500389711613406, 'fraction_numerical': 0.006235385814497272, 'mean_word_length': 3.4182444061962136, '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': '7133809', 'n_tokens_mistral': 817, 'n_tokens_neox': 773, 'n_words': 154}