pgflow 0.0.22 → 0.1.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-config-toml.d.ts","sourceRoot":"","sources":["../../../src/commands/install/update-config-toml.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,YAAY,GACb,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"update-config-toml.d.ts","sourceRoot":"","sources":["../../../src/commands/install/update-config-toml.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,YAAY,GACb,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,OAAO,CAAC,CAwHnB"}
|
|
@@ -75,9 +75,30 @@ ${chalk.green('+ policy = "per_worker"')}`);
|
|
|
75
75
|
updatedConfig.db.pooler.enabled = true;
|
|
76
76
|
updatedConfig.db.pooler.pool_mode = 'transaction';
|
|
77
77
|
updatedConfig.edge_runtime.policy = 'per_worker';
|
|
78
|
-
|
|
78
|
+
// Apply TOML patch
|
|
79
|
+
let updatedContent = TOML.patch(configContent, updatedConfig, {
|
|
79
80
|
trailingComma: false,
|
|
80
81
|
});
|
|
82
|
+
// Post-process to remove trailing commas from specific updated lines
|
|
83
|
+
// The toml-patch library sometimes adds unwanted trailing commas despite the trailingComma: false option.
|
|
84
|
+
// For example, it might transform:
|
|
85
|
+
// [db.pooler]
|
|
86
|
+
// enabled = false
|
|
87
|
+
// into:
|
|
88
|
+
// [db.pooler]
|
|
89
|
+
// enabled = true, # <-- unwanted trailing comma
|
|
90
|
+
//
|
|
91
|
+
// These regex replacements target only the specific lines we're updating and remove any trailing commas
|
|
92
|
+
// while preserving any whitespace, comments, or newlines that follow.
|
|
93
|
+
updatedContent = updatedContent
|
|
94
|
+
// Fix db.pooler.enabled line - transforms "enabled = true," into "enabled = true"
|
|
95
|
+
.replace(/enabled = true,(\s*$|\s*#|\s*\n)/g, 'enabled = true$1')
|
|
96
|
+
.replace(
|
|
97
|
+
// Fix db.pooler.pool_mode line - transforms "pool_mode = "transaction"," into "pool_mode = "transaction""
|
|
98
|
+
/pool_mode = "transaction",(\s*$|\s*#|\s*\n)/g, 'pool_mode = "transaction"$1')
|
|
99
|
+
.replace(
|
|
100
|
+
// Fix edge_runtime.policy line - transforms "policy = "per_worker"," into "policy = "per_worker""
|
|
101
|
+
/policy = "per_worker",(\s*$|\s*#|\s*\n)/g, 'policy = "per_worker"$1');
|
|
81
102
|
fs.writeFileSync(configPath, updatedContent);
|
|
82
103
|
log.success(`Successfully updated ${configPath} (backup created at ${backupPath})`);
|
|
83
104
|
return true;
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgflow",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"chalk": "^5.4.1",
|
|
25
25
|
"commander": "^13.1.0",
|
|
26
26
|
"toml-patch": "^0.2.3",
|
|
27
|
-
"@pgflow/core": "0.0
|
|
27
|
+
"@pgflow/core": "0.1.0"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public",
|