Skip to content

Приложение для терминала - #2

Merged
keksobot merged 2 commits into
htmlacademy-nodejs-api:masterfrom
Critonik:module1-task2
Jan 9, 2026
Merged

keksobot merged 2 commits into
htmlacademy-nodejs-api:masterfrom
Critonik:module1-task2

Conversation

@Critonik

@Critonik Critonik commented Jan 8, 2026 •

Copy link
Copy Markdown

@keksobot keksobot changed the title add cli Приложение для терминала Jan 8, 2026
Comment thread src/cli/commands/version.command.ts Outdated
}


function isPackageJson(value: unknown): value is PackageJsonData {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему эта функция вне класса ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

занес в приватное поле

Comment thread src/shared/lib/tsv-file-reader.ts Outdated
@@ -0,0 +1,46 @@
import { FileReader } from './file-reader.interface.js';
import { readFileSync } from 'node:fs';
import { RentalOffer } from '../types/rental-offer.interface.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Полезно знать, такие штуки которые импортируются только в качестве типа лучше импортировать через import type чтобы в JS файле не были лишнего импорта это может помочь предотвратить лишние циклические зависимости

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verbatimModuleSyntax по дефолту не включен

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

включил и поправил

}

private readVersion(): string {
const json = readFileSync(resolve(this.filepath), 'utf-8');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже полезно знать, что функции файловой системы которые *Sync блокируют выполнение потока, то есть использовать их нужно аккуратно и тогда когда ты действительно понимаешь что это не затормозит какие то паралельные процессы.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да, спасибо, тут по примеру из лекции просто синхронную функцию вызвал

@keksobot
keksobot merged commit 7797df0 into htmlacademy-nodejs-api:master Jan 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants