<commit_before>'use strict';

let exec = require('child_process').exec;
let path = require('path');
let fs = require('fs');
let watch = require('watch');
let walk = require('walk');
let mkdirp = require('mkdirp');

/**
 * @param {String} fullPath - relative path to package.json folder from microapplication
 * @param {Boolean} prodFlag
 */
function installNodeModules(fullPath, prodFlag) {
  let flag = prodFlag ? '--production' : '';

  return new Promise(resolve => {
    try {
      if (fs.statSync(path.join(fullPath, 'node_modules')).isDirectory()) {
        return resolve();
      }
    } catch(error) {
      console.log('Installing node modules');
    }


    exec(`cd ${fullPath} && npm install ${flag}`, (error, stdout, stderr) => {
      if (error) {
        console.error(stderr);
      }

      return resolve();
    });
  });
}

/**
 * Watch html and javascript files of a specific microapplication
 * @param {String} frontendPath - path to frontend folder of the microapplication
 */
function watchMicroservice(frontendPath, typescriptPath) {

  function _buildPath(file) {
    return path.join(frontendPath, _destinationFolderName(), file.replace(frontendPath, ''));
  }

  function _copyFile(file) {
    if (_testFileName(file)) {
      fs.createReadStream(file).pipe(fs.createWriteStream(_buildPath(file)));
    }
  }

  let options  = {
    ignoreDirectoryPattern: /(\/_build)/,
  };

  watch.createMonitor(frontendPath, options, (monitor) => {
    monitor.on('created', _copyFile);

    monitor.on('changed', _copyFile);

    monitor.on('removed', (file) => {
      if (_testFileName(file)) {
        fs.unlink(_buildPath(file));
      }
    });
  });

  return new Promise((resolve) => {console.log(`cd ${typescriptPath} && tsc -w`);
    exec(`cd ${typescriptPath} && tsc -w`, (error, stdout, stderr) => {
      if (error) {<commit_msg>Delete console logs<commit_after>'use strict';

let exec = require('child_process').exec;
let path = require('path');
let fs = require('fs');
let watch = require('watch');
let walk = require('walk');
let mkdirp = require('mkdirp');

/**
 * @param {String} fullPath - relative path to package.json folder from microapplication
 * @param {Boolean} prodFlag
 */
function installNodeModules(fullPath, prodFlag) {
  let flag = prodFlag ? '--production' : '';

  return new Promise(resolve => {
    try {
      if (fs.statSync(path.join(fullPath, 'node_modules')).isDirectory()) {
        return resolve();
      }
    } catch(error) {
      console.log('Installing node modules');
    }


    exec(`cd ${fullPath} && npm install ${flag}`, (error, stdout, stderr) => {
      if (error) {
        console.error(stderr);
      }

      return resolve();
    });
  });
}

/**
 * Watch html and javascript files of a specific microapplication
 * @param {String} frontendPath - path to frontend folder of the microapplication
 */
function watchMicroservice(frontendPath, typescriptPath) {

  function _buildPath(file) {
    return path.join(frontendPath, _destinationFolderName(), file.replace(frontendPath, ''));
  }

  function _copyFile(file) {
    if (_testFileName(file)) {
      fs.createReadStream(file).pipe(fs.createWriteStream(_buildPath(file)));
    }
  }

  let options  = {
    ignoreDirectoryPattern: /(\/_build)/,
  };

  watch.createMonitor(frontendPath, options, (monitor) => {
    monitor.on('created', _copyFile);

    monitor.on('changed', _copyFile);

    monitor.on('removed', (file) => {
      if (_testFileName(file)) {
        fs.unlink(_buildPath(file));
      }
    });
  });

  return new Promise((resolve) => {
    exec(`cd ${typescriptPath} && tsc -w`, (error, stdout, stderr) => {
      if (error) {
{'fraction_non_alphanumeric': 0.1598694942903752, 'fraction_numerical': 0.0, 'mean_word_length': 3.514110429447853, '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': '5877230', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1117, 'n_words': 260}