postgresdk 0.14.1 → 0.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +12 -5
- package/dist/index.js +7 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1978,7 +1978,7 @@ var exports_cli_init = {};
|
|
|
1978
1978
|
__export(exports_cli_init, {
|
|
1979
1979
|
initCommand: () => initCommand
|
|
1980
1980
|
});
|
|
1981
|
-
import { existsSync, writeFileSync, readFileSync, copyFileSync } from "fs";
|
|
1981
|
+
import { existsSync as existsSync2, writeFileSync, readFileSync, copyFileSync } from "fs";
|
|
1982
1982
|
import { resolve } from "path";
|
|
1983
1983
|
import prompts from "prompts";
|
|
1984
1984
|
async function initCommand(args) {
|
|
@@ -1988,7 +1988,7 @@ async function initCommand(args) {
|
|
|
1988
1988
|
const isApiSide = args.includes("--api");
|
|
1989
1989
|
const isSdkSide = args.includes("--sdk");
|
|
1990
1990
|
const configPath = resolve(process.cwd(), "postgresdk.config.ts");
|
|
1991
|
-
if (
|
|
1991
|
+
if (existsSync2(configPath)) {
|
|
1992
1992
|
if (forceError) {
|
|
1993
1993
|
console.error("❌ Error: postgresdk.config.ts already exists");
|
|
1994
1994
|
console.log(" To reinitialize, please remove or rename the existing file first.");
|
|
@@ -2142,7 +2142,7 @@ async function initCommand(args) {
|
|
|
2142
2142
|
}
|
|
2143
2143
|
const template = projectType === "api" ? CONFIG_TEMPLATE_API : CONFIG_TEMPLATE_SDK;
|
|
2144
2144
|
const envPath = resolve(process.cwd(), ".env");
|
|
2145
|
-
const hasEnv =
|
|
2145
|
+
const hasEnv = existsSync2(envPath);
|
|
2146
2146
|
try {
|
|
2147
2147
|
writeFileSync(configPath, template, "utf-8");
|
|
2148
2148
|
console.log("✅ Created postgresdk.config.ts");
|
|
@@ -2350,7 +2350,7 @@ __export(exports_cli_pull, {
|
|
|
2350
2350
|
});
|
|
2351
2351
|
import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
2352
2352
|
import { join as join2, dirname as dirname2, resolve as resolve2 } from "path";
|
|
2353
|
-
import { existsSync as
|
|
2353
|
+
import { existsSync as existsSync3 } from "fs";
|
|
2354
2354
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
2355
2355
|
async function pullCommand(args) {
|
|
2356
2356
|
let configPath = "postgresdk.config.ts";
|
|
@@ -2360,7 +2360,7 @@ async function pullCommand(args) {
|
|
|
2360
2360
|
}
|
|
2361
2361
|
let fileConfig = {};
|
|
2362
2362
|
const fullConfigPath = resolve2(process.cwd(), configPath);
|
|
2363
|
-
if (
|
|
2363
|
+
if (existsSync3(fullConfigPath)) {
|
|
2364
2364
|
console.log(`\uD83D\uDCCB Loading ${configPath}`);
|
|
2365
2365
|
try {
|
|
2366
2366
|
const configUrl = pathToFileURL2(fullConfigPath).href;
|
|
@@ -2436,6 +2436,7 @@ var init_cli_pull = () => {};
|
|
|
2436
2436
|
var import_config = __toESM(require_config(), 1);
|
|
2437
2437
|
import { join, relative } from "node:path";
|
|
2438
2438
|
import { pathToFileURL } from "node:url";
|
|
2439
|
+
import { existsSync } from "node:fs";
|
|
2439
2440
|
|
|
2440
2441
|
// src/introspect.ts
|
|
2441
2442
|
import { Client } from "pg";
|
|
@@ -5509,6 +5510,12 @@ function normalizeAuthConfig(input) {
|
|
|
5509
5510
|
|
|
5510
5511
|
// src/index.ts
|
|
5511
5512
|
async function generate(configPath) {
|
|
5513
|
+
if (!existsSync(configPath)) {
|
|
5514
|
+
throw new Error(`Config file not found: ${configPath}
|
|
5515
|
+
|
|
5516
|
+
` + `Run 'postgresdk init' to create a config file, or specify a custom path with:
|
|
5517
|
+
` + ` postgresdk generate --config <path>`);
|
|
5518
|
+
}
|
|
5512
5519
|
const configUrl = pathToFileURL(configPath).href;
|
|
5513
5520
|
const module = await import(configUrl);
|
|
5514
5521
|
const rawCfg = module.default || module;
|
package/dist/index.js
CHANGED
|
@@ -1610,6 +1610,7 @@ var init_emit_sdk_contract = __esm(() => {
|
|
|
1610
1610
|
var import_config = __toESM(require_config(), 1);
|
|
1611
1611
|
import { join, relative } from "node:path";
|
|
1612
1612
|
import { pathToFileURL } from "node:url";
|
|
1613
|
+
import { existsSync } from "node:fs";
|
|
1613
1614
|
|
|
1614
1615
|
// src/introspect.ts
|
|
1615
1616
|
import { Client } from "pg";
|
|
@@ -4683,6 +4684,12 @@ function normalizeAuthConfig(input) {
|
|
|
4683
4684
|
|
|
4684
4685
|
// src/index.ts
|
|
4685
4686
|
async function generate(configPath) {
|
|
4687
|
+
if (!existsSync(configPath)) {
|
|
4688
|
+
throw new Error(`Config file not found: ${configPath}
|
|
4689
|
+
|
|
4690
|
+
` + `Run 'postgresdk init' to create a config file, or specify a custom path with:
|
|
4691
|
+
` + ` postgresdk generate --config <path>`);
|
|
4692
|
+
}
|
|
4686
4693
|
const configUrl = pathToFileURL(configPath).href;
|
|
4687
4694
|
const module = await import(configUrl);
|
|
4688
4695
|
const rawCfg = module.default || module;
|