@catladder/cli 0.0.0-next-5b6e8037 → 0.0.0-next-837b10de

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.
@@ -867,17 +867,19 @@ const escapeSingleQuotes = (value) => value === null || value === void 0 ? void
867
867
  exports.escapeSingleQuotes = escapeSingleQuotes;
868
868
  /**
869
869
  *
870
- * what an absolute nightmare.
871
- * unfortunatly, dotenv has many limitations. You can't escape quotes properly.
872
- *
873
- * In order to be very forgiving, we need to do some magic here:
870
+ * escape env vars for .env files.
871
+ * unfortunatly, the format has many limitations. In order to be very forgiving, we need to do some magic here:
874
872
  *
875
873
  * - when the value contains no newlines, we are fine
876
874
  * - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
877
- * - you can't escape quotes. this is a shitty limitation of dotenv and node
875
+ * - you can't escape quotes. this is a limitation of dotenv and node
878
876
  * - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
879
877
  * - so we need to quote cleverly
880
878
  * - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
879
+ *
880
+ * what an absolute nightmare.
881
+ *
882
+ * - other languages are currently only partially supported, since most .env implementations are slightly different
881
883
  */
882
884
  const escapeForDotEnv = (value) => {
883
885
  if (value === undefined || value === null) {
@@ -892,8 +894,8 @@ const escapeForDotEnv = (value) => {
892
894
  const quote = value.includes(`"`)
893
895
  ? value.includes(`'`)
894
896
  ? value.includes("`")
895
- ? // If all quote types are present, default to no
896
- ""
897
+ ? // If all quote types are present, default to double quotes. This works in dotenv, but not in node.js because of the bug mentioned abouve
898
+ '"'
897
899
  : "`"
898
900
  : "'"
899
901
  : '"';
@@ -935,7 +937,7 @@ const escapeForDotEnvScript = (0, globalScriptFunctions_1.registerGlobalScriptFu
935
937
  input="\${input//$'\\n'/\\\\n}"
936
938
  if [[ "$input" == *\\\\n* ]]; then
937
939
  if [[ "$input" == *\\"* && "$input" == *\\'* && "$input" == *\\\`* ]]; then
938
- printf "%s\\n" "$input"
940
+ printf "\\"%s\\"\\n" "$input" ${ /* fallback to double quotes */""}
939
941
  elif [[ "$input" == *\\"* && "$input" == *\\'* ]]; then
940
942
  printf "\`%s\`\\n" "$input"
941
943
  elif [[ "$input" == *\\"* ]]; then
@@ -1525,59 +1525,6 @@ exports["default"] = async (vorpal) => vorpal
1525
1525
 
1526
1526
  /***/ }),
1527
1527
 
1528
- /***/ 59694:
1529
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1530
-
1531
- "use strict";
1532
-
1533
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1534
- const child_process_promise_1 = __nccwpck_require__(75763);
1535
- const getProjectConfig_1 = __nccwpck_require__(12145);
1536
- const log_1 = __nccwpck_require__(66921);
1537
- const autocompletions_1 = __nccwpck_require__(39855);
1538
- /**
1539
- * Error: rendered manifests contain a resource that already exists.
1540
- * Unable to continue with install: ConfigMap "web-app-env" in namespace "pvl-bike2school-dev" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "pvl-bike2school-dev-web"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "pvl-bike2school-dev"
1541
- */
1542
- exports["default"] = async (vorpal) => vorpal
1543
- .command("project-migrate-helm3 <envComponent>", "Do manual step for helm2 to helm3 migration")
1544
- .autocomplete((await (0, autocompletions_1.envAndComponents)()).filter((e) => !e.startsWith("local") && !e.startsWith("review")))
1545
- .action(async function ({ envComponent }) {
1546
- try {
1547
- const { env, componentName } = (0, getProjectConfig_1.parseChoice)(envComponent);
1548
- const result = await (0, child_process_promise_1.exec)("helm version --short");
1549
- const version = result.stdout;
1550
- this.log(`your helm version: ${version}`);
1551
- if (!version.startsWith("v3")) {
1552
- throw new Error("no helm3");
1553
- }
1554
- try {
1555
- await (0, child_process_promise_1.exec)("helm plugin install https://github.com/helm/helm-2to3.git");
1556
- this.log("successfully installed plugin https://github.com/helm/helm-2to3.git");
1557
- }
1558
- catch (e) {
1559
- // ignore
1560
- }
1561
- // we use the app full name as the release name
1562
- const releaseName = (await (0, getProjectConfig_1.getEnvironment)(env, componentName)).fullName;
1563
- this.log(`helm release name: ${releaseName}`);
1564
- this.log("");
1565
- this.log("migrating now... 😼. This may take a moment");
1566
- this.log("");
1567
- const r = await (0, child_process_promise_1.exec)(`helm 2to3 convert --delete-v2-releases ${releaseName}`);
1568
- this.log(r);
1569
- }
1570
- catch (e) {
1571
- (0, log_1.logError)(this, e.message);
1572
- this.log("make sure that you have installed latest helm3 locally");
1573
- this.log("(e.g. brew upgrade helm)");
1574
- this.log("");
1575
- }
1576
- });
1577
- //# sourceMappingURL=commandMigrateHelm3.js.map
1578
-
1579
- /***/ }),
1580
-
1581
1528
  /***/ 17805:
1582
1529
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1583
1530
 
@@ -1697,77 +1644,6 @@ exports["default"] = async (vorpal) => vorpal
1697
1644
 
1698
1645
  /***/ }),
1699
1646
 
1700
- /***/ 86972:
1701
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
1702
-
1703
- "use strict";
1704
-
1705
- var __importDefault = (this && this.__importDefault) || function (mod) {
1706
- return (mod && mod.__esModule) ? mod : { "default": mod };
1707
- };
1708
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1709
- const open_1 = __importDefault(__nccwpck_require__(14247));
1710
- const portForward_1 = __nccwpck_require__(91597);
1711
- const constants_1 = __nccwpck_require__(78818);
1712
- const projects_1 = __nccwpck_require__(79011);
1713
- const autocompletions_1 = __nccwpck_require__(39855);
1714
- const ensureCluster_1 = __importDefault(__nccwpck_require__(34590));
1715
- exports["default"] = async (vorpal) => vorpal
1716
- .command("project-open-grafana <envComponent>", "open Grafana dashboard for your namespace")
1717
- .autocomplete(await (0, autocompletions_1.envAndComponents)())
1718
- .action(async function ({ envComponent }) {
1719
- await ensureCluster_1.default.call(this, envComponent);
1720
- const namespace = await (0, projects_1.getProjectNamespace)(envComponent);
1721
- const url = `http://localhost:${constants_1.GRAFANA_PROXY_LOCAL_PORT}/grafana/d/at-cost-analysis-namespace2/namespace-utilization-metrics?var-namespace=${namespace}`;
1722
- await (0, portForward_1.startKubePortForward)("deployment/kubecost-cost-analyzer", constants_1.GRAFANA_PROXY_LOCAL_PORT, constants_1.GRAFANA_PROXY_TARGET_PORT, "kubecost");
1723
- (0, open_1.default)(url);
1724
- });
1725
- //# sourceMappingURL=commandOpenGrafana.js.map
1726
-
1727
- /***/ }),
1728
-
1729
- /***/ 8290:
1730
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
1731
-
1732
- "use strict";
1733
-
1734
- var __importDefault = (this && this.__importDefault) || function (mod) {
1735
- return (mod && mod.__esModule) ? mod : { "default": mod };
1736
- };
1737
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1738
- const open_1 = __importDefault(__nccwpck_require__(14247));
1739
- const constants_1 = __nccwpck_require__(78818);
1740
- const kubernetes_1 = __nccwpck_require__(50481);
1741
- const log_1 = __nccwpck_require__(66921);
1742
- const portForward_1 = __nccwpck_require__(91597);
1743
- const projects_1 = __nccwpck_require__(79011);
1744
- const autocompletions_1 = __nccwpck_require__(39855);
1745
- const ensureCluster_1 = __importDefault(__nccwpck_require__(34590));
1746
- exports["default"] = async (vorpal) => vorpal
1747
- .command("project-open-grafana-pod <envComponent>", "open Grafana dashboard for a specific pod")
1748
- .autocomplete(await (0, autocompletions_1.envAndComponents)())
1749
- .action(async function ({ envComponent }) {
1750
- await ensureCluster_1.default.call(this, envComponent);
1751
- const podNames = await (0, kubernetes_1.getProjectPodNames)(envComponent);
1752
- if (podNames.length === 0) {
1753
- (0, log_1.logError)(this, "sorry, no pods found");
1754
- return;
1755
- }
1756
- const { podName } = await this.prompt({
1757
- type: "list",
1758
- name: "podName",
1759
- choices: podNames,
1760
- message: "Which pod? 🤔",
1761
- });
1762
- const namespace = await (0, projects_1.getProjectNamespace)(envComponent);
1763
- const url = `http://localhost:${constants_1.GRAFANA_PROXY_LOCAL_PORT}/grafana/d/at-cost-analysis-pod/pod-cost-and-utilization-metrics?var-namespace=${namespace}&var-pod=${podName}`;
1764
- await (0, portForward_1.startKubePortForward)("deployment/kubecost-cost-analyzer", constants_1.GRAFANA_PROXY_LOCAL_PORT, constants_1.GRAFANA_PROXY_TARGET_PORT, "kubecost");
1765
- (0, open_1.default)(url);
1766
- });
1767
- //# sourceMappingURL=commandOpenGrafanaPod.js.map
1768
-
1769
- /***/ }),
1770
-
1771
1647
  /***/ 81673:
