summary refs log tree commit diff
path: root/util/src
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-03-06 17:18:35 +1100
committerGitHub <noreply@github.com>2022-03-06 09:18:35 +0300
commit6bcd9e8baacc9493845a914afe50b9ac1b19720d (patch)
treea154da08664725cf41d9df01f82ab3867c39d517 /util/src
parentdocument which field is which (diff)
downloadserver-6bcd9e8baacc9493845a914afe50b9ac1b19720d.tar.xz
Tsnode support (#580)
* ts-node support. debugging is slightly wonky as vscode will not allow breakpoints in modules that aren't bundle, yet.

* apparently ts-node compilerOptions.path wasn't needed? on windows I could've sworn it was.

* Cleaned up tsconfig.json a bit ( moved tsnode config to own file ).
Fixed breakpoints for all modules under tsnode

* Removed Microsoft Corp advert
* Remove one more Microsoft Corp. ad

Signed-off-by: Erkin Alp Güney <erkinalp9035@gmail.com>

* Added `tsnode` npm script

* Added `typescript-cached-transpile` package to help improve performance

Co-authored-by: Erkin Alp Güney <erkinalp9035@gmail.com>
Diffstat (limited to 'util/src')
-rw-r--r--util/src/util/TraverseDirectory.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/src/util/TraverseDirectory.ts b/util/src/util/TraverseDirectory.ts
index 275b7dcc..3d0d6279 100644
--- a/util/src/util/TraverseDirectory.ts
+++ b/util/src/util/TraverseDirectory.ts
@@ -1,6 +1,9 @@
 import { Server, traverseDirectory } from "lambert-server";
 
-const DEFAULT_FILTER = /^([^\.].*)(?<!\.d)\.(js)$/;
+//if we're using ts-node, use ts files instead of js
+const extension = Symbol.for("ts-node.register.instance") in process ? "ts" : "js"
+
+const DEFAULT_FILTER = new RegExp("^([^\.].*)(?<!\.d)\.(" + extension + ")$");
 
 export function registerRoutes(server: Server, root: string) {
 	return traverseDirectory(