mirror of
https://github.com/spacebarchat/server.git
synced 2026-03-30 13:55:39 +00:00
Fix schemas script
This commit is contained in:
Binary file not shown.
Binary file not shown.
15
package.json
15
package.json
@@ -15,16 +15,15 @@
|
||||
"build:tsgo": "npm run build:src:tsgo && npm run generate:schema && npm run generate:openapi",
|
||||
"build:src:tsgo": "rm -rf dist/* tsconfig.tsbuildinfo && tsgo -b -v",
|
||||
"watch": "tsc -w -b .",
|
||||
"test": "node scripts/test.js",
|
||||
"test": "node -r dotenv/config -r module-alias/register --enable-source-maps scripts/test.js",
|
||||
"lint": "eslint .",
|
||||
"setup": "npm run build && npm run generate:schema",
|
||||
"sync:db": "npm run build && node scripts/syncronise.js",
|
||||
"generate:rights": "node scripts/rights.js",
|
||||
"generate:schema": "node scripts/schema.js",
|
||||
"generate:migration": "node -r dotenv/config -r module-alias/register node_modules/typeorm/cli.js migration:generate -d dist/util/util/Database.js",
|
||||
"generate:openapi": "node scripts/openapi.js",
|
||||
"add:license": "node scripts/license.js",
|
||||
"migrate-from-staging": "node -r dotenv/config -r module-alias/register scripts/stagingMigration/index.js",
|
||||
"sync:db": "npm run build && node -r dotenv/config -r module-alias/register --enable-source-maps scripts/syncronise.js",
|
||||
"generate:rights": "node -r dotenv/config -r module-alias/register --enable-source-maps scripts/rights.js",
|
||||
"generate:schema": "node -r dotenv/config -r module-alias/register --enable-source-maps scripts/schema.js",
|
||||
"generate:migration": "node -r dotenv/config -r module-alias/register --enable-source-maps node_modules/typeorm/cli.js migration:generate -d dist/util/util/Database.js",
|
||||
"generate:openapi": "node -r dotenv/config -r module-alias/register --enable-source-maps scripts/openapi.js",
|
||||
"add:license": "node -r dotenv/config -r module-alias/register --enable-source-maps scripts/license.js",
|
||||
"node:tests": "npm run build:src:tsgo && node -r dotenv/config -r module-alias/register --enable-source-maps --test --experimental-test-coverage dist/**/*.test.js",
|
||||
"apply:migrations": "node --enable-source-maps dist/apply-migrations.js"
|
||||
},
|
||||
|
||||
@@ -396,6 +396,7 @@ function columnizedObjectDiff(a, b, trackEqual = false) {
|
||||
return diffs;
|
||||
}
|
||||
|
||||
const showScanDepth = process.env.SCHEMAS_SHOW_SCAN_DEPTH === "true";
|
||||
async function removeAllMatchingRecursive(o, selector, maxDepth = 32, path = "$") {
|
||||
// process.stdout.write("S");
|
||||
// console.log("scan @", path, "with depth", maxDepth, typeof o, o);
|
||||
@@ -406,9 +407,9 @@ async function removeAllMatchingRecursive(o, selector, maxDepth = 32, path = "$"
|
||||
process.stdout.write(yellowBright("R(" + gray(k) + " @ " + cyan(path) + ") "));
|
||||
delete o[k];
|
||||
} else if (maxDepth > 0 && typeof o != "string") {
|
||||
process.stdout.write(gray(">"));
|
||||
if (showScanDepth) process.stdout.write(gray(">"));
|
||||
o[k] = await removeAllMatchingRecursive(o[k], selector, maxDepth - 1, path + "." + k);
|
||||
process.stdout.write(cyan("\b \b"));
|
||||
if (showScanDepth) process.stdout.write(cyan("\b \b"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ if (!process.env) {
|
||||
}
|
||||
if (process.argv[1]?.endsWith("scripts/openapi.js")) isHeadlessProcess = true;
|
||||
|
||||
if (!process.env.DATABASE) {
|
||||
if (!process.env.DATABASE && !isHeadlessProcess) {
|
||||
console.log(
|
||||
red(
|
||||
"DATABASE environment variable not set! Please set it to your database connection string.\n" + "Example for postgres: postgres://user:password@localhost:5432/database",
|
||||
@@ -47,7 +47,7 @@ if (!process.env.DATABASE) {
|
||||
}
|
||||
|
||||
const dbConnectionString = process.env.DATABASE!;
|
||||
export const DatabaseType = dbConnectionString.split(":")[0]?.replace("+srv", "");
|
||||
export const DatabaseType = isHeadlessProcess ? "postgres" : dbConnectionString.split(":")[0]?.replace("+srv", "");
|
||||
const applyMigrations = process.env.APPLY_DB_MIGRATIONS !== "false";
|
||||
|
||||
export const DataSourceOptions = isHeadlessProcess
|
||||
|
||||
Reference in New Issue
Block a user