<commit_before>#!/usr/bin/env node

'use strict';

const {exec} = require('child-process-promise');
const {existsSync, readdirSync} = require('fs');
const {readJsonSync} = require('fs-extra');
const {join} = require('path');
const {getArtifactsList, logPromise} = require('../utils');
const theme = require('../theme');

const run = async ({build, cwd}) => {
  const artifacts = await getArtifactsList(build);
  const nodeModulesArtifact = artifacts.find(
    entry => entry.path.endsWith('node_modules.tgz')
  );

  if (!nodeModulesArtifact) {
    console.log(
      theme`{error The specified build (${build}) does not contain any build artifacts.}`
    );
    process.exit(1);
  }

  const nodeModulesURL = nodeModulesArtifact.url;

  if (!existsSync(join(cwd, 'build'))) {
    await exec(`mkdir ./build`, {cwd});
  }

  // Download and extract artifact
  await exec(`rm -rf ./build/node_modules*`, {cwd});
  await exec(`curl ${nodeModulesURL} --output ./build/node_modules.tgz`, {cwd});<commit_msg>Formatting fix (Prettier) to build script<commit_after>#!/usr/bin/env node

'use strict';

const {exec} = require('child-process-promise');
const {existsSync, readdirSync} = require('fs');
const {readJsonSync} = require('fs-extra');
const {join} = require('path');
const {getArtifactsList, logPromise} = require('../utils');
const theme = require('../theme');

const run = async ({build, cwd}) => {
  const artifacts = await getArtifactsList(build);
  const nodeModulesArtifact = artifacts.find(entry =>
    entry.path.endsWith('node_modules.tgz')
  );

  if (!nodeModulesArtifact) {
    console.log(
      theme`{error The specified build (${build}) does not contain any build artifacts.}`
    );
    process.exit(1);
  }

  const nodeModulesURL = nodeModulesArtifact.url;

  if (!existsSync(join(cwd, 'build'))) {
    await exec(`mkdir ./build`, {cwd});
  }

  // Download and extract artifact
  await exec(`rm -rf ./build/node_modules*`, {cwd});
  await exec(`curl ${nodeModulesURL} --output ./build/node_modules.tgz`, {cwd});
{'fraction_non_alphanumeric': 0.17331363860167406, 'fraction_numerical': 0.0009847365829640572, 'mean_word_length': 4.389920424403183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1370014', 'n_tokens_mistral': 665, 'n_tokens_neox': 652, 'n_words': 159}