<commit_before>const path  = require('path')
const fs    = require('fs')

const buildPath   = path.resolve(__dirname, 'build')
const svgPath     = path.resolve(__dirname, 'mdi/icons/svg')

const toPascalCase = (str) => {
  return str.toLowerCase()
    .split(/-/g).map(token => 
      token.charAt(0).toUpperCase() + token.slice(1))
    .join('')
}

const buildIcons = (components) => fs.readFile(path.resolve('./build.tpl'), (err, tpl) => {
  for (const component of components) {
    fs.writeFileSync(
      path.join(buildPath,`${component.name}Icon.js`),
      tpl.toString('utf-8')
        .replace(/\{\{icon\}\}/g, component.name.toLowerCase())
        .replace(/\{\{path\}\}/g, component.path)
    )
  }
})

fs.readdir(svgPath, (a, svgs) => {
  buildIcons(svgs.map(svg => {
    return { 
      name: toPascalCase(svg).slice(0, -4),
      path: (() => {
          const matches = /\sd="(.*)"/.exec(fs.readFileSync(path.join(svgPath, svg), {
            encoding: 'utf8'
          }))

          if (matches) {
            return matches[0]
          }
      })()
    }
  }).filter(_ => _.path))
})

<commit_msg>feat(): package.json is now created for the npm package<commit_after>const path  = require('path')
const fs    = require('fs')

const buildPath   = path.resolve(__dirname, 'build')
const distPath    = path.resolve(__dirname, 'dist')
const svgPath     = path.resolve(__dirname, 'mdi/icons/svg')

const tplFile     = path.resolve(__dirname, 'build.tpl')
const pkgFile     = path.resolve(__dirname, 'package.json')

function toPascalCase(str) {
  return str.toLowerCase()
    .split(/-/g).map(token => 
      token.charAt(0).toUpperCase() + token.slice(1))
    .join('')
}

const copyPackage = () => fs.readFile(pkgFile, (err, pkgRaw) => {
  const pkgObj = JSON.parse(pkgRaw)

  // Nobody cares for errors... nobody
  fs.writeFile(path.resolve(distPath, 'package.json'), JSON.stringify(Object.keys(pkgObj)
    .map((key) => {
      if (!/script|devDependencies|dependencies/.test(key)) {
        return pkgObj[key]
      }
    })
  ))
})

const buildIcons = (components) => fs.readFile(path.resolve('./build.tpl'), (err, tpl) => {
  for (const component of components) {
    fs.writeFileSync(
      path.join(buildPath,`${component.name}Icon.js`),
      tpl.toString('utf-8')
        .replace(/\{\{icon\}\}/g, component.name.toLowerCase())
        .replace(/\{\{path\}\}/g, component.path)
    )
  }

  copyPackage()
})

fs.readdir(svgPath, (a, svgs) => {
  buildIcons(svgs.map(svg => {
    return { 
      name: toPascalCase(svg).slice(0, -4),
      path: (() => {
          const matches = /\sd="(.*)"/.exec(fs.readFileSync(path.join(svgPath, svg), {
            encoding: 'utf8'
          }))

          if (matches) {
            return matches[0]
          }
      })()
    }
  }).filter(_ => _.path))
})


{'fraction_non_alphanumeric': 0.19362831858407079, 'fraction_numerical': 0.00495575221238938, 'mean_word_length': 2.660621761658031, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '5535600', 'n_tokens_mistral': 994, 'n_tokens_neox': 972, 'n_words': 165}