@lark-apaas/db-schema-sync 0.1.3 → 0.1.4-alpha.1

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.
Files changed (2) hide show
  1. package/dist/bin.js +12 -3
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -407,16 +407,22 @@ var require_main = __commonJS({
407
407
  var import_dotenv = __toESM(require_main(), 1);
408
408
  import { resolve, dirname } from "path";
409
409
  import { writeFileSync, mkdirSync, existsSync } from "fs";
410
+
411
+ // src/cli-args.ts
410
412
  function parseArgs(argv) {
411
413
  const args = argv.slice(2);
412
414
  const getArg = (name) => {
413
415
  const idx = args.indexOf(name);
414
416
  return idx !== -1 && args[idx + 1] ? args[idx + 1] : void 0;
415
417
  };
418
+ const hasFlag = (name) => args.includes(name);
416
419
  return {
417
- output: getArg("--output")
420
+ output: getArg("--output"),
421
+ exportCustomTypes: hasFlag("--export-custom-types")
418
422
  };
419
423
  }
424
+
425
+ // src/bin.ts
420
426
  async function main() {
421
427
  const envPath = resolve(process.cwd(), ".env");
422
428
  if (existsSync(envPath)) {
@@ -428,8 +434,11 @@ async function main() {
428
434
  try {
429
435
  const options = resolveEnvOptions();
430
436
  console.log("[db-schema-sync] Starting...");
431
- console.log(`[db-schema-sync] app_id=${options.appId}, dbBranch=${options.dbBranch}`);
432
- const schema = await generateSchema(options);
437
+ console.log(`[db-schema-sync] app_id=${options.appId}, dbBranch=${options.dbBranch}, exportCustomTypes=${cliArgs.exportCustomTypes}`);
438
+ const schema = await generateSchema({
439
+ ...options,
440
+ exportCustomTypes: cliArgs.exportCustomTypes
441
+ });
433
442
  if (!schema.includes("pgTable") && !schema.includes("pgView")) {
434
443
  console.warn("[db-schema-sync] \u26A0 Warning: No tables or views found in database. The generated schema will be empty.");
435
444
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/db-schema-sync",
3
- "version": "0.1.3",
3
+ "version": "0.1.4-alpha.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",