pgpm 2.2.0 → 2.3.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.
- package/commands/init/index.js +34 -3
- package/esm/commands/init/index.js +34 -3
- package/package.json +8 -7
package/commands/init/index.js
CHANGED
|
@@ -74,6 +74,8 @@ async function handleInit(argv, prompter) {
|
|
|
74
74
|
}
|
|
75
75
|
// Regular init path: default to 'module' if no fromPath provided
|
|
76
76
|
const fromPath = positionalFromPath || 'module';
|
|
77
|
+
// Track if user explicitly requested module (e.g., `pgpm init module`)
|
|
78
|
+
const wasExplicitModuleRequest = positionalFromPath === 'module';
|
|
77
79
|
// Inspect the template to get its type
|
|
78
80
|
const inspection = (0, core_1.inspectTemplate)({
|
|
79
81
|
fromPath,
|
|
@@ -103,7 +105,7 @@ async function handleInit(argv, prompter) {
|
|
|
103
105
|
dir,
|
|
104
106
|
noTty,
|
|
105
107
|
cwd,
|
|
106
|
-
});
|
|
108
|
+
}, wasExplicitModuleRequest);
|
|
107
109
|
}
|
|
108
110
|
async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
109
111
|
let fromPath;
|
|
@@ -171,6 +173,7 @@ async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
|
171
173
|
});
|
|
172
174
|
}
|
|
173
175
|
// Default to module init (for 'module' type or unknown types)
|
|
176
|
+
// When using --boilerplate, user made an explicit choice, so treat as explicit request
|
|
174
177
|
return handleModuleInit(argv, prompter, {
|
|
175
178
|
fromPath,
|
|
176
179
|
templateRepo: ctx.templateRepo,
|
|
@@ -178,7 +181,7 @@ async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
|
178
181
|
dir: ctx.dir,
|
|
179
182
|
noTty: ctx.noTty,
|
|
180
183
|
cwd: ctx.cwd,
|
|
181
|
-
});
|
|
184
|
+
}, true);
|
|
182
185
|
}
|
|
183
186
|
async function handleWorkspaceInit(argv, prompter, ctx) {
|
|
184
187
|
const workspaceQuestions = [
|
|
@@ -229,9 +232,37 @@ async function handleWorkspaceInit(argv, prompter, ctx) {
|
|
|
229
232
|
process.stdout.write(`\n✨ Enjoy!\n\ncd ./${dirName}\n`);
|
|
230
233
|
return { ...argv, ...answers, cwd: targetPath };
|
|
231
234
|
}
|
|
232
|
-
async function handleModuleInit(argv, prompter, ctx) {
|
|
235
|
+
async function handleModuleInit(argv, prompter, ctx, wasExplicitModuleRequest = false) {
|
|
233
236
|
const project = new core_1.PgpmPackage(ctx.cwd);
|
|
234
237
|
if (!project.workspacePath) {
|
|
238
|
+
const noTty = Boolean(argv.noTty || argv['no-tty'] || process.env.CI === 'true');
|
|
239
|
+
// If user explicitly requested module init or we're in non-interactive mode,
|
|
240
|
+
// just show the error with helpful guidance
|
|
241
|
+
if (wasExplicitModuleRequest || noTty) {
|
|
242
|
+
process.stderr.write('Not inside a PGPM workspace.\n');
|
|
243
|
+
throw types_1.errors.NOT_IN_WORKSPACE({});
|
|
244
|
+
}
|
|
245
|
+
// Offer to create a workspace instead
|
|
246
|
+
const recoveryQuestion = [
|
|
247
|
+
{
|
|
248
|
+
name: 'createWorkspace',
|
|
249
|
+
message: 'You are not inside a PGPM workspace. Would you like to create a new workspace instead?',
|
|
250
|
+
type: 'confirm',
|
|
251
|
+
required: true,
|
|
252
|
+
},
|
|
253
|
+
];
|
|
254
|
+
const { createWorkspace } = await prompter.prompt(argv, recoveryQuestion);
|
|
255
|
+
if (createWorkspace) {
|
|
256
|
+
return handleWorkspaceInit(argv, prompter, {
|
|
257
|
+
fromPath: 'workspace',
|
|
258
|
+
templateRepo: ctx.templateRepo,
|
|
259
|
+
branch: ctx.branch,
|
|
260
|
+
dir: ctx.dir,
|
|
261
|
+
noTty: ctx.noTty,
|
|
262
|
+
cwd: ctx.cwd,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
// User declined, show the error
|
|
235
266
|
process.stderr.write('Not inside a PGPM workspace.\n');
|
|
236
267
|
throw types_1.errors.NOT_IN_WORKSPACE({});
|
|
237
268
|
}
|
|
@@ -67,6 +67,8 @@ async function handleInit(argv, prompter) {
|
|
|
67
67
|
}
|
|
68
68
|
// Regular init path: default to 'module' if no fromPath provided
|
|
69
69
|
const fromPath = positionalFromPath || 'module';
|
|
70
|
+
// Track if user explicitly requested module (e.g., `pgpm init module`)
|
|
71
|
+
const wasExplicitModuleRequest = positionalFromPath === 'module';
|
|
70
72
|
// Inspect the template to get its type
|
|
71
73
|
const inspection = inspectTemplate({
|
|
72
74
|
fromPath,
|
|
@@ -96,7 +98,7 @@ async function handleInit(argv, prompter) {
|
|
|
96
98
|
dir,
|
|
97
99
|
noTty,
|
|
98
100
|
cwd,
|
|
99
|
-
});
|
|
101
|
+
}, wasExplicitModuleRequest);
|
|
100
102
|
}
|
|
101
103
|
async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
102
104
|
let fromPath;
|
|
@@ -164,6 +166,7 @@ async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
|
164
166
|
});
|
|
165
167
|
}
|
|
166
168
|
// Default to module init (for 'module' type or unknown types)
|
|
169
|
+
// When using --boilerplate, user made an explicit choice, so treat as explicit request
|
|
167
170
|
return handleModuleInit(argv, prompter, {
|
|
168
171
|
fromPath,
|
|
169
172
|
templateRepo: ctx.templateRepo,
|
|
@@ -171,7 +174,7 @@ async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
|
171
174
|
dir: ctx.dir,
|
|
172
175
|
noTty: ctx.noTty,
|
|
173
176
|
cwd: ctx.cwd,
|
|
174
|
-
});
|
|
177
|
+
}, true);
|
|
175
178
|
}
|
|
176
179
|
async function handleWorkspaceInit(argv, prompter, ctx) {
|
|
177
180
|
const workspaceQuestions = [
|
|
@@ -222,9 +225,37 @@ async function handleWorkspaceInit(argv, prompter, ctx) {
|
|
|
222
225
|
process.stdout.write(`\n✨ Enjoy!\n\ncd ./${dirName}\n`);
|
|
223
226
|
return { ...argv, ...answers, cwd: targetPath };
|
|
224
227
|
}
|
|
225
|
-
async function handleModuleInit(argv, prompter, ctx) {
|
|
228
|
+
async function handleModuleInit(argv, prompter, ctx, wasExplicitModuleRequest = false) {
|
|
226
229
|
const project = new PgpmPackage(ctx.cwd);
|
|
227
230
|
if (!project.workspacePath) {
|
|
231
|
+
const noTty = Boolean(argv.noTty || argv['no-tty'] || process.env.CI === 'true');
|
|
232
|
+
// If user explicitly requested module init or we're in non-interactive mode,
|
|
233
|
+
// just show the error with helpful guidance
|
|
234
|
+
if (wasExplicitModuleRequest || noTty) {
|
|
235
|
+
process.stderr.write('Not inside a PGPM workspace.\n');
|
|
236
|
+
throw errors.NOT_IN_WORKSPACE({});
|
|
237
|
+
}
|
|
238
|
+
// Offer to create a workspace instead
|
|
239
|
+
const recoveryQuestion = [
|
|
240
|
+
{
|
|
241
|
+
name: 'createWorkspace',
|
|
242
|
+
message: 'You are not inside a PGPM workspace. Would you like to create a new workspace instead?',
|
|
243
|
+
type: 'confirm',
|
|
244
|
+
required: true,
|
|
245
|
+
},
|
|
246
|
+
];
|
|
247
|
+
const { createWorkspace } = await prompter.prompt(argv, recoveryQuestion);
|
|
248
|
+
if (createWorkspace) {
|
|
249
|
+
return handleWorkspaceInit(argv, prompter, {
|
|
250
|
+
fromPath: 'workspace',
|
|
251
|
+
templateRepo: ctx.templateRepo,
|
|
252
|
+
branch: ctx.branch,
|
|
253
|
+
dir: ctx.dir,
|
|
254
|
+
noTty: ctx.noTty,
|
|
255
|
+
cwd: ctx.cwd,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
// User declined, show the error
|
|
228
259
|
process.stderr.write('Not inside a PGPM workspace.\n');
|
|
229
260
|
throw errors.NOT_IN_WORKSPACE({});
|
|
230
261
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgpm",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "PostgreSQL Package Manager - Database migration and package management CLI",
|
|
6
6
|
"main": "index.js",
|
|
@@ -39,23 +39,24 @@
|
|
|
39
39
|
"@types/pg": "^8.16.0",
|
|
40
40
|
"@types/semver": "^7.5.8",
|
|
41
41
|
"@types/shelljs": "^0.8.16",
|
|
42
|
+
"clean-ansi": "0.1.5",
|
|
42
43
|
"glob": "^13.0.0",
|
|
43
44
|
"makage": "^0.1.9",
|
|
44
45
|
"pg": "^8.16.3",
|
|
45
46
|
"ts-node": "^10.9.2"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"@pgpmjs/core": "^4.1.
|
|
49
|
-
"@pgpmjs/env": "^2.8.
|
|
49
|
+
"@pgpmjs/core": "^4.1.2",
|
|
50
|
+
"@pgpmjs/env": "^2.8.11",
|
|
50
51
|
"@pgpmjs/logger": "^1.3.5",
|
|
51
|
-
"@pgpmjs/types": "^2.12.
|
|
52
|
+
"@pgpmjs/types": "^2.12.8",
|
|
52
53
|
"appstash": "^0.2.6",
|
|
53
|
-
"create-gen-app": "^0.
|
|
54
|
+
"create-gen-app": "^0.10.0",
|
|
54
55
|
"find-and-require-package-json": "^0.8.2",
|
|
55
56
|
"inquirerer": "^2.4.0",
|
|
56
57
|
"js-yaml": "^4.1.0",
|
|
57
58
|
"minimist": "^1.2.8",
|
|
58
|
-
"pg-cache": "^1.6.
|
|
59
|
+
"pg-cache": "^1.6.11",
|
|
59
60
|
"pg-env": "^1.2.4",
|
|
60
61
|
"semver": "^7.6.2",
|
|
61
62
|
"shelljs": "^0.10.0",
|
|
@@ -73,5 +74,5 @@
|
|
|
73
74
|
"pg",
|
|
74
75
|
"pgsql"
|
|
75
76
|
],
|
|
76
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "c2e68f9808a87e3231d9b9af5e706bef5dbd2af8"
|
|
77
78
|
}
|