Skip to content

Commit

Permalink
Merge pull request #3 from Hexlet/nodejs
Browse files Browse the repository at this point in the history
Nodejs
  • Loading branch information
fey authored Mar 25, 2024
2 parents b6b4e23 + 559f953 commit 55c82bc
Show file tree
Hide file tree
Showing 15 changed files with 486 additions and 7 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ FROM silviof/docker-languagetool

USER root

RUN apt-get update && apt-get install -y jq
RUN curl -fsSL https://deb.nodesource.com/setup_21.x | bash -

COPY bin/ltcheck.sh /usr/local/bin/ltcheck.sh
RUN apt-get update && apt-get install -y jq nodejs

CMD [ "ltcheck.sh" ]
COPY . .

RUN chmod +x ./start.sh

RUN npm ci

# RUN ./start.sh

CMD [ "node ./bin/check.js" ]
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ run:
docker run --rm \
-v ./fixtures:/content \
-v ./bin:/usr/local/bin \
hexlet/languagetool-cli
hexlet/languagetool-cli \
node ./bin/check.js

run-fix:
docker run --rm \
-v ./fixtures:/content \
-v ./bin:/usr/local/bin \
hexlet/languagetool-cli \
ltcheck.sh fix
node ./bin/fix.js

test:
docker run --rm \
-v ./fixtures:/content \
hexlet/languagetool-cli

getWords:
docker run --rm \
-v ./fixtures:/content \
hexlet/languagetool-cli
node ./bin/getWords.js
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
For checking errors:

```bash
docker run --rm -v ./<directory>:/content hexlet/languagetool-cli
docker run --rm -v ./<directory>:/content hexlet/languagetool-cli node ./bin/check.js firstRule secondRule
```

For fixing errors:

```bash
docker run --rm -v ./<directory>:/content hexlet/languagetool-cli ltcheck.sh fix
docker run --rm -v ./<directory>:/content hexlet/languagetool-cli node ./bin/fix.js firstRule secondRule
```

To get wrong words:

```bash
docker run --rm -v ./<directory>:/content hexlet/languagetool-cli node ./bin/getWords.js firstRule secondRule
```
10 changes: 10 additions & 0 deletions bin/check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env node

import { exec } from 'child_process';
import { check } from '../src/index.js';

exec('/LanguageTool-6.3/start.sh >/dev/null 2>&1 &', () => setTimeout(async () => {
const rules = process.argv.slice(2);

check(rules);
}, 5000));
9 changes: 9 additions & 0 deletions bin/fix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env node

import { exec } from 'child_process';
import { fix } from '../src/index.js';

exec('/LanguageTool-6.3/start.sh >/dev/null 2>&1 &', () => setTimeout(() => {
const rules = process.argv.slice(2);
fix(rules);
}, 5000));
9 changes: 9 additions & 0 deletions bin/getWords.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env node

import { exec } from 'child_process';
import { getWrongWords } from '../src/index.js';

exec('/LanguageTool-6.3/start.sh >/dev/null 2>&1 &', () => setTimeout(async () => {
const rules = process.argv.slice(2);
getWrongWords(rules);
}, 5000));
Empty file added fixtures/inner/EMPTY.md
Empty file.
7 changes: 7 additions & 0 deletions fixtures/inner/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
файл где мы написали мсли и все пошло не по плану . А да забыл запятую опять

* `*`: умножение
* `/`: деление
* `-`: вычитание
* "%": https://ru.wikipedia.org/wiki/Деление_с_остатком[остаток от деления]
* `+**+`: возведение в степень
1 change: 1 addition & 0 deletions fixtures/inner/one_more_file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
А здесьбудет много ошибка моя, которая пришла, которую ушли.
44 changes: 44 additions & 0 deletions ignore_dictionary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
-значения
а-я
автогенерацию
автогенерируемого
автогенерируемое
автоинкремент
автоинкремента
автоинкрементом
атомарность
Атомарность
бизнес-логики
бизнес-транзакции
бизнес-транзакция
бэкенда
бэкенде
веб-проектах
категоризировать
клиент-серверное
клиент-серверную
криптобиржи
нодах
онлайн-курсах
онлайн-школе
онлайн-школы
партиционировали
партиционированная
пентили
пентиль
подзапрос
подзапроса
подзапросе
подзапросом
проагрегировать
проспойлерить
рассинхронизированы
регистрозависимый
фокус-группу"
фронтенд
фронтенде
хекслет
Хекслет
хекслета
Хекслета
хекслете
112 changes: 112 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "languagetool-cli",
"version": "1.0.0",
"description": "For checking errors:",
"main": "index.js",
"type": "module",
"scripts": {
"start": "/LanguageTool-6.3/start.sh >/dev/null 2>&1",
"check": "./bin/check",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^1.6.8",
"lodash": "^4.17.21"
}
}
Loading

0 comments on commit 55c82bc

Please sign in to comment.