From 78c997a6b76f24c6f31ad43d5cb132922732ba6e Mon Sep 17 00:00:00 2001 From: Ivan Gagarinov Date: Tue, 2 Jul 2024 17:06:55 +0500 Subject: [PATCH] fix --- bin/check.js | 3 ++- bin/fix.js | 3 ++- bin/getWords.js | 3 ++- fixtures/wrong_words.txt | 13 +++++++++++++ src/utils.js | 2 ++ 5 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 fixtures/wrong_words.txt diff --git a/bin/check.js b/bin/check.js index 47301b9..64a1337 100644 --- a/bin/check.js +++ b/bin/check.js @@ -2,8 +2,9 @@ import { exec } from 'child_process'; import { getErrors, formatErrors } from '../src/index.js'; +import { getLanguageToolVersion } from '../src/utils.js'; -exec('sh /LanguageTool-6.3/start.sh >/dev/null 2>&1 &', () => setTimeout(async () => { +exec(`sh /LanguageTool-${getLanguageToolVersion}/start.sh >/dev/null 2>&1 &`, () => setTimeout(async () => { const rules = process.argv.slice(2); const errors = await getErrors('/content', rules); if (errors) { diff --git a/bin/fix.js b/bin/fix.js index 4e117b3..f07683f 100644 --- a/bin/fix.js +++ b/bin/fix.js @@ -2,8 +2,9 @@ import { exec } from 'child_process'; import { fix } from '../src/index.js'; +import { getLanguageToolVersion } from '../src/utils.js'; -exec('sh /LanguageTool-6.3/start.sh >/dev/null 2>&1 &', () => setTimeout(() => { +exec(`sh /LanguageTool-${getLanguageToolVersion}/start.sh >/dev/null 2>&1 &`, () => setTimeout(() => { const rules = process.argv.slice(2); fix('/content', rules).then(() => { console.log('------------------DONE-----------------'); diff --git a/bin/getWords.js b/bin/getWords.js index 53adfb7..57a4d66 100644 --- a/bin/getWords.js +++ b/bin/getWords.js @@ -3,8 +3,9 @@ import { exec } from 'child_process'; import fs from 'node:fs'; import { getWrongWords } from '../src/index.js'; +import { getLanguageToolVersion } from '../src/utils.js'; -exec('sh /LanguageTool-6.3/start.sh >/dev/null 2>&1 &', () => setTimeout(async () => { +exec(`sh /LanguageTool-${getLanguageToolVersion}/start.sh >/dev/null 2>&1 &`, () => setTimeout(async () => { const rules = process.argv.slice(2); const words = await getWrongWords('/content', rules); fs.writeFileSync('/content/wrong_words.txt', words.join('\n'), 'utf-8'); diff --git a/fixtures/wrong_words.txt b/fixtures/wrong_words.txt new file mode 100644 index 0000000..1dfe106 --- /dev/null +++ b/fixtures/wrong_words.txt @@ -0,0 +1,13 @@ +файл +мсли +. +файл +мсли +. +адин +ривет +ривет +здесьбудет +которая пришла, которую +здесьбудет +которая пришла, которую \ No newline at end of file diff --git a/src/utils.js b/src/utils.js index c99967a..dacbb0f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -64,3 +64,5 @@ export const printFixResult = (previousContent, currentContent, fileName) => { console.log(formatMessage(currentContent, 'green')); console.log(`-------------------${fileName} done -----------------`); }; + +export const getLanguageToolVersion = '6.4';