<commit_before>/**
 * Manage configuration for tests.
 * @module test/helpers/config
 */

/* eslint "key-spacing": ["error", {"align": "colon"}] */

const path      = require('path');
const assocPath = require('ramda/src/assocPath');
const compose   = require('ramda/src/compose');
const when      = require('ramda/src/when');
const contains  = require('ramda/src/contains');
const flip      = require('ramda/src/flip');
const merge     = require('ramda/src/merge');
const prop      = require('ramda/src/prop');
const is        = require('ramda/src/is');

// has :: [a] -> a -> Boolean
const has = flip(contains);

// readOrExec :: (*, String, Object) -> *
const readOrExec = (p, k, o) => compose(when(is(Function), a => a(p)), prop(k))(o);

const VULCANIZE = {
  vulcanize: {
    srcTarget  : 'index.html',
    buildTarget: 'index.html',
    conf       : {
      stripComments: true,
      inlineScripts: true,
      inlineStyles : true
    }
  }
};

const CONFIG = {
  FOLDERS: dir => ({
    workspace   : path.join(dir, 'workspace'),
    sourceFolder: path.join(dir, 'src'),
    buildFolder : path.join(dir, 'build')
  }),

  BUMP: dir => ({
    bump: {
      files: [
        path.join(dir, 'src/package.json'),
        path.join(dir, 'src/manifest.json')
      ]
    }
  }),

  VULCANIZE,

  VULCANIZE_NO_JS: assocPath(
    ['vulcanize', 'conf', 'excludes'],
    ['javascript.js'],
    VULCANIZE
  ),

  VULCANIZE_NO_BUNDLE: assocPath(
    ['vulcanize', 'conf', 'excludes'],
    ['bundle-fake.js', 'js.js'],
    VULCANIZE
  ),

  COPY: {
    copy: [{
      baseFolder: 'assets',
      items     : ['imgs-others']
    }, {
      baseFolder: 'bundles',
      items     : ['']
    }]
  },

  REPLACE: {
    replace: {
      css: {
        files       : 'index.html',
        commentRegex: ['<!--styles!--->((.|\n)*)<!--styles!--->'],
        with        : ['/assets/style.css']
      },
      js: {
        files       : 'index.html',
        commentRegex: ['<!--js!--->((.|\n)*)<!--js!--->'],
        with        : ['/assets/javascript.js']
      }
    }
  },

  MANIFEST: {<commit_msg>vulcanize config with standard bundle in test/helper/config.js<commit_after>/**
 * Manage configuration for tests.
 * @module test/helpers/config
 */

/* eslint "key-spacing": ["error", {"align": "colon"}] */

const path      = require('path');
const assocPath = require('ramda/src/assocPath');
const compose   = require('ramda/src/compose');
const when      = require('ramda/src/when');
const contains  = require('ramda/src/contains');
const flip      = require('ramda/src/flip');
const merge     = require('ramda/src/merge');
const prop      = require('ramda/src/prop');
const is        = require('ramda/src/is');

// has :: [a] -> a -> Boolean
const has = flip(contains);

// readOrExec :: (*, String, Object) -> *
const readOrExec = (p, k, o) => compose(when(is(Function), a => a(p)), prop(k))(o);

const VULCANIZE = {
  vulcanize: {
    srcTarget  : 'index.html',
    buildTarget: 'index.html',
    conf       : {
      stripComments: true,
      inlineScripts: true,
      inlineStyles : true
    }
  }
};

const CONFIG = {
  FOLDERS: dir => ({
    workspace   : path.join(dir, 'workspace'),
    sourceFolder: path.join(dir, 'src'),
    buildFolder : path.join(dir, 'build')
  }),

  BUMP: dir => ({
    bump: {
      files: [
        path.join(dir, 'src/package.json'),
        path.join(dir, 'src/manifest.json')
      ]
    }
  }),

  VULCANIZE,

  VULCANIZE_NO_JS: assocPath(
    ['vulcanize', 'conf', 'excludes'],
    ['javascript.js'],
    VULCANIZE
  ),

  VULCANIZE_NO_BUNDLE: assocPath(
    ['vulcanize', 'conf', 'excludes'],
    ['bundle-fake.js', 'js.js'],
    VULCANIZE
  ),

  VULCANIZE_NO_BUNDLE_STD: assocPath(
    ['vulcanize', 'conf', 'excludes'],
    ['bundle.js'],
    VULCANIZE
  ),

  COPY: {
    copy: [{
      baseFolder: 'assets',
      items     : ['imgs-others']
    }, {
      baseFolder: 'bundles',
      items     : ['']
    }]
  },

  REPLACE: {
    replace: {
      css: {
        files       : 'index.html',
        commentRegex: ['<!--styles!--->((.|\n)*)<!--styles!--->'],
        with        : ['/assets/style.css']
      },
      js: {
        files       : 'index.html',
        commentRegex: ['<!--js!--->((.|\n)*)<!--js!--->'],
        with        : ['/assets/javascript.js']
      }
    }
  },

  MANIFEST: {
{'fraction_non_alphanumeric': 0.2026249136541561, 'fraction_numerical': 0.0, 'mean_word_length': 2.326186830015314, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 25, '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': '1644014', 'n_tokens_mistral': 1571, 'n_tokens_neox': 1532, 'n_words': 283}