@pgpmjs/core 6.27.1 → 6.28.0
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.
|
@@ -90,7 +90,17 @@ export interface ScaffoldTemplateResult {
|
|
|
90
90
|
/** Questions loaded from .boilerplate.json, if any */
|
|
91
91
|
questions?: Question[];
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Registry of known boilerplate template repos, keyed by flavor. Add new
|
|
95
|
+
* backends (e.g. `turso`) here rather than sprinkling flavor-specific
|
|
96
|
+
* constants across the codebase.
|
|
97
|
+
*/
|
|
98
|
+
export declare const TEMPLATE_REPOS: {
|
|
99
|
+
readonly default: "https://github.com/constructive-io/pgpm-boilerplates.git";
|
|
100
|
+
readonly pglite: "https://github.com/constructive-io/pglite-boilerplates.git";
|
|
101
|
+
};
|
|
102
|
+
export type TemplateRepoFlavor = keyof typeof TEMPLATE_REPOS;
|
|
103
|
+
export declare const DEFAULT_TEMPLATE_REPO: "https://github.com/constructive-io/pgpm-boilerplates.git";
|
|
94
104
|
export declare const DEFAULT_TEMPLATE_TTL_MS: number;
|
|
95
105
|
export declare const DEFAULT_TEMPLATE_TOOL_NAME = "pgpm";
|
|
96
106
|
export declare function inspectTemplate(options: InspectTemplateOptions): InspectTemplateResult;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DEFAULT_TEMPLATE_TOOL_NAME = exports.DEFAULT_TEMPLATE_TTL_MS = exports.DEFAULT_TEMPLATE_REPO = exports.SkillInstaller = void 0;
|
|
6
|
+
exports.DEFAULT_TEMPLATE_TOOL_NAME = exports.DEFAULT_TEMPLATE_TTL_MS = exports.DEFAULT_TEMPLATE_REPO = exports.TEMPLATE_REPOS = exports.SkillInstaller = void 0;
|
|
7
7
|
exports.inspectTemplate = inspectTemplate;
|
|
8
8
|
exports.scaffoldTemplate = scaffoldTemplate;
|
|
9
9
|
const os_1 = __importDefault(require("os"));
|
|
@@ -11,7 +11,16 @@ const path_1 = __importDefault(require("path"));
|
|
|
11
11
|
const genomic_1 = require("genomic");
|
|
12
12
|
var genomic_2 = require("genomic");
|
|
13
13
|
Object.defineProperty(exports, "SkillInstaller", { enumerable: true, get: function () { return genomic_2.SkillInstaller; } });
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Registry of known boilerplate template repos, keyed by flavor. Add new
|
|
16
|
+
* backends (e.g. `turso`) here rather than sprinkling flavor-specific
|
|
17
|
+
* constants across the codebase.
|
|
18
|
+
*/
|
|
19
|
+
exports.TEMPLATE_REPOS = {
|
|
20
|
+
default: 'https://github.com/constructive-io/pgpm-boilerplates.git',
|
|
21
|
+
pglite: 'https://github.com/constructive-io/pglite-boilerplates.git'
|
|
22
|
+
};
|
|
23
|
+
exports.DEFAULT_TEMPLATE_REPO = exports.TEMPLATE_REPOS.default;
|
|
15
24
|
exports.DEFAULT_TEMPLATE_TTL_MS = 1 * 24 * 60 * 60 * 1000; // 1 day
|
|
16
25
|
exports.DEFAULT_TEMPLATE_TOOL_NAME = 'pgpm';
|
|
17
26
|
function resolveCacheBaseDir(cacheBaseDir) {
|
|
@@ -2,7 +2,16 @@ import os from 'os';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { TemplateScaffolder } from 'genomic';
|
|
4
4
|
export { SkillInstaller } from 'genomic';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Registry of known boilerplate template repos, keyed by flavor. Add new
|
|
7
|
+
* backends (e.g. `turso`) here rather than sprinkling flavor-specific
|
|
8
|
+
* constants across the codebase.
|
|
9
|
+
*/
|
|
10
|
+
export const TEMPLATE_REPOS = {
|
|
11
|
+
default: 'https://github.com/constructive-io/pgpm-boilerplates.git',
|
|
12
|
+
pglite: 'https://github.com/constructive-io/pglite-boilerplates.git'
|
|
13
|
+
};
|
|
14
|
+
export const DEFAULT_TEMPLATE_REPO = TEMPLATE_REPOS.default;
|
|
6
15
|
export const DEFAULT_TEMPLATE_TTL_MS = 1 * 24 * 60 * 60 * 1000; // 1 day
|
|
7
16
|
export const DEFAULT_TEMPLATE_TOOL_NAME = 'pgpm';
|
|
8
17
|
function resolveCacheBaseDir(cacheBaseDir) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFileSync } from 'fs';
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
2
2
|
import { getExtensionInfo } from './reader';
|
|
3
3
|
/**
|
|
4
4
|
* Write the Makefile for the extension.
|
|
@@ -39,10 +39,46 @@ superuser = ${superuser}\n`;
|
|
|
39
39
|
}
|
|
40
40
|
return content;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Update (or insert/remove) the `requires =` line of an existing .control file
|
|
44
|
+
* in place, preserving every other field and the file's formatting. Used when
|
|
45
|
+
* changing a module's dependencies after init (e.g. via `pgpm extension`) so
|
|
46
|
+
* hand-tuned fields (comment, schema, relocatable, module_pathname) survive.
|
|
47
|
+
*/
|
|
48
|
+
export function upsertRequiresLine(content, requires) {
|
|
49
|
+
const lines = content.split('\n');
|
|
50
|
+
const idx = lines.findIndex((line) => /^\s*requires\s*=/.test(line));
|
|
51
|
+
if (requires.length === 0) {
|
|
52
|
+
if (idx !== -1)
|
|
53
|
+
lines.splice(idx, 1);
|
|
54
|
+
return lines.join('\n');
|
|
55
|
+
}
|
|
56
|
+
const requiresLine = `requires = '${requires.join(',')}'`;
|
|
57
|
+
if (idx !== -1) {
|
|
58
|
+
lines[idx] = requiresLine;
|
|
59
|
+
return lines.join('\n');
|
|
60
|
+
}
|
|
61
|
+
// Insert to match generated ordering (before relocatable/superuser/schema).
|
|
62
|
+
const insertAt = lines.findIndex((line) => /^\s*(relocatable|superuser|schema)\s*=/.test(line));
|
|
63
|
+
if (insertAt !== -1) {
|
|
64
|
+
lines.splice(insertAt, 0, requiresLine);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
lines.push(requiresLine);
|
|
68
|
+
}
|
|
69
|
+
return lines.join('\n');
|
|
70
|
+
}
|
|
42
71
|
/**
|
|
43
72
|
* Write the control file for the extension.
|
|
73
|
+
* If the file already exists, only its `requires` line is updated so that any
|
|
74
|
+
* custom fields are preserved; otherwise a fresh file is generated.
|
|
44
75
|
*/
|
|
45
76
|
export const writeExtensionControlFile = (outputPath, extname, extensions, version) => {
|
|
77
|
+
if (existsSync(outputPath)) {
|
|
78
|
+
const existing = readFileSync(outputPath, 'utf-8');
|
|
79
|
+
writeFileSync(outputPath, upsertRequiresLine(existing, extensions));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
46
82
|
const content = generateControlFileContent({
|
|
47
83
|
name: extname,
|
|
48
84
|
version,
|
|
@@ -17,8 +17,17 @@ export declare function generateControlFileContent(options: {
|
|
|
17
17
|
schema?: string;
|
|
18
18
|
module_pathname?: string;
|
|
19
19
|
}): string;
|
|
20
|
+
/**
|
|
21
|
+
* Update (or insert/remove) the `requires =` line of an existing .control file
|
|
22
|
+
* in place, preserving every other field and the file's formatting. Used when
|
|
23
|
+
* changing a module's dependencies after init (e.g. via `pgpm extension`) so
|
|
24
|
+
* hand-tuned fields (comment, schema, relocatable, module_pathname) survive.
|
|
25
|
+
*/
|
|
26
|
+
export declare function upsertRequiresLine(content: string, requires: string[]): string;
|
|
20
27
|
/**
|
|
21
28
|
* Write the control file for the extension.
|
|
29
|
+
* If the file already exists, only its `requires` line is updated so that any
|
|
30
|
+
* custom fields are preserved; otherwise a fresh file is generated.
|
|
22
31
|
*/
|
|
23
32
|
export declare const writeExtensionControlFile: (outputPath: string, extname: string, extensions: string[], version: string) => void;
|
|
24
33
|
/**
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.writeExtensions = exports.writeExtensionControlFile = exports.writeExtensionMakefile = void 0;
|
|
4
4
|
exports.generateControlFileContent = generateControlFileContent;
|
|
5
|
+
exports.upsertRequiresLine = upsertRequiresLine;
|
|
5
6
|
const fs_1 = require("fs");
|
|
6
7
|
const reader_1 = require("./reader");
|
|
7
8
|
/**
|
|
@@ -44,10 +45,46 @@ superuser = ${superuser}\n`;
|
|
|
44
45
|
}
|
|
45
46
|
return content;
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Update (or insert/remove) the `requires =` line of an existing .control file
|
|
50
|
+
* in place, preserving every other field and the file's formatting. Used when
|
|
51
|
+
* changing a module's dependencies after init (e.g. via `pgpm extension`) so
|
|
52
|
+
* hand-tuned fields (comment, schema, relocatable, module_pathname) survive.
|
|
53
|
+
*/
|
|
54
|
+
function upsertRequiresLine(content, requires) {
|
|
55
|
+
const lines = content.split('\n');
|
|
56
|
+
const idx = lines.findIndex((line) => /^\s*requires\s*=/.test(line));
|
|
57
|
+
if (requires.length === 0) {
|
|
58
|
+
if (idx !== -1)
|
|
59
|
+
lines.splice(idx, 1);
|
|
60
|
+
return lines.join('\n');
|
|
61
|
+
}
|
|
62
|
+
const requiresLine = `requires = '${requires.join(',')}'`;
|
|
63
|
+
if (idx !== -1) {
|
|
64
|
+
lines[idx] = requiresLine;
|
|
65
|
+
return lines.join('\n');
|
|
66
|
+
}
|
|
67
|
+
// Insert to match generated ordering (before relocatable/superuser/schema).
|
|
68
|
+
const insertAt = lines.findIndex((line) => /^\s*(relocatable|superuser|schema)\s*=/.test(line));
|
|
69
|
+
if (insertAt !== -1) {
|
|
70
|
+
lines.splice(insertAt, 0, requiresLine);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
lines.push(requiresLine);
|
|
74
|
+
}
|
|
75
|
+
return lines.join('\n');
|
|
76
|
+
}
|
|
47
77
|
/**
|
|
48
78
|
* Write the control file for the extension.
|
|
79
|
+
* If the file already exists, only its `requires` line is updated so that any
|
|
80
|
+
* custom fields are preserved; otherwise a fresh file is generated.
|
|
49
81
|
*/
|
|
50
82
|
const writeExtensionControlFile = (outputPath, extname, extensions, version) => {
|
|
83
|
+
if ((0, fs_1.existsSync)(outputPath)) {
|
|
84
|
+
const existing = (0, fs_1.readFileSync)(outputPath, 'utf-8');
|
|
85
|
+
(0, fs_1.writeFileSync)(outputPath, upsertRequiresLine(existing, extensions));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
51
88
|
const content = generateControlFileContent({
|
|
52
89
|
name: extname,
|
|
53
90
|
version,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpmjs/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.28.0",
|
|
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.3.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@pgpmjs/env": "^2.26.
|
|
51
|
+
"@pgpmjs/env": "^2.26.3",
|
|
52
52
|
"@pgpmjs/logger": "^2.13.0",
|
|
53
|
-
"@pgpmjs/server-utils": "^3.14.
|
|
54
|
-
"@pgpmjs/types": "^2.
|
|
53
|
+
"@pgpmjs/server-utils": "^3.14.3",
|
|
54
|
+
"@pgpmjs/types": "^2.33.0",
|
|
55
55
|
"csv-to-pg": "^3.20.1",
|
|
56
56
|
"genomic": "^5.6.2",
|
|
57
57
|
"glob": "^13.0.6",
|
|
58
58
|
"minimatch": "^10.2.5",
|
|
59
59
|
"parse-package-name": "^1.0.0",
|
|
60
60
|
"pg": "^8.21.0",
|
|
61
|
-
"pg-cache": "^3.14.
|
|
61
|
+
"pg-cache": "^3.14.2",
|
|
62
62
|
"pg-env": "^1.17.0",
|
|
63
63
|
"pgsql-deparser": "^17.18.3",
|
|
64
64
|
"pgsql-parser": "^17.9.15",
|
|
65
65
|
"yanse": "^0.2.1"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "e2a1337c7ec8366b28c10e550645e44cad6085ff"
|
|
68
68
|
}
|