ui-syncup 0.3.11 → 0.3.13

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.
Files changed (2) hide show
  1. package/dist/index.js +48 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var require_package = __commonJS({
31
31
  "package.json"(exports2, module2) {
32
32
  module2.exports = {
33
33
  name: "ui-syncup",
34
- version: "0.3.11",
34
+ version: "0.3.13",
35
35
  description: "Self-host UI SyncUp with a single command",
36
36
  bin: {
37
37
  "ui-syncup": "./dist/index.js"
@@ -151,6 +151,22 @@ function isDockerRunning() {
151
151
  return false;
152
152
  }
153
153
  }
154
+ function volumeExists(volumeName) {
155
+ try {
156
+ const result = (0, import_node_child_process.execSync)(`docker volume inspect ${volumeName}`, { stdio: "pipe" });
157
+ return !!result;
158
+ } catch {
159
+ return false;
160
+ }
161
+ }
162
+ function removeVolume(volumeName) {
163
+ try {
164
+ (0, import_node_child_process.execSync)(`docker volume rm ${volumeName}`, { stdio: "pipe" });
165
+ return true;
166
+ } catch {
167
+ return false;
168
+ }
169
+ }
154
170
  function runCompose(composeFile, args, profiles = [], quiet = false) {
155
171
  const profileFlags = profiles.flatMap((p) => ["--profile", p]);
156
172
  const cmd = ["docker", "compose", "-f", composeFile, ...profileFlags, ...args];
@@ -218,6 +234,36 @@ async function initCommand() {
218
234
  });
219
235
  if (dbChoice === "bundled") {
220
236
  profiles.push("db");
237
+ const projectName = process.env["COMPOSE_PROJECT_NAME"] || "ui-syncup";
238
+ const pgVolume = `${projectName}_postgres_data`;
239
+ const volumeAlreadyExists = volumeExists(pgVolume);
240
+ if (volumeAlreadyExists) {
241
+ ui.warn(`Existing PostgreSQL volume detected (${pgVolume}).`);
242
+ ui.warn("The password you enter MUST match the one used when the volume was first created.");
243
+ ui.warn('If you changed the password, choose "Reset" to wipe the volume and start fresh.');
244
+ const resetChoice = await (0, import_prompts.select)({
245
+ message: "How do you want to proceed?",
246
+ choices: [
247
+ { name: "Keep existing volume (enter the original password)", value: "keep" },
248
+ { name: "Reset volume \u2014 wipe all data and reinitialise (irreversible)", value: "reset" }
249
+ ]
250
+ });
251
+ if (resetChoice === "reset") {
252
+ const confirmed = await (0, import_prompts.confirm)({
253
+ message: `Delete volume "${pgVolume}" and all its data? This cannot be undone.`,
254
+ default: false
255
+ });
256
+ if (confirmed) {
257
+ if (!removeVolume(pgVolume)) {
258
+ ui.error(`Failed to remove volume ${pgVolume}. Is the container still running?`);
259
+ process.exit(1);
260
+ }
261
+ ui.success(`Volume ${pgVolume} removed \u2014 will be reinitialised with the new password.`);
262
+ } else {
263
+ ui.info("Reset cancelled \u2014 keeping existing volume. Enter the original password below.");
264
+ }
265
+ }
266
+ }
221
267
  const pgPass = await (0, import_prompts.input)({
222
268
  message: "PostgreSQL password (POSTGRES_PASSWORD, min 8 chars):",
223
269
  validate: (v) => v.length >= 8 || "Minimum 8 characters"
@@ -305,7 +351,7 @@ async function initCommand() {
305
351
  envVars["SMTP_PORT"] = "1025";
306
352
  envVars["SMTP_USER"] = "";
307
353
  envVars["SMTP_PASSWORD"] = "";
308
- envVars["SMTP_FROM_EMAIL"] = "noreply@localhost";
354
+ envVars["SMTP_FROM_EMAIL"] = "noreply@localhost.com";
309
355
  envVars["SMTP_SECURE"] = "false";
310
356
  }
311
357
  envVars["COMPOSE_PROFILES"] = profiles.join(",");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-syncup",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "description": "Self-host UI SyncUp with a single command",
5
5
  "bin": {
6
6
  "ui-syncup": "./dist/index.js"