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

/**
 * Taken from https://gist.github.com/kethinov/6658166#gistcomment-2389484
 *
 * Find all files inside a dir, recursively.
 * @function getAllFiles
 * @param  {string} dir Dir path string.
 * @return {string[]} Array with all file names that are inside the directory.
 */
const getAllFiles = (dir) =>
  fs.readdirSync(dir).reduce((files, file) => {
    const name = path.join(dir, file)
    const isDirectory = fs.statSync(name).isDirectory()
    return isDirectory ? [...files, ...getAllFiles(name)] : [...files, name]
  }, [])

const VERSION = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json'))).version
const VENDOR_PATH = path.join(__dirname, 'src', 'vendor')
const BIDNINGS_PATH = path.join(__dirname, 'bindings')

process.env.VUE_APP_KAWANIME_VERSION = VERSION

module.exports = {
  configureWebpack: {
    devtool: 'source-map',
    resolve: {
      alias: {
        '@': path.join(__dirname, 'src', 'renderer'),
        'vendor': VENDOR_PATH
      }
    },
    entry: {
      app: './src/renderer/main.js'
    }
  },
  pluginOptions: {
    electronBuilder: {
      externals: ['kawabinds'],
      builderOptions: {
        appId: 'KawAnime',
        productName: 'KawAnime',
        dmg: {
          contents: [
            {
              x: 150,
              y: 90
            },
            {
              x: 150,
              y: 275,
              type: 'link',
              path: '/Applications'
            }
          ]
        },
        nsis: {
          oneClick: false,
          allowToChangeInstallationDirectory: true
        },
        fileAssociations: [
          {
            ext: 'torrent',
            name: 'Torrent files'
          }
        ],
        protocols: [{
          name: 'kawanime-app-external',
          schemes: [
            'kawanime-app'
          ]
        }],
        mac: {
          extraFiles: [
            {
              from: './bindings/build/Release',
              to: '.',
              filter: ['*.dylib']
            }
          ],
          extraResources: [
            {
              from: './public/mpv',
              to: 'mpv',
              filter: ['*.dylib', '*.node']
            }
          ]
        },
        linux: {
          category: 'Network',
          extraFiles: [
            {
              from: './bindings/build/Release',
              to: '.',
              filter: ['*.so']
            }
          ],
          extraResources: [
            {
              from: './public/mpv',
              to: 'mpv',
              filter: ['*.so', '*.node']
            }
          ]
        },
        win: {
          extraFiles: [
            {
              from: '.\\bindings\\build\\Release',
              to: '.',
              filter: ['*.dll']
            }
          ],
          extraResources: [
            {
              from: '.\\public\\mpv',
              to: 'mpv',
              filter: ['*.dll', '*.node']
            }
          ]
        }
      },
      chainWebpackMainProcess: (config) => {
        // Chain webpack config for electron main process only
        config
          .module
          .rule('node')<commit_msg>Switched to extraResources only<commit_after>const fs = require('fs')
const path = require('path')

/**
 * Taken from https://gist.github.com/kethinov/6658166#gistcomment-2389484
 *
 * Find all files inside a dir, recursively.
 * @function getAllFiles
 * @param  {string} dir Dir path string.
 * @return {string[]} Array with all file names that are inside the directory.
 */
const getAllFiles = (dir) =>
  fs.readdirSync(dir).reduce((files, file) => {
    const name = path.join(dir, file)
    const isDirectory = fs.statSync(name).isDirectory()
    return isDirectory ? [...files, ...getAllFiles(name)] : [...files, name]
  }, [])

const VERSION = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json'))).version
const VENDOR_PATH = path.join(__dirname, 'src', 'vendor')
const BIDNINGS_PATH = path.join(__dirname, 'bindings')

process.env.VUE_APP_KAWANIME_VERSION = VERSION

module.exports = {
  configureWebpack: {
    devtool: 'source-map',
    resolve: {
      alias: {
        '@': path.join(__dirname, 'src', 'renderer'),
        'vendor': VENDOR_PATH
      }
    },
    entry: {
      app: './src/renderer/main.js'
    }
  },
  pluginOptions: {
    electronBuilder: {
      externals: ['kawabinds'],
      builderOptions: {
        appId: 'KawAnime',
        productName: 'KawAnime',
        dmg: {
          contents: [
            {
              x: 150,
              y: 90
            },
            {
              x: 150,
              y: 275,
              type: 'link',
              path: '/Applications'
            }
          ]
        },
        nsis: {
          oneClick: false,
          allowToChangeInstallationDirectory: true
        },
        fileAssociations: [
          {
            ext: 'torrent',
            name: 'Torrent files'
          }
        ],
        protocols: [{
          name: 'kawanime-app-external',
          schemes: [
            'kawanime-app'
          ]
        }],
        mac: {
          extraResources: [
            {
              from: './bindings/build/Release',
              to: '.',
              filter: ['*.dylib']
            },
            {
              from: './public/mpv',
              to: 'mpv',
              filter: ['*.dylib', '*.node']
            }
          ]
        },
        linux: {
          category: 'Network',
          extraResources: [
            {
              from: './bindings/build/Release',
              to: '.',
              filter: ['*.so']
            },
            {
              from: './public/mpv',
              to: 'mpv',
              filter: ['*.so', '*.node']
            }
          ]
        },
        win: {
          extraResources: [
            {
              from: '.\\bindings\\build\\Release',
              to: '.',
              filter: ['*.dll']
            },
            {
              from: '.\\public\\mpv',
              to: 'mpv',
              filter: ['*.dll', '*.node']
            }
          ]
        }
      },
      chainWebpackMainProcess: (config) => {
        // Chain webpack config for electron main process only
        config
          .module
          .rule('node')
{'fraction_non_alphanumeric': 0.14418238993710691, 'fraction_numerical': 0.007861635220125786, 'mean_word_length': 1.2807457870204375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '1145736', 'n_tokens_mistral': 1879, 'n_tokens_neox': 1852, 'n_words': 363}