1772
1648
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1773
1649
 
@@ -2083,7 +1959,6 @@ const commandGitlabCi_1 = __importDefault(__nccwpck_require__(21942));
2083
1959
  const commandSetup_1 = __importDefault(__nccwpck_require__(94092));
2084
1960
  const commandRenewToken_1 = __importDefault(__nccwpck_require__(67426));
2085
1961
  const commandListPods_1 = __importDefault(__nccwpck_require__(14180));
2086
- const commandMigrateHelm3_1 = __importDefault(__nccwpck_require__(59694));
2087
1962
  const commandNamespace_1 = __importDefault(__nccwpck_require__(17805));
2088
1963
  const commandOpenCostDashboard_1 = __importDefault(__nccwpck_require__(55481));
2089
1964
  const commandOpenDashboard_1 = __importDefault(__nccwpck_require__(44214));
@@ -2091,10 +1966,8 @@ const commandOpenEnv_1 = __importDefault(__nccwpck_require__(78423));
2091
1966
  const commandOpenGit_1 = __importDefault(__nccwpck_require__(79211));
2092
1967
  const commandOpenLogs_1 = __importDefault(__nccwpck_require__(81673));
2093
1968
  const commandPauseProject_1 = __importDefault(__nccwpck_require__(32563));
2094
- const commandOpenGrafana_1 = __importDefault(__nccwpck_require__(86972));
2095
1969
  const commandPortForward_1 = __importDefault(__nccwpck_require__(49142));
