@pgpmjs/core 4.0.0 → 4.0.2

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.
@@ -1,7 +1,11 @@
1
1
  import { BoilerplateConfig } from 'create-gen-app';
2
2
  import type { Inquirerer, Question } from 'inquirerer';
3
3
  export interface InspectTemplateOptions {
4
- fromPath: string;
4
+ /**
5
+ * The boilerplate path to inspect. When omitted, inspects the template
6
+ * repository root and returns the templateDir for scanning available boilerplates.
7
+ */
8
+ fromPath?: string;
5
9
  templateRepo?: string;
6
10
  branch?: string;
7
11
  cacheTtlMs?: number;
@@ -31,9 +31,14 @@ function inspectTemplate(options) {
31
31
  ttlMs: cacheTtlMs,
32
32
  cacheBaseDir: resolveCacheBaseDir(cacheBaseDir),
33
33
  });
34
- // If dir is provided, prefix fromPath with it
35
- // Otherwise, let create-gen-app resolve via .boilerplates.json
36
- const effectiveFromPath = dir ? path_1.default.join(dir, fromPath) : fromPath;
34
+ // Compute effective fromPath:
35
+ // - If dir is provided, join it with fromPath and bypass .boilerplates.json
36
+ // - If dir is NOT provided, let create-gen-app use .boilerplates.json
37
+ const effectiveFromPath = dir
38
+ ? fromPath
39
+ ? path_1.default.join(dir, fromPath)
40
+ : dir
41
+ : fromPath;
37
42
  const template = templateRepo.startsWith('.') ||
38
43
  templateRepo.startsWith('/') ||
39
44
  templateRepo.startsWith('~')
@@ -43,6 +48,8 @@ function inspectTemplate(options) {
43
48
  template,
44
49
  branch,
45
50
  fromPath: effectiveFromPath,
51
+ // When dir is specified, bypass .boilerplates.json resolution entirely
52
+ useBoilerplatesConfig: !dir,
46
53
  });
47
54
  return {
48
55
  templateDir: result.templateDir,
@@ -60,7 +67,7 @@ async function scaffoldTemplate(options) {
60
67
  ttlMs: cacheTtlMs,
61
68
  cacheBaseDir: resolveCacheBaseDir(cacheBaseDir),
62
69
  });
63
- // If dir is provided, prefix fromPath with it
70
+ // If dir is provided, join it with fromPath and bypass .boilerplates.json
64
71
  // Otherwise, let create-gen-app resolve via .boilerplates.json
65
72
  const effectiveFromPath = dir ? path_1.default.join(dir, fromPath) : fromPath;
66
73
  const template = templateRepo.startsWith('.') ||
@@ -76,6 +83,8 @@ async function scaffoldTemplate(options) {
76
83
  answers,
77
84
  noTty,
78
85
  prompter,
86
+ // When dir is specified, bypass .boilerplates.json resolution entirely
87
+ useBoilerplatesConfig: !dir,
79
88
  });
80
89
  return {
81
90
  cacheUsed: result.cacheUsed,
@@ -23,9 +23,14 @@ export function inspectTemplate(options) {
23
23
  ttlMs: cacheTtlMs,
24
24
  cacheBaseDir: resolveCacheBaseDir(cacheBaseDir),
25
25
  });
26
- // If dir is provided, prefix fromPath with it
27
- // Otherwise, let create-gen-app resolve via .boilerplates.json
28
- const effectiveFromPath = dir ? path.join(dir, fromPath) : fromPath;
26
+ // Compute effective fromPath:
27
+ // - If dir is provided, join it with fromPath and bypass .boilerplates.json
28
+ // - If dir is NOT provided, let create-gen-app use .boilerplates.json
29
+ const effectiveFromPath = dir
30
+ ? fromPath
31
+ ? path.join(dir, fromPath)
32
+ : dir
33
+ : fromPath;
29
34
  const template = templateRepo.startsWith('.') ||
30
35
  templateRepo.startsWith('/') ||
31
36
  templateRepo.startsWith('~')
