@pgpmjs/core 4.5.4 → 4.6.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.
@@ -23,6 +23,12 @@ export interface InitModuleOptions {
23
23
  noTty?: boolean;
24
24
  toolName?: string;
25
25
  answers?: Record<string, any>;
26
+ /**
27
+ * Parent directory where the module should be created.
28
+ * When provided, bypasses createModuleDirectory() and creates the module at outputDir/name.
29
+ * Must be an absolute path or relative to workspace root.
30
+ */
31
+ outputDir?: string;
26
32
  }
27
33
  export declare class PgpmPackage {
28
34
  cwd: string;
@@ -364,7 +364,19 @@ class PgpmPackage {
364
364
  }
365
365
  async initModule(options) {
366
366
  this.ensureWorkspace();
367
- const targetPath = this.createModuleDirectory(options.name);
367
+ // If outputDir is provided, use it directly instead of createModuleDirectory
368
+ let targetPath;
369
+ if (options.outputDir) {
370
+ // Resolve outputDir relative to workspace if not absolute
371
+ const resolvedOutputDir = path_1.default.isAbsolute(options.outputDir)
372
+ ? options.outputDir
373
+ : path_1.default.resolve(this.workspacePath, options.outputDir);
374
+ targetPath = path_1.default.join(resolvedOutputDir, options.name);
375
+ fs_1.default.mkdirSync(targetPath, { recursive: true });
376
+ }
377
+ else {
378
+ targetPath = this.createModuleDirectory(options.name);
379
+ }
368
380
  const answers = {
369
381
  ...options.answers,
370
382
  name: options.name,
@@ -325,7 +325,19 @@ export class PgpmPackage {
325
325
  }
326
326
  async initModule(options) {
327
327
  this.ensureWorkspace();
328
- const targetPath = this.createModuleDirectory(options.name);
328
+ // If outputDir is provided, use it directly instead of createModuleDirectory
329
+ let targetPath;
330
+ if (options.outputDir) {
331
+ // Resolve outputDir relative to workspace if not absolute
332
+ const resolvedOutputDir = path.isAbsolute(options.outputDir)
333
+ ? options.outputDir
334
+ : path.resolve(this.workspacePath, options.outputDir);
335
+ targetPath = path.join(resolvedOutputDir, options.name);
336
+ fs.mkdirSync(targetPath, { recursive: true });
337
+ }
338
+ else {
339
+ targetPath = this.createModuleDirectory(options.name);
340
+ }
329
341
  const answers = {
330
342
  ...options.answers,
331
343
  name: options.name,
@@ -261,6 +261,8 @@ const preparePackage = async ({ project, author, outdir, name, description, exte
261
261
  description,
262
262
  author,
263
263
  extensions,
264
+ // Use outputDir to create module directly in the specified location
265
+ outputDir: outdir,
264
266
  answers: {
265
267
  moduleName: name,
266
268
  moduleDesc: description,
@@ -268,6 +268,8 @@ const preparePackage = async ({ project, author, outdir, name, description, exte
268
268
  description,
269
269
  author,
270
270
  extensions,
271
+ // Use outputDir to create module directly in the specified location
272
+ outputDir: outdir,
271
273
  answers: {
272
274
  moduleName: name,
273
275
  moduleDesc: description,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/core",
3
- "version": "4.5.4",
3
+ "version": "4.6.0",
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": "324881a46912b7d15a76f864aada03ce926f9176"
67
+ "gitHead": "bec3240e4e0f93b8edb386734eeb560403f574da"
68
68
  }