Updates
This commit is contained in:
@@ -7,6 +7,7 @@ import { parseArgs } from "util";
|
||||
import { DSQL_DatabaseSchemaType } from "../package-shared/types";
|
||||
import dbSchemaToType from "../package-shared/functions/dsql/db-schema-to-type";
|
||||
import path from "path";
|
||||
import debugLog from "../package-shared/utils/logging/debug-log";
|
||||
|
||||
const args = parseArgs({
|
||||
args: process.argv,
|
||||
@@ -23,16 +24,41 @@ const args = parseArgs({
|
||||
},
|
||||
outfile: {
|
||||
type: "string",
|
||||
default: process.env.DSQL_DB_NAME,
|
||||
short: "o",
|
||||
},
|
||||
debug: {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
short: "d",
|
||||
},
|
||||
},
|
||||
strict: false,
|
||||
});
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const { apiKey: key, database, outfile } = args.values;
|
||||
const { apiKey: key, database, outfile, debug } = args.values;
|
||||
|
||||
if (debug) {
|
||||
debugLog({
|
||||
log: args.values,
|
||||
label: "Arguments",
|
||||
title: "Schema to Typedef",
|
||||
addTime: true,
|
||||
});
|
||||
debugLog({
|
||||
log: process.env.DSQL_FULL_ACCESS_API_KEY,
|
||||
label: "process.env.DSQL_FULL_ACCESS_API_KEY",
|
||||
title: "Schema to Typedef",
|
||||
addTime: true,
|
||||
});
|
||||
debugLog({
|
||||
log: process.env.DSQL_DB_NAME,
|
||||
label: "process.env.DSQL_DB_NAME",
|
||||
title: "Schema to Typedef",
|
||||
addTime: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (!database || typeof database !== "string")
|
||||
throw new Error("Database name is required");
|
||||
@@ -65,7 +91,13 @@ const args = parseArgs({
|
||||
"utf-8"
|
||||
);
|
||||
} catch (error: any) {
|
||||
console.log("Error:", error.message);
|
||||
debugLog({
|
||||
log: error.message,
|
||||
label: "Error",
|
||||
title: "Schema to Typedef",
|
||||
addTime: true,
|
||||
type: "error",
|
||||
});
|
||||
process.exit(1);
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user