Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dzencot committed Jul 2, 2024
1 parent 7eea3e9 commit 78c997a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bin/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion bin/fix.js
Original file line number Diff line number Diff line change
Expand Up @@ -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-----------------');
Expand Down
3 changes: 2 additions & 1 deletion bin/getWords.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
13 changes: 13 additions & 0 deletions fixtures/wrong_words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
файл
мсли
.
файл
мсли
.
адин
ривет
ривет
здесьбудет
которая пришла, которую
здесьбудет
которая пришла, которую
2 changes: 2 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ export const printFixResult = (previousContent, currentContent, fileName) => {
console.log(formatMessage(currentContent, 'green'));
console.log(`-------------------${fileName} done -----------------`);
};

export const getLanguageToolVersion = '6.4';

0 comments on commit 78c997a

Please sign in to comment.