@@ -35,6 +40,8 @@ export function inspectTemplate(options) {
35
40
  template,
36
41
  branch,
37
42
  fromPath: effectiveFromPath,
43
+ // When dir is specified, bypass .boilerplates.json resolution entirely
44
+ useBoilerplatesConfig: !dir,
38
45
  });
39
46
  return {
40
47
  templateDir: result.templateDir,
@@ -52,7 +59,7 @@ export async function scaffoldTemplate(options) {
52
59
  ttlMs: cacheTtlMs,
53
60
  cacheBaseDir: resolveCacheBaseDir(cacheBaseDir),
54
61
  });
55
- // If dir is provided, prefix fromPath with it
62
+ // If dir is provided, join it with fromPath and bypass .boilerplates.json
56
63
  // Otherwise, let create-gen-app resolve via .boilerplates.json
57
64
  const effectiveFromPath = dir ? path.join(dir, fromPath) : fromPath;
58
65
  const template = templateRepo.startsWith('.') ||
@@ -68,6 +75,8 @@ export async function scaffoldTemplate(options) {
68
75
  answers,
69
76
  noTty,
70
77
  prompter,
78
+ // When dir is specified, bypass .boilerplates.json resolution entirely
79
+ useBoilerplatesConfig: !dir,
71
80
  });
72
81
  return {
73
82
  cacheUsed: result.cacheUsed,
@@ -218,7 +218,10 @@ export const exportMeta = async ({ opts, dbname, database_id }) => {
218
218
  const queryAndParse = async (key, query) => {
219
219
  const result = await pool.query(query, [database_id]);
220
220
  if (result.rows.length) {
221
- sql[key] = await parsers[key].parse(result.rows);
221
+ const parsed = await parsers[key].parse(result.rows);
222
+ if (parsed) {
223
+ sql[key] = parsed;
224
+ }
222
225
  }
223
226
  };
224
227
  await queryAndParse('database', `SELECT * FROM collections_public.database WHERE id = $1`);
@@ -221,7 +221,10 @@ const exportMeta = async ({ opts, dbname, database_id }) => {
221
221
  const queryAndParse = async (key, query) => {
222
222
  const result = await pool.query(query, [database_id]);
223
223
  if (result.rows.length) {
224
- sql[key] = await parsers[key].parse(result.rows);
224
+ const parsed = await parsers[key].parse(result.rows);
225
+ if (parsed) {
226
+ sql[key] = parsed;
227
+ }
225
228
  }
226
229
  };
227
230
  await queryAndParse('database', `SELECT * FROM collections_public.database WHERE id = $1`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/core",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PGPM Package and Migration Tools",
6
6
  "main": "index.js",
@@ -48,21 +48,21 @@
48
48
  "makage": "^0.1.9"
49
49
  },
50
50
  "dependencies": {
51
- "@pgpmjs/env": "^2.8.8",
51
+ "@pgpmjs/env": "^2.8.9",
52
52
  "@pgpmjs/logger": "^1.3.5",
53
- "@pgpmjs/server-utils": "^2.8.9",
54
- "@pgpmjs/types": "^2.12.6",
55
- "create-gen-app": "^0.8.1",
56
- "csv-to-pg": "^2.0.10",
53
+ "@pgpmjs/server-utils": "^2.8.10",
54
+ "@pgpmjs/types": "^2.12.7",
55
+ "create-gen-app": "^0.9.0",
56
+ "csv-to-pg": "^3.1.4",
57
57
  "glob": "^13.0.0",
58
58
  "komoji": "^0.7.11",
59
59
  "parse-package-name": "^1.0.0",
60
60
  "pg": "^8.16.3",
61
- "pg-cache": "^1.6.9",
61
+ "pg-cache": "^1.6.10",
62
62
  "pg-env": "^1.2.4",
63
63
  "pgsql-deparser": "^17.14.0",
64
64
  "pgsql-parser": "^17.9.4",
65
65
  "yanse": "^0.1.8"
66
66
  },
67
- "gitHead": "b1d773f5215ad5ea1dca82b33b550728fdcd1ec0"
67
+ "gitHead": "f6cb102f2d19174b4f54ed2ba0c02308b1325830"
68
68
  }