@oxog/dockcraft 1.1.1 → 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
@@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
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
+
24
+ ## [1.2.0] - 2026-12-02
25
+
26
+ ### Changed
27
+ - `"sideEffects": false` is declared, so bundlers can drop unused exports. Importing
28
+ the library has no side effects (the CLI is a separate `bin` file).
29
+
30
+ ### Internal
31
+ - Tooling: adopted oxog-standard. Lint is ESLint 10 with typescript-eslint
32
+ recommended-type-checked; managed CI (Node 18 to 26) and Trusted Publishing release
33
+ workflow; packed-archive checks with publint and Are The Types Wrong.
34
+
8
35
  ## [1.1.1] - 2026-12-01
9
36
 
10
37
  ### Fixed
@@ -215,6 +242,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
215
242
 
216
243
  ---
217
244
 
245
+ [1.2.1]: https://github.com/ersinkoc/DockCraft/releases/tag/v1.2.1
246
+ [1.2.0]: https://github.com/ersinkoc/DockCraft/releases/tag/v1.2.0
218
247
  [1.1.1]: https://github.com/ersinkoc/DockCraft/releases/tag/v1.1.1
219
248
  [1.1.0]: https://github.com/ersinkoc/DockCraft/releases/tag/v1.1.0
220
249
  [1.0.0]: https://github.com/ersinkoc/DockCraft/releases/tag/v1.0.0
package/dist/cli/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  // src/version.ts
9
- var VERSION = "1.1.1";
9
+ var VERSION = "1.2.1";
10
10
 
11
11
  // src/cli/parser.ts
12
12
  function parseArgs(args) {
@@ -673,7 +673,7 @@ async function init(args) {
673
673
  const name = getOption(args, "name") || await ask("Project name", defaultProjectName(process.cwd()));
674
674
  if (!isProjectName(name)) {
675
675
  throw new Error(
676
- `Invalid project name '${name}'. Must start with a letter and contain only letters, numbers, hyphens, and underscores.`
676
+ `Invalid project name '${String(name)}'. Must start with a letter and contain only letters, numbers, hyphens, and underscores.`
677
677
  );
678
678
  }
679
679
  const preset = getOption(args, "preset");
@@ -952,6 +952,7 @@ async function resolvePort(options = {}) {
952
952
  return preferred;
953
953
  }
954
954
  throw new PortConflictError(preferred);
955
+ // @ts-expect-error -- TS7029: the fall-through to 'auto' (no range given) is intended
955
956
  case "range":
956
957
  if (range) {
957
958
  const [start, end = start + 100] = range;
@@ -1324,8 +1325,8 @@ function validateServiceConfig(name, config) {
1324
1325
  if (!isComposeServiceName(name)) {
1325
1326
  errors.push({
1326
1327
  code: "INVALID_SERVICE_NAME",
1327
- message: `Invalid service name '${name}'. Must start with a letter or digit and contain only letters, digits, '.', '_' and '-'.`,
1328
- path: `services.${name}`,
1328
+ message: `Invalid service name '${String(name)}'. Must start with a letter or digit and contain only letters, digits, '.', '_' and '-'.`,
1329
+ path: `services.${String(name)}`,
1329
1330
  value: name
1330
1331
  });
1331
1332
  }
@@ -1342,6 +1343,7 @@ function validateServiceConfig(name, config) {
1342
1343
  if (svc.version !== void 0 && !isVersion(svc.version)) {
1343
1344
  errors.push({
1344
1345
  code: "INVALID_VERSION",
1346
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string -- echoes whatever invalid value was given
1345
1347
  message: `Invalid version '${String(svc.version)}' for service '${name}'. Must be a valid Docker image tag.`,
1346
1348
  path: `services.${name}.version`,
1347
1349
  value: svc.version
@@ -1350,6 +1352,7 @@ function validateServiceConfig(name, config) {
1350
1352
  if (svc.image !== void 0 && !isDockerImage(svc.image)) {
1351
1353
  errors.push({
1352
1354
  code: "INVALID_IMAGE",
1355
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string -- echoes whatever invalid value was given
1353
1356
  message: `Invalid image '${String(svc.image)}' for service '${name}'. Must be a Docker image reference such as 'elasticsearch:8.11.0'.`,
1354
1357
  path: `services.${name}.image`,
1355
1358
  value: svc.image
@@ -1469,9 +1472,47 @@ function nodeHealthcheckScript(port, path) {
1469
1472
  }
1470
1473
 
1471
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
+ ]);
1472
1511
  function dockerCmd(command) {
1473
1512
  const words = command.trim().split(/\s+/);
1474
- 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))) {
1475
1516
  return `CMD ${JSON.stringify(words).replace(/","/g, '", "')}`;
1476
1517
  }
1477
1518
  return `CMD ${command.trim()}`;
@@ -1918,7 +1959,7 @@ function envValue(value) {
1918
1959
  if (!/['\r\n]/.test(value)) {
1919
1960
  return `'${value}'`;
1920
1961
  }
1921
- 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");
1922
1963
  return `"${escaped}"`;
1923
1964
  }
1924
1965
  function generateEnvExample(config) {