sim-setup 1.0.64-preview.340.1 → 1.0.64-preview.342.1

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 (3) hide show
  1. package/README.md +10 -5
  2. package/dist/index.js +13 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -17,7 +17,7 @@ other resources in a running Sim workspace, use the separate
17
17
 
18
18
  - Node.js 20 or newer
19
19
  - Docker with the Compose plugin
20
- - Ports `3000`, `3002`, and, by default, `5432` available
20
+ - Ports `3000` and `3002` available
21
21
  - At least 12 GB of system memory and 20 GB of free disk for a small installation
22
22
 
23
23
  Allocate at least 8 GB of memory to Docker for reliable workflow execution.
@@ -126,7 +126,7 @@ specific installation.
126
126
  | `npx sim-setup restart` | Restart the current containers |
127
127
  | `npx sim-setup update` | Refresh the managed Compose file, pull images, recreate services, and run migrations |
128
128
  | `npx sim-setup down` | Remove containers but keep data volumes |
129
- | `npx sim-setup reset` | Archive `.env`, remove containers, and delete managed data volumes |
129
+ | `npx sim-setup reset` | Remove containers and delete managed data volumes, then archive `.env` |
130
130
 
131
131
  `down` and `reset` are deliberately different. Use `down` when you want to
132
132
  remove containers and bring the same installation back later. `reset` is a
@@ -225,9 +225,9 @@ PostgreSQL data lives in a Docker volume. These commands preserve it:
225
225
  - `update`
226
226
  - `down`
227
227
 
228
- `reset` deletes managed volumes. It archives `.env` beside the installation
229
- before doing so, but that local archive is not a substitute for an off-machine
230
- backup.
228
+ `reset` deletes managed volumes first, then archives `.env` beside the
229
+ installation. If Docker is not running, `reset` stops without changing anything.
230
+ The local archive is not a substitute for an off-machine backup.
231
231
 
232
232
  The default local file-storage fallback is different: uploaded files live inside
233
233
  the application container, not in a managed volume. They can be lost when the
@@ -267,6 +267,11 @@ bun run sim-setup --mode k8s
267
267
  Standalone npm use supports Docker Compose mode only. Development and Kubernetes
268
268
  modes need source-only files and are rejected outside a complete checkout.
269
269
 
270
+ Dev mode publishes the managed Postgres and Redis containers on `127.0.0.1`
271
+ only. Containers created by an earlier version publish on every network
272
+ interface; run `bun run sim-setup down` and then re-run setup to rebind them.
273
+ Your data is kept.
274
+
270
275
  ## Help
271
276
 
272
277
  ```bash
package/dist/index.js CHANGED
@@ -3411,7 +3411,8 @@ function parseValue(raw) {
3411
3411
  if (trimmed.startsWith('"') || trimmed.startsWith("'")) {
3412
3412
  const quote = trimmed[0];
3413
3413
  const end = trimmed.indexOf(quote, 1);
3414
- return end === -1 ? trimmed.slice(1) : trimmed.slice(1, end);
3414
+ const inner = end === -1 ? trimmed.slice(1) : trimmed.slice(1, end);
3415
+ return quote === '"' ? inner.replaceAll("\\$", "$") : inner;
3415
3416
  }
3416
3417
  return trimmed.replace(/\s+#.*$/, "").trim();
3417
3418
  }
@@ -3435,11 +3436,17 @@ function formatEnvValue(key, value) {
3435
3436
  if (/[\r\n]/.test(value)) {
3436
3437
  throw new Error(`${key} cannot be written to an environment file: it contains a line break`);
3437
3438
  }
3439
+ if (value.includes("$")) {
3440
+ if (/["\\`]/.test(value)) {
3441
+ throw new Error(`${key} cannot be written to an environment file: it mixes $ with a double quote, backslash, or backtick`);
3442
+ }
3443
+ return `"${value.replaceAll("$", "\\$")}"`;
3444
+ }
3438
3445
  if (value === value.trim() && !value.includes("#") && !/^["'`]/.test(value))
3439
3446
  return value;
3440
3447
  if (!value.includes("'"))
3441
3448
  return `'${value}'`;
3442
- if (!/["\\$`]/.test(value))
3449
+ if (!/["\\`]/.test(value))
3443
3450
  return `"${value}"`;
3444
3451
  throw new Error(`${key} cannot be written to an environment file: it mixes quotes with a # or edge whitespace`);
3445
3452
  }
@@ -12577,6 +12584,9 @@ async function down(install) {
12577
12584
  }
12578
12585
  async function reset2(install) {
12579
12586
  const target = install ? ` ${describeInstall(install)} will be removed.` : "";
12587
+ if (install?.kind !== "k8s" && executableExists("docker") && !dockerReachable()) {
12588
+ throw new SetupError("Docker isn't reachable, so the managed containers and volumes can't be removed. Your env files were left in place.", [`start Docker, then re-run ${theme.command("npx sim-setup reset")}`]);
12589
+ }
12580
12590
  const ok = await confirm2({
12581
12591
  message: theme.error(`Reset archives your .env files and wipes managed data (volumes).${target} Continue?`),
12582
12592
  initialValue: false
@@ -12696,6 +12706,7 @@ var init_lifecycle = __esm(() => {
12696
12706
  init_detect();
12697
12707
  init_env_files();
12698
12708
  init_errors2();
12709
+ init_executables();
12699
12710
  init_k8s();
12700
12711
  init_probes();
12701
12712
  init_prompter();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim-setup",
3
- "version": "1.0.64-preview.340.1",
3
+ "version": "1.0.64-preview.342.1",
4
4
  "description": "Set up and manage a self-hosted Sim installation",
5
5
  "type": "module",
6
6
  "bin": {