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

/**
    @module d3plus-build
    @summary Compiles all files for distribution.
    @desc This script will compile 2 builds, one with all dependencies includes (full) and one with only the core code. Next, each of those builds is minified using uglifyjs. Finally, all those builds, along with the LICENSE and README, are compressed into a .zip file.
*/

const log = require("./log")("build compile"),
      rollup = require("./rollup"),
      shell = require("shelljs"),
      {name} = JSON.parse(shell.cat("package.json"));

shell.config.silent = true;

/**
    @summary Handles the results of the shell.exec callback function.
    @private
*/
function kill(code, stdout) {
  log.fail();
  shell.echo(stdout);
  shell.exit(code);
}

log.timer("transpiling ES6 for modules");
shell.rm("-rf", "es");
shell.mkdir("-p", "es");
shell.exec("buble -i src --no modules -m -o es/src", (code, stdout) => {
  if (code) kill(code, stdout);

  shell.exec("buble -i index.js --no modules -m -o es/index.js", (code, stdout) => {
    if (code) kill(code, stdout);<commit_msg>attempts to fix npm build of es modules<commit_after>#! /usr/bin/env node

/**
    @module d3plus-build
    @summary Compiles all files for distribution.
    @desc This script will compile 2 builds, one with all dependencies includes (full) and one with only the core code. Next, each of those builds is minified using uglifyjs. Finally, all those builds, along with the LICENSE and README, are compressed into a .zip file.
*/

const log = require("./log")("build compile"),
      rollup = require("./rollup"),
      shell = require("shelljs"),
      {name} = JSON.parse(shell.cat("package.json"));

shell.config.silent = true;

/**
    @summary Handles the results of the shell.exec callback function.
    @private
*/
function kill(code, stdout) {
  log.fail();
  shell.echo(stdout);
  shell.exit(code);
}

log.timer("transpiling ES6 for modules");
shell.rm("-rf", "es");
shell.mkdir("-p", "es");
shell.exec("buble -i index.js --no modules -m -o es/index.js", (code, stdout) => {
  if (code) kill(code, stdout);

  shell.exec("buble -i src --no modules -m -o es/src", (code, stdout) => {
    if (code) kill(code, stdout);
{'fraction_non_alphanumeric': 0.1550946798917944, 'fraction_numerical': 0.002705139765554554, 'mean_word_length': 3.5471311475409837, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3652613', 'n_tokens_mistral': 725, 'n_tokens_neox': 714, 'n_words': 246}