Merge branch 'tsnode' into slowcord

This commit is contained in:
Madeline 2022-02-04 20:08:13 +11:00
commit 204f39daaa
6 changed files with 146 additions and 109 deletions

View File

@ -1,9 +1,26 @@
{ {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{
"sourceMaps": true,
"name": "ts-node",
"type": "node",
"request": "launch",
"args": [
"${workspaceFolder}/src/start.ts"
],
"runtimeArgs": [
"-r",
"ts-node/register"
],
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart",
"env": {
"TS_NODE_PROJECT": "${workspaceFolder}/tsnode.tsconfig.json",
"TS_NODE_COMPILER": "typescript-cached-transpile"
},
"resolveSourceMapLocations": null, /* allow breakpoints in modules other than bundle */
},
{ {
"sourceMaps": true, "sourceMaps": true,
"type": "node", "type": "node",
@ -12,7 +29,7 @@
"program": "${workspaceFolder}/dist/bundle/src/start.js", "program": "${workspaceFolder}/dist/bundle/src/start.js",
"preLaunchTask": "tsc: build - tsconfig.json", "preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": ["${workspaceFolder}/dist/**/*.js"], "outFiles": ["${workspaceFolder}/dist/**/*.js"],
"envFile": "${workspaceFolder}/.env" "envFile": "${workspaceFolder}/.env",
} }
] ]
} }

BIN
bundle/package-lock.json generated

Binary file not shown.

View File

@ -9,7 +9,8 @@
"start": "node scripts/build.js && node dist/bundle/src/start.js", "start": "node scripts/build.js && node dist/bundle/src/start.js",
"start:bundle": "node dist/bundle/src/start.js", "start:bundle": "node dist/bundle/src/start.js",
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"migrate": "cd ../util/ && npm i && node --require ts-node/register node_modules/typeorm/cli.js -f ../util/ormconfig.json migration:run" "migrate": "cd ../util/ && npm i && node --require ts-node/register node_modules/typeorm/cli.js -f ../util/ormconfig.json migration:run",
"tsnode": "npx ts-node --transpile-only -P tsnode.tsconfig.json src/start.ts"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -51,6 +52,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"
}, },
@ -91,7 +93,8 @@
"missing-native-js-functions": "^1.2.18", "missing-native-js-functions": "^1.2.18",
"morgan": "^1.10.0", "morgan": "^1.10.0",
"multer": "^1.4.2", "multer": "^1.4.2",
"node-fetch": "^2.6.2", "nanocolors": "^0.2.12",
"node-fetch": "^2.6.7",
"node-os-utils": "^1.3.5", "node-os-utils": "^1.3.5",
"patch-package": "^6.4.7", "patch-package": "^6.4.7",
"pg": "^8.7.1", "pg": "^8.7.1",
@ -103,8 +106,8 @@
"tslib": "^2.3.1", "tslib": "^2.3.1",
"typeorm": "^0.2.37", "typeorm": "^0.2.37",
"typescript": "^4.1.2", "typescript": "^4.1.2",
"typescript-cached-transpile": "^0.0.6",
"typescript-json-schema": "^0.50.1", "typescript-json-schema": "^0.50.1",
"ws": "^7.4.2", "ws": "^7.4.2"
"nanocolors": "^0.2.12"
} }
} }

View File

@ -2,7 +2,6 @@
"include": ["dist/**/*.ts"], "include": ["dist/**/*.ts"],
"exclude": [], "exclude": [],
"compilerOptions": { "compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */ /* Basic Options */
"incremental": false /* Enable incremental compilation */, "incremental": false /* Enable incremental compilation */,
@ -16,7 +15,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. */,

View File

@ -0,0 +1,15 @@
{
"extends": "./tsconfig.json",
"ts-node": {
"transpileOnly": true,
"preferTsExts": true,
"require": ["tsconfig-paths/register"],
"compiler": "typescript-cached-transpile",
},
"compilerOptions": {
"rootDir": "../",
"baseUrl": "../",
"sourceRoot": "../",
"sourceMap": true,
}
}

View File

@ -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(