@oxog/dockcraft 1.2.0 → 1.3.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.
- package/CHANGELOG.md +34 -0
- package/README.md +10 -0
- package/dist/cli/index.js +97 -22
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +40 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1035,9 +1035,47 @@ function nodeHealthcheckScript(port, path) {
|
|
|
1035
1035
|
}
|
|
1036
1036
|
|
|
1037
1037
|
// src/generators/dockerfile.ts
|
|
1038
|
+
var SHELL_BUILTINS = /* @__PURE__ */ new Set([
|
|
1039
|
+
".",
|
|
1040
|
+
":",
|
|
1041
|
+
"!",
|
|
1042
|
+
"alias",
|
|
1043
|
+
"bg",
|
|
1044
|
+
"break",
|
|
1045
|
+
"case",
|
|
1046
|
+
"cd",
|
|
1047
|
+
"command",
|
|
1048
|
+
"continue",
|
|
1049
|
+
"eval",
|
|
1050
|
+
"exec",
|
|
1051
|
+
"exit",
|
|
1052
|
+
"export",
|
|
1053
|
+
"fg",
|
|
1054
|
+
"for",
|
|
1055
|
+
"if",
|
|
1056
|
+
"jobs",
|
|
1057
|
+
"read",
|
|
1058
|
+
"readonly",
|
|
1059
|
+
"return",
|
|
1060
|
+
"set",
|
|
1061
|
+
"shift",
|
|
1062
|
+
"source",
|
|
1063
|
+
"time",
|
|
1064
|
+
"times",
|
|
1065
|
+
"trap",
|
|
1066
|
+
"ulimit",
|
|
1067
|
+
"umask",
|
|
1068
|
+
"unalias",
|
|
1069
|
+
"unset",
|
|
1070
|
+
"until",
|
|
1071
|
+
"wait",
|
|
1072
|
+
"while"
|
|
1073
|
+
]);
|
|
1038
1074
|
function dockerCmd(command) {
|
|
1039
1075
|
const words = command.trim().split(/\s+/);
|
|
1040
|
-
|
|
1076
|
+
const first = words[0] ?? "";
|
|
1077
|
+
const needsShell = SHELL_BUILTINS.has(first) || /^[A-Za-z_]\w*=/.test(first);
|
|
1078
|
+
if (!needsShell && words.every((word) => /^[\w@%+=:,./-]+$/.test(word))) {
|
|
1041
1079
|
return `CMD ${JSON.stringify(words).replace(/","/g, '", "')}`;
|
|
1042
1080
|
}
|
|
1043
1081
|
return `CMD ${command.trim()}`;
|
|
@@ -1484,7 +1522,7 @@ function envValue(value) {
|
|
|
1484
1522
|
if (!/['\r\n]/.test(value)) {
|
|
1485
1523
|
return `'${value}'`;
|
|
1486
1524
|
}
|
|
1487
|
-
const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
|
1525
|
+
const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\$/g, "\\$").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
|
1488
1526
|
return `"${escaped}"`;
|
|
1489
1527
|
}
|
|
1490
1528
|
function generateEnvExample(config) {
|