Updates
This commit is contained in:
@@ -8,6 +8,7 @@ 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";
|
||||
import parseEnv from "../package-shared/utils/parse-env";
|
||||
|
||||
const args = parseArgs({
|
||||
args: process.argv,
|
||||
@@ -26,18 +27,42 @@ const args = parseArgs({
|
||||
type: "string",
|
||||
short: "o",
|
||||
},
|
||||
envfile: {
|
||||
type: "string",
|
||||
short: "e",
|
||||
},
|
||||
debug: {
|
||||
type: "boolean",
|
||||
short: "e",
|
||||
short: "u",
|
||||
},
|
||||
},
|
||||
strict: false,
|
||||
});
|
||||
|
||||
const { apiKey: key, database, outfile, debug, envfile } = args.values;
|
||||
|
||||
if (envfile && typeof envfile == "string") {
|
||||
const finalEnvPath = path.resolve(process.cwd(), envfile);
|
||||
if (fs.existsSync(finalEnvPath)) {
|
||||
const appendedEnv = parseEnv(finalEnvPath);
|
||||
|
||||
if (debug) {
|
||||
debugLog({
|
||||
log: appendedEnv,
|
||||
label: "Appended env",
|
||||
title: "Schema to Typedef",
|
||||
addTime: true,
|
||||
});
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(appendedEnv)) {
|
||||
process.env[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const { apiKey: key, database, outfile, debug } = args.values;
|
||||
|
||||
if (debug) {
|
||||
debugLog({
|
||||
log: args.values,
|
||||
|
||||
Reference in New Issue
Block a user