postgresdk 0.9.5 → 0.9.6
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/dist/cli.js +12 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1562,13 +1562,23 @@ function getFieldValue(key, existingFields, mergeStrategy, userChoices) {
|
|
|
1562
1562
|
return value;
|
|
1563
1563
|
}
|
|
1564
1564
|
if (mergeStrategy === "interactive" && userChoices?.has(key)) {
|
|
1565
|
-
|
|
1565
|
+
const choice = userChoices.get(key);
|
|
1566
|
+
if (choice === "keep") {
|
|
1567
|
+
if (existing && !existing.isCommented) {
|
|
1568
|
+
const value = existing.value.toString().replace(/,\s*$/, "");
|
|
1569
|
+
return value;
|
|
1570
|
+
} else {
|
|
1571
|
+
return 'process.env.DATABASE_URL || "postgres://user:password@localhost:5432/mydb"';
|
|
1572
|
+
}
|
|
1573
|
+
} else if (choice === "new") {
|
|
1574
|
+
return 'process.env.DATABASE_URL || "postgres://user:password@localhost:5432/mydb"';
|
|
1575
|
+
}
|
|
1566
1576
|
}
|
|
1567
1577
|
return 'process.env.DATABASE_URL || "postgres://user:password@localhost:5432/mydb"';
|
|
1568
1578
|
}
|
|
1569
1579
|
function getFieldLine(key, existingFields, mergeStrategy, defaultValue, userChoices) {
|
|
1570
1580
|
const existing = existingFields.find((f) => f.key === key);
|
|
1571
|
-
const shouldUseExisting = mergeStrategy === "keep-existing" && existing && !existing.isCommented || mergeStrategy === "interactive" && userChoices?.get(key) === "keep";
|
|
1581
|
+
const shouldUseExisting = mergeStrategy === "keep-existing" && existing && !existing.isCommented || mergeStrategy === "interactive" && userChoices?.get(key) === "keep" && existing && !existing.isCommented;
|
|
1572
1582
|
const shouldUseNew = mergeStrategy === "use-defaults" || mergeStrategy === "interactive" && userChoices?.get(key) === "new";
|
|
1573
1583
|
if (shouldUseExisting && existing) {
|
|
1574
1584
|
const value = typeof existing.value === "string" && !existing.value.startsWith('"') ? `"${existing.value}"` : existing.value;
|