aboutsummaryrefslogtreecommitdiffstats
path: root/build-helpers/installDictionaries.js
blob: 8d209356e57eb47f582059e31e354167c43dac00 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { execSync } = require('child_process');
const { SPELLCHECKER_LOCALES } = require('../build/i18n/languages');

const path = './build/dictionaries';

let packages = '';
Object.keys(SPELLCHECKER_LOCALES).forEach((key) => { packages = `${packages} hunspell-dict-${key}`; });

function exec(cmd) {
  execSync(cmd,
    (error, stdout, stderr) => {
      console.log(`stdout: ${stdout}`);
      console.log(`stderr: ${stderr}`);
      if (error !== null) {
        console.log(`exec error: ${error}`);
      }
    });
}

exec(`
rm -rf ${path}
npm install --prefix ${path} ${packages}
mv ${path}/node_modules/* ${path}
rm -rf ${path}/node_modules ${path}/package-lock.json`);