<commit_before>/**
 * Using gulp to update these dirs because we need to parse patternlab-config.json to know their destinations.
 */
'use strict';

const exec = require('child_process').exec;
const fs = require('fs-extra');
const gulp = require('gulp');
const runSequence = require('run-sequence');

const utils = require('../core/lib/utils');

const extendDir = utils.pathResolve(global.conf.extend_dir);
const publicDir = utils.pathResolve(global.conf.ui.paths.public.root);

function npmUpdate(resolve) {
  exec('npm update', (err, stdout, stderr) => {
    if (err) {
      throw err;
    }
    if (stderr) {
      utils.info(stderr);
    }
    utils.info(stdout);
    resolve();
  });
}

gulp.task('update', cb => {
  new Promise(resolve => {
    utils.log('Running `npm -global update` on fepper-cli...');
    exec('npm update -g fepper-cli', (err, stdout, stderr) => {
      if (err) {
        throw err;
      }
      if (stderr) {
        utils.info(stderr);
      }
      utils.info(stdout);
      resolve();
    });
  })
  .then(() => {
    return new Promise(resolve => {
      process.chdir(global.workDir);
      utils.log(`Running \`npm update\` in ${global.workDir}...`);
      npmUpdate(resolve);
    });
  })
  .then(() => {
    return new Promise(resolve => {
      // Skip extend dir if it doesn't exist.
      if (!fs.existsSync(extendDir)) {
        resolve();
      }

      process.chdir(extendDir);
      utils.log(`Running \`npm update\` in ${extendDir}...`);
      npmUpdate(resolve);
    });
  })
  .then(() => {
    return new Promise(resolve => {
      // Skip public dir if it doesn't exist.
      if (!fs.existsSync(publicDir)) {
        resolve();
      }

      process.chdir(publicDir);
      utils.log(`Running \`npm update\` in ${publicDir}...`);
      npmUpdate(resolve);
    });
  })
  .then(() => {
    runSequence(
      'ui:compile',
      cb
    );
  });
});<commit_msg>`fp up` alias for `fp update`<commit_after>/**
 * Using gulp to update these dirs because we need to parse patternlab-config.json to know their destinations.
 */
'use strict';

const exec = require('child_process').exec;
const fs = require('fs-extra');
const gulp = require('gulp');
const runSequence = require('run-sequence');

const utils = require('../core/lib/utils');

const extendDir = utils.pathResolve(global.conf.extend_dir);
const publicDir = utils.pathResolve(global.conf.ui.paths.public.root);

function npmUpdate(resolve) {
  exec('npm update', (err, stdout, stderr) => {
    if (err) {
      throw err;
    }
    if (stderr) {
      utils.info(stderr);
    }
    utils.info(stdout);
    resolve();
  });
}

function fpUpdate(cb) {
  new Promise(resolve => {
    utils.log('Running `npm -global update` on fepper-cli...');
    exec('npm update -g fepper-cli', (err, stdout, stderr) => {
      if (err) {
        throw err;
      }
      if (stderr) {
        utils.info(stderr);
      }
      utils.info(stdout);
      resolve();
    });
  })
  .then(() => {
    return new Promise(resolve => {
      process.chdir(global.workDir);
      utils.log(`Running \`npm update\` in ${global.workDir}...`);
      npmUpdate(resolve);
    });
  })
  .then(() => {
    return new Promise(resolve => {
      // Skip extend dir if it doesn't exist.
      if (!fs.existsSync(extendDir)) {
        resolve();
      }

      process.chdir(extendDir);
      utils.log(`Running \`npm update\` in ${extendDir}...`);
      npmUpdate(resolve);
    });
  })
  .then(() => {
    return new Promise(resolve => {
      // Skip public dir if it doesn't exist.
      if (!fs.existsSync(publicDir)) {
        resolve();
      }

      process.chdir(publicDir);
      utils.log(`Running \`npm update\` in ${publicDir}...`);
      npmUpdate(resolve);
    });
  })
  .then(() => {
    runSequence(
      'ui:compile',
      cb
    );
  });
};

gulp.task('up', cb => {
  fpUpdate(cb);
}

gulp.task('update', cb => {
  fpUpdate(cb);
}
{'fraction_non_alphanumeric': 0.1787624140565317, 'fraction_numerical': 0.0, 'mean_word_length': 2.494661921708185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, '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': '62216', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1279, 'n_words': 289}