Repository navigation
Приложение для терминала - #2
Merged
keksobot merged 4 commits intoSep 8, 2025
Merged
Conversation
NaumovEvgeniy
suggested changes
Sep 7, 2025
| @@ -30,5 +30,8 @@ | |||
| "engines": { | |||
| "node": "^18.0.0", | |||
There was a problem hiding this comment.
Предлагаю в проекте использовать версию 22 (LTS которая)
Но с ней не работают штатно через ts-node запуск скриптов. Падает так:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /path/to/project/1501539-six-cities-2/src/main.cli.ts
Предлагаю такое решение: написать обертку и его импортировать, а в этой обертке уже подключается ts-node. Ниже код патча, который можешь применить у себя в редакторе
Subject: [PATCH] ts loader
---
Index: src/ts-loader.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/ts-loader.js b/src/ts-loader.js
new file mode 100644
--- /dev/null (date 1749288105438)
+++ b/src/ts-loader.js (date 1749288105438)
@@ -0,0 +1,5 @@
+import {register} from 'node:module';
+import {pathToFileURL} from 'node:url';
+
+// Регистрируем ts-node с поддержкой ESM
+register('ts-node/esm', pathToFileURL('./'));
запускать так node --import ./src/ts-loader.js /path/to.ts
| @@ -0,0 +1,4 @@ | |||
| export interface Command { | |||
| getName(): string; | |||
| execute(...parameters: string[]): void; | |||
There was a problem hiding this comment.
Сделать возвращаемый тип Promise<void> тк в будущем там будут долгие операции, которые нужно ждать
added 3 commits
September 8, 2025 11:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎓 Приложение для терминала