@oxog/dockcraft 1.2.0 → 1.2.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.1] - 2026-12-02
11
+
12
+ ### Fixed
13
+
14
+ - **`app.command` with a `VAR=value` prefix or a shell builtin produced a CMD
15
+ that could not start.** `NODE_OPTIONS=--max-old-space-size=4096 node dist/index.js`,
16
+ `exec node server.js` or `cd dist ...` were written in exec (JSON) form, where
17
+ Docker runs the first word as a program and no shell is involved. Such commands
18
+ now use the shell form; plain commands keep the exec form.
19
+ - **`.env.example` values containing a single quote and a `$` were interpolated by
20
+ Compose.** They are double-quoted, and `$` was not escaped, so a password such as
21
+ `it's$ecret` was read as `it's` plus the (empty) variable `ecret`. `$` is now
22
+ written as `\$` inside double quotes.
23
+
10
24
  ## [1.2.0] - 2026-12-02
11
25
 
12
26
  ### Changed
@@ -228,6 +242,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
228
242
 
229
243
  ---
230
244
 
245
+ [1.2.1]: https://github.com/ersinkoc/DockCraft/releases/tag/v1.2.1
231
246
  [1.2.0]: https://github.com/ersinkoc/DockCraft/releases/tag/v1.2.0
232
247
  [1.1.1]: https://github.com/ersinkoc/DockCraft/releases/tag/v1.1.1
233
248
  [1.1.0]: https://github.com/ersinkoc/DockCraft/releases/tag/v1.1.0
package/dist/cli/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  // src/version.ts
9
- var VERSION = "1.2.0";
9
+ var VERSION = "1.2.1";
10
10
 
11
11
  // src/cli/parser.ts
12
12
  function parseArgs(args) {
@@ -1472,9 +1472,47 @@ function nodeHealthcheckScript(port, path) {
1472
1472
  }
1473
1473
 
1474
1474
  // src/generators/dockerfile.ts
1475
+ var SHELL_BUILTINS = /* @__PURE__ */ new Set([
1476
+ ".",
1477
+ ":",
1478
+ "!",
1479
+ "alias",
1480
+ "bg",
1481
+ "break",
1482
+ "case",
1483
+ "cd",
1484
+ "command",
1485
+ "continue",
1486
+ "eval",
1487
+ "exec",
1488
+ "exit",
1489
+ "export",
1490
+ "fg",
1491
+ "for",
1492
+ "if",
1493
+ "jobs",
1494
+ "read",
1495
+ "readonly",
1496
+ "return",
1497
+ "set",
1498
+ "shift",
1499
+ "source",
1500
+ "time",
1501
+ "times",
1502
+ "trap",
1503
+ "ulimit",
1504
+ "umask",
1505
+ "unalias",
1506
+ "unset",
1507
+ "until",
1508
+ "wait",
1509
+ "while"
1510
+ ]);
1475
1511
  function dockerCmd(command) {
1476
1512
  const words = command.trim().split(/\s+/);
1477
- if (words.every((word) => /^[\w@%+=:,./-]+$/.test(word))) {
1513
+ const first = words[0] ?? "";
1514
+ const needsShell = SHELL_BUILTINS.has(first) || /^[A-Za-z_]\w*=/.test(first);
1515
+ if (!needsShell && words.every((word) => /^[\w@%+=:,./-]+$/.test(word))) {
1478
1516
  return `CMD ${JSON.stringify(words).replace(/","/g, '", "')}`;
1479
1517
  }
1480
1518
  return `CMD ${command.trim()}`;
@@ -1921,7 +1959,7 @@ function envValue(value) {
1921
1959
  if (!/['\r\n]/.test(value)) {
1922
1960
  return `'${value}'`;
1923
1961
  }
1924
- const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r");
1962
+ const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\$/g, "\\$").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
1925
1963
  return `"${escaped}"`;
1926
1964
  }
1927
1965
  function generateEnvExample(config) {