@pgpmjs/core 4.5.2 → 4.5.4
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.
|
@@ -92,8 +92,10 @@ const installMissingModules = async (moduleDir, missingModules) => {
|
|
|
92
92
|
await moduleProject.installModules(...missingNames);
|
|
93
93
|
console.log('Modules installed successfully.');
|
|
94
94
|
};
|
|
95
|
-
const exportMigrationsToDisk = async ({ project, options, database, databaseId, databaseName, author, outdir, schema_names, extensionName, extensionDesc, metaExtensionName, metaExtensionDesc, prompter }) => {
|
|
95
|
+
const exportMigrationsToDisk = async ({ project, options, database, databaseId, databaseName, author, outdir, schema_names, extensionName, extensionDesc, metaExtensionName, metaExtensionDesc, prompter, repoName, username, serviceOutdir }) => {
|
|
96
96
|
outdir = outdir + '/';
|
|
97
|
+
// Use serviceOutdir for service module, defaulting to outdir if not provided
|
|
98
|
+
const svcOutdir = (serviceOutdir || outdir.slice(0, -1)) + '/';
|
|
97
99
|
const pgPool = getPgPool({
|
|
98
100
|
...options.pg,
|
|
99
101
|
database
|
|
@@ -133,7 +135,9 @@ const exportMigrationsToDisk = async ({ project, options, database, databaseId,
|
|
|
133
135
|
name,
|
|
134
136
|
description: dbExtensionDesc,
|
|
135
137
|
extensions: [...DB_REQUIRED_EXTENSIONS],
|
|
136
|
-
prompter
|
|
138
|
+
prompter,
|
|
139
|
+
repoName,
|
|
140
|
+
username
|
|
137
141
|
});
|
|
138
142
|
// Install missing modules if user confirmed (now that module exists)
|
|
139
143
|
if (dbMissingResult.shouldInstall) {
|
|
@@ -151,15 +155,17 @@ const exportMigrationsToDisk = async ({ project, options, database, databaseId,
|
|
|
151
155
|
const metaDesc = metaExtensionDesc || `${metaExtensionName} service utilities for managing domains, APIs, and services`;
|
|
152
156
|
// Detect missing modules at workspace level and prompt user
|
|
153
157
|
const svcMissingResult = await detectMissingModules(project, [...SERVICE_REQUIRED_EXTENSIONS], prompter);
|
|
154
|
-
// Create/prepare the module directory
|
|
158
|
+
// Create/prepare the module directory (use serviceOutdir if provided)
|
|
155
159
|
const svcModuleDir = await preparePackage({
|
|
156
160
|
project,
|
|
157
161
|
author,
|
|
158
|
-
outdir,
|
|
162
|
+
outdir: svcOutdir,
|
|
159
163
|
name: metaExtensionName,
|
|
160
164
|
description: metaDesc,
|
|
161
165
|
extensions: [...SERVICE_REQUIRED_EXTENSIONS],
|
|
162
|
-
prompter
|
|
166
|
+
prompter,
|
|
167
|
+
repoName,
|
|
168
|
+
username
|
|
163
169
|
});
|
|
164
170
|
// Install missing modules if user confirmed (now that module exists)
|
|
165
171
|
if (svcMissingResult.shouldInstall) {
|
|
@@ -207,12 +213,13 @@ SET session_replication_role TO DEFAULT;
|
|
|
207
213
|
];
|
|
208
214
|
opts.replacer = metaReplacer.replacer;
|
|
209
215
|
opts.name = metaExtensionName;
|
|
216
|
+
opts.outdir = svcOutdir;
|
|
210
217
|
writePgpmPlan(metaPackage, opts);
|
|
211
218
|
writePgpmFiles(metaPackage, opts);
|
|
212
219
|
}
|
|
213
220
|
pgPool.end();
|
|
214
221
|
};
|
|
215
|
-
export const exportMigrations = async ({ project, options, dbInfo, author, outdir, schema_names, extensionName, extensionDesc, metaExtensionName, metaExtensionDesc, prompter }) => {
|
|
222
|
+
export const exportMigrations = async ({ project, options, dbInfo, author, outdir, schema_names, extensionName, extensionDesc, metaExtensionName, metaExtensionDesc, prompter, repoName, username, serviceOutdir }) => {
|
|
216
223
|
for (let v = 0; v < dbInfo.database_ids.length; v++) {
|
|
217
224
|
const databaseId = dbInfo.database_ids[v];
|
|
218
225
|
await exportMigrationsToDisk({
|
|
@@ -228,7 +235,10 @@ export const exportMigrations = async ({ project, options, dbInfo, author, outdi
|
|
|
228
235
|
schema_names,
|
|
229
236
|
author,
|
|
230
237
|
outdir,
|
|
231
|
-
prompter
|
|
238
|
+
prompter,
|
|
239
|
+
repoName,
|
|
240
|
+
username,
|
|
241
|
+
serviceOutdir
|
|
232
242
|
});
|
|
233
243
|
}
|
|
234
244
|
};
|
|
@@ -238,7 +248,7 @@ export const exportMigrations = async ({ project, options, dbInfo, author, outdi
|
|
|
238
248
|
*
|
|
239
249
|
* @returns The absolute path to the created/prepared module directory
|
|
240
250
|
*/
|
|
241
|
-
const preparePackage = async ({ project, author, outdir, name, description, extensions, prompter }) => {
|
|
251
|
+
const preparePackage = async ({ project, author, outdir, name, description, extensions, prompter, repoName, username }) => {
|
|
242
252
|
const curDir = process.cwd();
|
|
243
253
|
const pgpmDir = path.resolve(path.join(outdir, name));
|
|
244
254
|
mkdirSync(pgpmDir, { recursive: true });
|
|
@@ -257,7 +267,10 @@ const preparePackage = async ({ project, author, outdir, name, description, exte
|
|
|
257
267
|
access: 'restricted',
|
|
258
268
|
license: 'CLOSED',
|
|
259
269
|
fullName,
|
|
260
|
-
...(email && { email })
|
|
270
|
+
...(email && { email }),
|
|
271
|
+
// Use provided values or sensible defaults
|
|
272
|
+
repoName: repoName || name,
|
|
273
|
+
...(username && { username })
|
|
261
274
|
}
|
|
262
275
|
});
|
|
263
276
|
}
|
|
@@ -23,6 +23,12 @@ interface ExportOptions {
|
|
|
23
23
|
metaExtensionName: string;
|
|
24
24
|
metaExtensionDesc?: string;
|
|
25
25
|
prompter?: Prompter;
|
|
26
|
+
/** Repository name for module scaffolding. Defaults to module name if not provided. */
|
|
27
|
+
repoName?: string;
|
|
28
|
+
/** GitHub username/org for module scaffolding. Required for non-interactive use. */
|
|
29
|
+
username?: string;
|
|
30
|
+
/** Output directory for service/meta module. Defaults to outdir if not provided. */
|
|
31
|
+
serviceOutdir?: string;
|
|
26
32
|
}
|
|
27
|
-
export declare const exportMigrations: ({ project, options, dbInfo, author, outdir, schema_names, extensionName, extensionDesc, metaExtensionName, metaExtensionDesc, prompter }: ExportOptions) => Promise<void>;
|
|
33
|
+
export declare const exportMigrations: ({ project, options, dbInfo, author, outdir, schema_names, extensionName, extensionDesc, metaExtensionName, metaExtensionDesc, prompter, repoName, username, serviceOutdir }: ExportOptions) => Promise<void>;
|
|
28
34
|
export {};
|
|
@@ -98,8 +98,10 @@ const installMissingModules = async (moduleDir, missingModules) => {
|
|
|
98
98
|
await moduleProject.installModules(...missingNames);
|
|
99
99
|
console.log('Modules installed successfully.');
|
|
100
100
|
};
|
|
101
|
-
const exportMigrationsToDisk = async ({ project, options, database, databaseId, databaseName, author, outdir, schema_names, extensionName, extensionDesc, metaExtensionName, metaExtensionDesc, prompter }) => {
|
|
101
|
+
const exportMigrationsToDisk = async ({ project, options, database, databaseId, databaseName, author, outdir, schema_names, extensionName, extensionDesc, metaExtensionName, metaExtensionDesc, prompter, repoName, username, serviceOutdir }) => {
|
|
102
102
|
outdir = outdir + '/';
|
|
103
|
+
// Use serviceOutdir for service module, defaulting to outdir if not provided
|
|
104
|
+
const svcOutdir = (serviceOutdir || outdir.slice(0, -1)) + '/';
|
|
103
105
|
const pgPool = (0, pg_cache_1.getPgPool)({
|
|
104
106
|
...options.pg,
|
|
105
107
|
database
|
|
@@ -139,7 +141,9 @@ const exportMigrationsToDisk = async ({ project, options, database, databaseId,
|
|
|
139
141
|
name,
|
|
140
142
|
description: dbExtensionDesc,
|
|
141
143
|
extensions: [...DB_REQUIRED_EXTENSIONS],
|
|
142
|
-
prompter
|
|
144
|
+
prompter,
|
|
145
|
+
repoName,
|
|
146
|
+
username
|
|
143
147
|
});
|
|
144
148
|
// Install missing modules if user confirmed (now that module exists)
|
|
145
149
|
if (dbMissingResult.shouldInstall) {
|
|
@@ -157,15 +161,17 @@ const exportMigrationsToDisk = async ({ project, options, database, databaseId,
|
|
|
157
161
|
const metaDesc = metaExtensionDesc || `${metaExtensionName} service utilities for managing domains, APIs, and services`;
|
|
158
162
|
// Detect missing modules at workspace level and prompt user
|
|
159
163
|
const svcMissingResult = await detectMissingModules(project, [...SERVICE_REQUIRED_EXTENSIONS], prompter);
|
|
160
|
-
// Create/prepare the module directory
|
|
164
|
+
// Create/prepare the module directory (use serviceOutdir if provided)
|
|
161
165
|
const svcModuleDir = await preparePackage({
|
|
162
166
|
project,
|
|
163
167
|
author,
|
|
164
|
-
outdir,
|
|
168
|
+
outdir: svcOutdir,
|
|
165
169
|
name: metaExtensionName,
|
|
166
170
|
description: metaDesc,
|
|
167
171
|
extensions: [...SERVICE_REQUIRED_EXTENSIONS],
|
|
168
|
-
prompter
|
|
172
|
+
prompter,
|
|
173
|
+
repoName,
|
|
174
|
+
username
|
|
169
175
|
});
|
|
170
176
|
// Install missing modules if user confirmed (now that module exists)
|
|
171
177
|
if (svcMissingResult.shouldInstall) {
|
|
@@ -213,12 +219,13 @@ SET session_replication_role TO DEFAULT;
|
|
|
213
219
|
];
|
|
214
220
|
opts.replacer = metaReplacer.replacer;
|
|
215
221
|
opts.name = metaExtensionName;
|
|
222
|
+
opts.outdir = svcOutdir;
|
|
216
223
|
(0, files_1.writePgpmPlan)(metaPackage, opts);
|
|
217
224
|
(0, files_1.writePgpmFiles)(metaPackage, opts);
|
|
218
225
|
}
|
|
219
226
|
pgPool.end();
|
|
220
227
|
};
|
|
221
|
-
const exportMigrations = async ({ project, options, dbInfo, author, outdir, schema_names, extensionName, extensionDesc, metaExtensionName, metaExtensionDesc, prompter }) => {
|
|
228
|
+
const exportMigrations = async ({ project, options, dbInfo, author, outdir, schema_names, extensionName, extensionDesc, metaExtensionName, metaExtensionDesc, prompter, repoName, username, serviceOutdir }) => {
|
|
222
229
|
for (let v = 0; v < dbInfo.database_ids.length; v++) {
|
|
223
230
|
const databaseId = dbInfo.database_ids[v];
|
|
224
231
|
await exportMigrationsToDisk({
|
|
@@ -234,7 +241,10 @@ const exportMigrations = async ({ project, options, dbInfo, author, outdir, sche
|
|
|
234
241
|
schema_names,
|
|
235
242
|
author,
|
|
236
243
|
outdir,
|
|
237
|
-
prompter
|
|
244
|
+
prompter,
|
|
245
|
+
repoName,
|
|
246
|
+
username,
|
|
247
|
+
serviceOutdir
|
|
238
248
|
});
|
|
239
249
|
}
|
|
240
250
|
};
|
|
@@ -245,7 +255,7 @@ exports.exportMigrations = exportMigrations;
|
|
|
245
255
|
*
|
|
246
256
|
* @returns The absolute path to the created/prepared module directory
|
|
247
257
|
*/
|
|
248
|
-
const preparePackage = async ({ project, author, outdir, name, description, extensions, prompter }) => {
|
|
258
|
+
const preparePackage = async ({ project, author, outdir, name, description, extensions, prompter, repoName, username }) => {
|
|
249
259
|
const curDir = process.cwd();
|
|
250
260
|
const pgpmDir = path_1.default.resolve(path_1.default.join(outdir, name));
|
|
251
261
|
(0, fs_1.mkdirSync)(pgpmDir, { recursive: true });
|
|
@@ -264,7 +274,10 @@ const preparePackage = async ({ project, author, outdir, name, description, exte
|
|
|
264
274
|
access: 'restricted',
|
|
265
275
|
license: 'CLOSED',
|
|
266
276
|
fullName,
|
|
267
|
-
...(email && { email })
|
|
277
|
+
...(email && { email }),
|
|
278
|
+
// Use provided values or sensible defaults
|
|
279
|
+
repoName: repoName || name,
|
|
280
|
+
...(username && { username })
|
|
268
281
|
}
|
|
269
282
|
});
|
|
270
283
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpmjs/core",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.4",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "PGPM Package and Migration Tools",
|
|
6
6
|
"main": "index.js",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"pgsql-parser": "^17.9.5",
|
|
65
65
|
"yanse": "^0.1.8"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "324881a46912b7d15a76f864aada03ce926f9176"
|
|
68
68
|
}
|