relq 1.0.11 → 1.0.12

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.
@@ -393,3 +393,7 @@ async function main() {
393
393
  process.exit(1);
394
394
  }
395
395
  }
396
+ const fromDev = process.argv.filter(arg => arg.endsWith('index.ts')).length > 0;
397
+ if (fromDev) {
398
+ main().catch(console.error);
399
+ }
@@ -42,6 +42,7 @@ exports.getSchemaPath = getSchemaPath;
42
42
  exports.requireValidConfig = requireValidConfig;
43
43
  exports.requireValidSchema = requireValidSchema;
44
44
  const config_1 = require("../../config/config.cjs");
45
+ const cli_utils_1 = require("./cli-utils.cjs");
45
46
  const env_loader_1 = require("./env-loader.cjs");
46
47
  const fs = __importStar(require("fs"));
47
48
  const path = __importStar(require("path"));
@@ -116,9 +117,10 @@ function validateConfig(config) {
116
117
  }
117
118
  return errors;
118
119
  }
119
- function getSchemaPath(config, defaultPath = './db/schema.ts') {
120
- if (!config)
121
- return defaultPath;
120
+ function getSchemaPath(config) {
121
+ if (!config) {
122
+ return (0, cli_utils_1.fatal)('Configuration is required', 'Schema path must be defined in relq.config.ts');
123
+ }
122
124
  if (typeof config.schema === 'string' && config.schema.length > 0) {
123
125
  return config.schema;
124
126
  }
@@ -131,7 +133,7 @@ function getSchemaPath(config, defaultPath = './db/schema.ts') {
131
133
  if (config.typeGeneration?.output) {
132
134
  return config.typeGeneration.output;
133
135
  }
134
- return defaultPath;
136
+ return (0, cli_utils_1.fatal)('Schema path not configured', "Add schema: './path/to/schema.ts' to relq.config.ts");
135
137
  }
136
138
  async function requireValidConfig(config, options) {
137
139
  const errors = validateConfig(config);
@@ -358,3 +358,7 @@ async function main() {
358
358
  }
359
359
  }
360
360
  export { main };
361
+ const fromDev = process.argv.filter(arg => arg.endsWith('index.ts')).length > 0;
362
+ if (fromDev) {
363
+ main().catch(console.error);
364
+ }
@@ -1,4 +1,5 @@
1
1
  import { loadConfig as baseLoadConfig } from "../../config/config.js";
2
+ import { fatal } from "./cli-utils.js";
2
3
  import { loadEnvConfig } from "./env-loader.js";
3
4
  import * as fs from 'fs';
4
5
  import * as path from 'path';
@@ -73,9 +74,10 @@ export function validateConfig(config) {
73
74
  }
74
75
  return errors;
75
76
  }
76
- export function getSchemaPath(config, defaultPath = './db/schema.ts') {
77
- if (!config)
78
- return defaultPath;
77
+ export function getSchemaPath(config) {
78
+ if (!config) {
79
+ return fatal('Configuration is required', 'Schema path must be defined in relq.config.ts');
80
+ }
79
81
  if (typeof config.schema === 'string' && config.schema.length > 0) {
80
82
  return config.schema;
81
83
  }
@@ -88,7 +90,7 @@ export function getSchemaPath(config, defaultPath = './db/schema.ts') {
88
90
  if (config.typeGeneration?.output) {
89
91
  return config.typeGeneration.output;
90
92
  }
91
- return defaultPath;
93
+ return fatal('Schema path not configured', "Add schema: './path/to/schema.ts' to relq.config.ts");
92
94
  }
93
95
  export async function requireValidConfig(config, options) {
94
96
  const errors = validateConfig(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relq",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "The Fully-Typed PostgreSQL ORM for TypeScript",
5
5
  "author": "Olajide Mathew O. <olajide.mathew@yuniq.solutions>",
6
6
  "license": "MIT",