mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-06 10:52:31 +01:00
ts-node support. debugging is slightly wonky as vscode will not allow breakpoints in modules that aren't bundle, yet.
This commit is contained in:
parent
24218eae11
commit
e8bbf11167
15
bundle/.vscode/launch.json
vendored
15
bundle/.vscode/launch.json
vendored
@ -4,6 +4,21 @@
|
|||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "ts-node",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [
|
||||||
|
"${workspaceFolder}/src/start.ts"
|
||||||
|
],
|
||||||
|
"runtimeArgs": [
|
||||||
|
"-r",
|
||||||
|
"ts-node/register"
|
||||||
|
],
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"protocol": "inspector",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"type": "node",
|
"type": "node",
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
"ts-node": "^10.2.1",
|
"ts-node": "^10.2.1",
|
||||||
"ts-node-dev": "^1.1.6",
|
"ts-node-dev": "^1.1.6",
|
||||||
"ts-patch": "^1.4.4",
|
"ts-patch": "^1.4.4",
|
||||||
|
"tsconfig-paths": "^3.12.0",
|
||||||
"typescript": "^4.2.3",
|
"typescript": "^4.2.3",
|
||||||
"typescript-json-schema": "0.50.1"
|
"typescript-json-schema": "0.50.1"
|
||||||
},
|
},
|
||||||
@ -61,6 +62,7 @@
|
|||||||
"@babel/preset-typescript": "^7.15.0",
|
"@babel/preset-typescript": "^7.15.0",
|
||||||
"@fosscord/api": "file:../api",
|
"@fosscord/api": "file:../api",
|
||||||
"@fosscord/cdn": "file:../cdn",
|
"@fosscord/cdn": "file:../cdn",
|
||||||
|
"@fosscord/util": "file:../util",
|
||||||
"@fosscord/gateway": "file:../gateway",
|
"@fosscord/gateway": "file:../gateway",
|
||||||
"@sentry/node": "^6.16.1",
|
"@sentry/node": "^6.16.1",
|
||||||
"@sentry/tracing": "^6.16.1",
|
"@sentry/tracing": "^6.16.1",
|
||||||
|
@ -1,6 +1,21 @@
|
|||||||
{
|
{
|
||||||
"include": ["dist/**/*.ts"],
|
"include": ["dist/**/*.ts"],
|
||||||
"exclude": [],
|
"exclude": [],
|
||||||
|
"ts-node": {
|
||||||
|
"transpileOnly": true,
|
||||||
|
"preferTsExts": true,
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": "../",
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@fosscord/util": ["../util/src/index"],
|
||||||
|
"@fosscord/api": ["../api/src/index"],
|
||||||
|
"@fosscord/gateway": ["../gateway/src/index"],
|
||||||
|
"@fosscord/cdn": ["../cdn/src/index"]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"require": ["tsconfig-paths/register"]
|
||||||
|
},
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||||
|
|
||||||
@ -16,7 +31,7 @@
|
|||||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||||
"declaration": false /* Generates corresponding '.d.ts' file. */,
|
"declaration": false /* Generates corresponding '.d.ts' file. */,
|
||||||
"declarationMap": false /* Generates a sourcemap for each corresponding '.d.ts' file. */,
|
"declarationMap": false /* Generates a sourcemap for each corresponding '.d.ts' file. */,
|
||||||
"sourceMap": false /* Generates corresponding '.map' file. */,
|
"sourceMap": true /* Generates corresponding '.map' file. */,
|
||||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||||
"outDir": "./dist/" /* Redirect output structure to the directory. */,
|
"outDir": "./dist/" /* Redirect output structure to the directory. */,
|
||||||
"rootDir": "./dist/" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
|
"rootDir": "./dist/" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
|
||||||
@ -74,10 +89,10 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"baseUrl": "./dist/",
|
"baseUrl": "./dist/",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@fosscord/api": ["api/src/index"],
|
"@fosscord/api": ["api/src/index", "../../api/src/index"],
|
||||||
"@fosscord/gateway": ["gateway/src/index"],
|
"@fosscord/gateway": ["gateway/src/index", "../../gateway/src/index"],
|
||||||
"@fosscord/cdn": ["cdn/src/index"],
|
"@fosscord/cdn": ["cdn/src/index", "../../cdn/src/index"],
|
||||||
"@fosscord/util": ["util/src/index"]
|
"@fosscord/util": ["util/src/index", "../../util/src/index"]
|
||||||
},
|
},
|
||||||
"plugins": [{ "transform": "@zerollup/ts-transform-paths" }],
|
"plugins": [{ "transform": "@zerollup/ts-transform-paths" }],
|
||||||
"noEmitHelpers": true,
|
"noEmitHelpers": true,
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import { Server, traverseDirectory } from "lambert-server";
|
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) {
|
export function registerRoutes(server: Server, root: string) {
|
||||||
return traverseDirectory(
|
return traverseDirectory(
|
||||||
|
Loading…
Reference in New Issue
Block a user