2096
1970
  const commandTriggerCronjob_1 = __importDefault(__nccwpck_require__(96294));
2097
- const commandOpenGrafanaPod_1 = __importDefault(__nccwpck_require__(8290));
2098
1971
  const commandSecretsClearBackups_1 = __importDefault(__nccwpck_require__(40695));
2099
1972
  const commandProjectRestoreDb_1 = __importDefault(__nccwpck_require__(24103));
2100
1973
  const commandSecurityEvaluate_1 = __importDefault(__nccwpck_require__(82620));
@@ -2109,8 +1982,6 @@ exports["default"] = async (vorpal) => {
2109
1982
  (0, commandOpenDashboard_1.default)(vorpal);
2110
1983
  (0, commandOpenLogs_1.default)(vorpal);
2111
1984
  (0, commandOpenCostDashboard_1.default)(vorpal);
2112
- (0, commandOpenGrafana_1.default)(vorpal);
2113
- (0, commandOpenGrafanaPod_1.default)(vorpal);
2114
1985
  (0, commandCloudSqlProxy_1.default)(vorpal);
2115
1986
  (0, commandProjectRestoreDb_1.default)(vorpal);
2116
1987
  (0, commandOpenGit_1.default)(vorpal);
@@ -2123,7 +1994,6 @@ exports["default"] = async (vorpal) => {
2123
1994
  (0, commandPortForward_1.default)(vorpal);
2124
1995
  (0, commandGitlabCi_1.default)(vorpal);
2125
1996
  (0, commandGetMyTotalWorktime_1.default)(vorpal);
2126
- (0, commandMigrateHelm3_1.default)(vorpal);
2127
1997
  (0, commandSecurityEvaluate_1.default)(vorpal);
2128
1998
  };
2129
1999
  //# sourceMappingURL=index.js.map
@@ -4041,17 +3911,19 @@ const escapeSingleQuotes = (value) => value === null || value === void 0 ? void
4041
3911
  exports.escapeSingleQuotes = escapeSingleQuotes;
4042
3912
  /**
4043
3913
  *
4044
- * what an absolute nightmare.
4045
- * unfortunatly, dotenv has many limitations. You can't escape quotes properly.
4046
- *
4047
- * In order to be very forgiving, we need to do some magic here:
3914
+ * escape env vars for .env files.
3915
+ * unfortunatly, the format has many limitations. In order to be very forgiving, we need to do some magic here:
4048
3916
  *
4049
3917
  * - when the value contains no newlines, we are fine
4050
3918
  * - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
4051
- * - you can't escape quotes. this is a shitty limitation of dotenv and node
3919
+ * - you can't escape quotes. this is a limitation of dotenv and node
4052
3920
  * - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
4053
3921
  * - so we need to quote cleverly
4054
3922
  * - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
3923
+ *
3924
+ * what an absolute nightmare.
3925
+ *
3926
+ * - other languages are currently only partially supported, since most .env implementations are slightly different
4055
3927
  */
4056
3928
  const escapeForDotEnv = (value) => {
4057
3929
  if (value === undefined || value === null) {
@@ -4066,8 +3938,8 @@ const escapeForDotEnv = (value) => {
4066
3938
  const quote = value.includes(`"`)
4067
3939
  ? value.includes(`'`)
4068
3940
  ? value.includes("`")
4069
- ? // If all quote types are present, default to no
4070
- ""
3941
+ ? // If all quote types are present, default to double quotes. This works in dotenv, but not in node.js because of the bug mentioned abouve
3942
+ '"'
4071
3943
  : "`"
4072
3944
  : "'"
4073
3945
  : '"';
@@ -4109,7 +3981,7 @@ const escapeForDotEnvScript = (0, globalScriptFunctions_1.registerGlobalScriptFu
4109
3981
  input="\${input//$'\\n'/\\\\n}"
4110
3982
  if [[ "$input" == *\\\\n* ]]; then
4111
3983
  if [[ "$input" == *\\"* && "$input" == *\\'* && "$input" == *\\\`* ]]; then
4112
- printf "%s\\n" "$input"
3984
+ printf "\\"%s\\"\\n" "$input" ${ /* fallback to double quotes */""}
4113
3985
  elif [[ "$input" == *\\"* && "$input" == *\\'* ]]; then
4114
3986
  printf "\`%s\`\\n" "$input"
4115
3987
  elif [[ "$input" == *\\"* ]]; then
@@ -14,7 +14,6 @@ const commandGitlabCi_1 = __importDefault(require("./commandGitlabCi"));
14
14
  const commandSetup_1 = __importDefault(require("./commandSetup"));
15
15
  const commandRenewToken_1 = __importDefault(require("./commandRenewToken"));
16
16
  const commandListPods_1 = __importDefault(require("./commandListPods"));
17
- const commandMigrateHelm3_1 = __importDefault(require("./commandMigrateHelm3"));
18
17
  const commandNamespace_1 = __importDefault(require("./commandNamespace"));
19
18
  const commandOpenCostDashboard_1 = __importDefault(require("./commandOpenCostDashboard"));
20
19
  const commandOpenDashboard_1 = __importDefault(require("./commandOpenDashboard"));
@@ -22,10 +21,8 @@ const commandOpenEnv_1 = __importDefault(require("./commandOpenEnv"));
22
21
  const commandOpenGit_1 = __importDefault(require("./commandOpenGit"));
23
22
  const commandOpenLogs_1 = __importDefault(require("./commandOpenLogs"));
24
23
  const commandPauseProject_1 = __importDefault(require("./commandPauseProject"));
25
- const commandOpenGrafana_1 = __importDefault(require("./commandOpenGrafana"));
26
24
  const commandPortForward_1 = __importDefault(require("./commandPortForward"));
27
25
  const commandTriggerCronjob_1 = __importDefault(require("./commandTriggerCronjob"));
28
- const commandOpenGrafanaPod_1 = __importDefault(require("./commandOpenGrafanaPod"));
29
26
  const commandSecretsClearBackups_1 = __importDefault(require("./commandSecretsClearBackups"));
30
27
  const commandProjectRestoreDb_1 = __importDefault(require("./cloudSql/commandProjectRestoreDb"));
31
28
  const commandSecurityEvaluate_1 = __importDefault(require("./commandSecurityEvaluate"));
@@ -40,8 +37,6 @@ exports.default = async (vorpal) => {
40
37
  (0, commandOpenDashboard_1.default)(vorpal);
41
38
  (0, commandOpenLogs_1.default)(vorpal);
42
39
  (0, commandOpenCostDashboard_1.default)(vorpal);
43
- (0, commandOpenGrafana_1.default)(vorpal);
44
- (0, commandOpenGrafanaPod_1.default)(vorpal);
45
40
  (0, commandCloudSqlProxy_1.default)(vorpal);
46
41
  (0, commandProjectRestoreDb_1.default)(vorpal);
47
42
  (0, commandOpenGit_1.default)(vorpal);
@@ -54,7 +49,6 @@ exports.default = async (vorpal) => {
54
49
  (0, commandPortForward_1.default)(vorpal);
55
50
  (0, commandGitlabCi_1.default)(vorpal);
56
51
  (0, commandGetMyTotalWorktime_1.default)(vorpal);
57
- (0, commandMigrateHelm3_1.default)(vorpal);
58
52
  (0, commandSecurityEvaluate_1.default)(vorpal);
59
53
  };
60
54
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/apps/cli/commands/project/index.ts"],"names":[],"mappings":";;;;;AACA,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IAC7B,IAAA,oCAA0B,EAAC,MAAM,CAAC,CAAC;IACnC,IAAA,2BAAiB,EAAC,MAAM,CAAC,CAAC;IAE1B,IAAA,yBAAe,EAAC,MAAM,CAAC,CAAC;IACxB,IAAA,4BAAkB,EAAC,MAAM,CAAC,CAAC;IAE3B,IAAA,yBAAe,EAAC,MAAM,CAAC,CAAC;IAExB,IAAA,mCAAyB,EAAC,MAAM,CAAC,CAAC;IAClC,IAAA,6BAAmB,EAAC,MAAM,CAAC,CAAC;IAC5B,IAAA,iCAAuB,EAAC,MAAM,CAAC,CAAC;AAClC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/apps/cli/commands/project/index.ts"],"names":[],"mappings":";;;;;AACA,kFAA0D;AAC1D,kFAA0D;AAE1D,4EAAoD;AACpD,kFAA0D;AAC1D,sEAA8C;AAC9C,4FAAoE;AACpE,wEAAgD;AAChD,wEAAgD;AAChD,kEAA0C;AAC1C,4EAAoD;AACpD,wEAAgD;AAChD,0EAAkD;AAClD,0FAAkE;AAClE,kFAA0D;AAC1D,sEAA8C;AAC9C,sEAA8C;AAC9C,wEAAgD;AAChD,gFAAwD;AACxD,8EAAsD;AACtD,oFAA4D;AAC5D,8FAAsE;AACtE,iGAAyE;AACzE,wFAAgE;AAEhE,kBAAe,KAAK,EAAE,MAAc,EAAE,EAAE;IACtC,IAAA,sBAAY,EAAC,MAAM,CAAC,CAAC;IACrB,IAAA,2BAAiB,EAAC,MAAM,CAAC,CAAC;IAE1B,IAAA,wBAAc,EAAC,MAAM,CAAC,CAAC;IAEvB,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAC;IACzB,IAAA,yBAAe,EAAC,MAAM,CAAC,CAAC;IACxB,IAAA,6BAAmB,EAAC,MAAM,CAAC,CAAC;IAC5B,IAAA,8BAAoB,EAAC,MAAM,CAAC,CAAC;IAE7B,IAAA,8BAAoB,EAAC,MAAM,CAAC,CAAC;IAE7B,IAAA,yBAAe,EAAC,MAAM,CAAC,CAAC;IAExB,IAAA,kCAAwB,EAAC,MAAM,CAAC,CAAC;IAEjC,IAAA,8BAAoB,EAAC,MAAM,CAAC,CAAC;IAC7B,IAAA,iCAAuB,EAAC,MAAM,CAAC,CAAC;IAChC,IAAA,wBAAc,EAAC,MAAM,CAAC,CAAC;IACvB,IAAA,wBAAc,EAAC,MAAM,CAAC,CAAC;IACvB,IAAA,+BAAqB,EAAC,MAAM,CAAC,CAAC;IAC9B,IAAA,8BAAoB,EAAC,MAAM,CAAC,CAAC;IAC7B,IAAA,oCAA0B,EAAC,MAAM,CAAC,CAAC;IACnC,IAAA,2BAAiB,EAAC,MAAM,CAAC,CAAC;IAE1B,IAAA,yBAAe,EAAC,MAAM,CAAC,CAAC;IACxB,IAAA,4BAAkB,EAAC,MAAM,CAAC,CAAC;IAE3B,IAAA,yBAAe,EAAC,MAAM,CAAC,CAAC;IAExB,IAAA,mCAAyB,EAAC,MAAM,CAAC,CAAC;IAElC,IAAA,iCAAuB,EAAC,MAAM,CAAC,CAAC;AAClC,CAAC,CAAC"}
@@ -15,16 +15,18 @@ export declare const escapeDoubleQuotes: (value: string | null | undefined) => s
15
15
  export declare const escapeSingleQuotes: (value: string | null | undefined) => string;
16
16
  /**
17
17
  *
18
- * what an absolute nightmare.
19
- * unfortunatly, dotenv has many limitations. You can't escape quotes properly.
20
- *
21
- * In order to be very forgiving, we need to do some magic here:
18
+ * escape env vars for .env files.
19
+ * unfortunatly, the format has many limitations. In order to be very forgiving, we need to do some magic here:
22
20
  *
23
21
  * - when the value contains no newlines, we are fine
24
22
  * - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
25
- * - you can't escape quotes. this is a shitty limitation of dotenv and node
23
+ * - you can't escape quotes. this is a limitation of dotenv and node
26
24
  * - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
27
25
  * - so we need to quote cleverly
28
26
  * - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
27
+ *
28
+ * what an absolute nightmare.
29
+ *
30
+ * - other languages are currently only partially supported, since most .env implementations are slightly different
29
31
  */
30
32
  export declare const escapeForDotEnv: (value: VariableValue | undefined | null) => string;
@@ -43,17 +43,19 @@ const escapeSingleQuotes = (value) => value === null || value === void 0 ? void
43
43
  exports.escapeSingleQuotes = escapeSingleQuotes;
44
44
  /**
45
45
  *
46
- * what an absolute nightmare.
47
- * unfortunatly, dotenv has many limitations. You can't escape quotes properly.
48
- *
49
- * In order to be very forgiving, we need to do some magic here:
46
+ * escape env vars for .env files.
47
+ * unfortunatly, the format has many limitations. In order to be very forgiving, we need to do some magic here:
50
48
  *
51
49
  * - when the value contains no newlines, we are fine
52
50
  * - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
53
- * - you can't escape quotes. this is a shitty limitation of dotenv and node
51
+ * - you can't escape quotes. this is a limitation of dotenv and node
54
52
  * - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
55
53
  * - so we need to quote cleverly
56
54
  * - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
55
+ *
56
+ * what an absolute nightmare.
57
+ *
58
+ * - other languages are currently only partially supported, since most .env implementations are slightly different
57
59
  */
58
60
  const escapeForDotEnv = (value) => {
59
61
  if (value === undefined || value === null) {
@@ -68,8 +70,8 @@ const escapeForDotEnv = (value) => {
68
70
  const quote = value.includes(`"`)
69
71
  ? value.includes(`'`)
70
72
  ? value.includes("`")
71
- ? // If all quote types are present, default to no
72
- ""
73
+ ? // If all quote types are present, default to double quotes. This works in dotenv, but not in node.js because of the bug mentioned abouve
74
+ '"'
73
75
  : "`"
74
76
  : "'"
75
77
  : '"';
@@ -111,7 +113,7 @@ const escapeForDotEnvScript = (0, globalScriptFunctions_1.registerGlobalScriptFu
111
113
  input="\${input//$'\\n'/\\\\n}"
112
114
  if [[ "$input" == *\\\\n* ]]; then
113
115
  if [[ "$input" == *\\"* && "$input" == *\\'* && "$input" == *\\\`* ]]; then
114
- printf "%s\\n" "$input"
116
+ printf "\\"%s\\"\\n" "$input" ${ /* fallback to double quotes */""}
115
117
  elif [[ "$input" == *\\"* && "$input" == *\\'* ]]; then
116
118
  printf "\`%s\`\\n" "$input"
117
119
  elif [[ "$input" == *\\"* ]]; then
@@ -1 +1 @@
1
- {"version":3,"file":"bashEscape.js","sourceRoot":"","sources":["../../../../../pipeline/src/bash/bashEscape.ts"],"names":[],"mappings":";;;AAAA,oEAAwE;AAExE,sGAAmG;AACnG,qDAAkD;AAOlD;;;GAGG;AACI,MAAM,UAAU,GAAG,CACxB,KAA0B,EAC1B,UAAyB;IACvB,MAAM,EAAE,QAAQ;CACjB,EACD,EAAE;IACF,IAAI,KAAK,YAAY,+BAAc,EAAE,CAAC;QACpC,oBAAoB;QACpB,OAAO,IAAA,4BAAoB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI,KAAK,YAAY,qEAAiC,EAAE,CAAC;QACvD,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,IAAA,oBAAY,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC,CAAC;AAdW,QAAA,UAAU,cAcrB;AAEK,MAAM,YAAY,GAAG,CAC1B,KAAgC,EAChC,EAAE,MAAM,KAAoB;IAC1B,MAAM,EAAE,QAAQ;CACjB,EACD,EAAE;IACF,MAAM,YAAY,GAAG,MAAM;QACzB,CAAC,CAAC,MAAM,KAAK,QAAQ;YACnB,CAAC,CAAC,IAAA,0BAAkB,EAAC,KAAK,CAAC;YAC3B,CAAC,CAAC,IAAA,0BAAkB,EAAC,KAAK,CAAC;QAC7B,CAAC,CAAC,KAAK,CAAC;IAEV,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAbW,QAAA,YAAY,gBAavB;AAEK,MAAM,oBAAoB,GAAG,CAClC,KAAqB,EACrB,OAAsB,EACtB,EAAE;IACF,+C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