@catladder/cli 0.0.0-refactor-resolve-references-next-de1019aa → 0.0.0-refactor-resolve-references-next-9ba75040
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/dist/bundles/catenv/index.js +113 -20
- package/dist/bundles/cli/index.js +111 -16
- package/dist/cli/src/apps/catenv/printVariables.js.map +1 -1
- package/dist/cli/src/apps/catenv/types.d.ts +0 -2
- package/dist/cli/src/apps/catenv/utils.d.ts +2 -2
- package/dist/cli/src/apps/catenv/utils.js +2 -3
- package/dist/cli/src/apps/catenv/utils.js.map +1 -1
- package/dist/cli/src/apps/catenv/writeDotEnvFiles.js +0 -1
- package/dist/cli/src/apps/catenv/writeDotEnvFiles.js.map +1 -1
- package/dist/cli/src/config/getProjectConfig.d.ts +3 -3
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/pipeline/src/bash/bashEscape.d.ts +24 -3
- package/dist/pipeline/src/bash/bashEscape.js +96 -11
- package/dist/pipeline/src/bash/bashEscape.js.map +1 -1
- package/dist/pipeline/src/bash/getInjectVarsScript.js +5 -1
- package/dist/pipeline/src/bash/getInjectVarsScript.js.map +1 -1
- package/dist/pipeline/src/build/base/writeDotEnv.js +1 -2
- package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
- package/dist/pipeline/src/variables/VariableValueContainingReferences.d.ts +3 -5
- package/dist/pipeline/src/variables/VariableValueContainingReferences.js +9 -2
- package/dist/pipeline/src/variables/VariableValueContainingReferences.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/catenv/printVariables.ts +2 -2
- package/src/apps/catenv/types.ts +0 -2
- package/src/apps/catenv/utils.ts +8 -7
- package/src/apps/catenv/writeDotEnvFiles.ts +0 -1
- package/src/config/getProjectConfig.ts +1 -1
|
@@ -113,9 +113,8 @@ const getCurrentComponentAndEnvFromChoice = async (config, choice) => {
|
|
|
113
113
|
};
|
|
114
114
|
exports.getCurrentComponentAndEnvFromChoice = getCurrentComponentAndEnvFromChoice;
|
|
115
115
|
const makeKeyValueString = (variables, keyPrefix = "") => Object.entries(variables)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
([key, value]) => `${keyPrefix}${key}='${(0, pipeline_1.bashEscape)(value, "single")}'`)
|
|
116
|
+
// quotes are important, otherwise line breaks don't work properly
|
|
117
|
+
.map(([key, value]) => `${keyPrefix}${key}=${(0, pipeline_1.escapeForDotEnv)(value)}`)
|
|
119
118
|
.join("\n");
|
|
120
119
|
exports.makeKeyValueString = makeKeyValueString;
|
|
121
120
|
const sanitizeEnvVarName = (name) => name.replace(/[\s\-.]+/g, "_");
|
|
@@ -152,7 +151,6 @@ const writeDotEnvFiles = async (config, choice) => {
|
|
|
152
151
|
delete variables["_ALL_ENV_VAR_KEYS"];
|
|
153
152
|
const componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
|
|
154
153
|
const filePath = (0, path_1.join)(componentDir, ".env");
|
|
155
|
-
// many .dotenv don't like multiline values, so we sanitize them here
|
|
156
154
|
await (0, pipeline_1.writeGeneratedFile)(filePath, (0, utils_1.makeKeyValueString)(variables), {
|
|
157
155
|
commentChar: "#",
|
|
158
156
|
});
|
|
@@ -827,35 +825,120 @@ exports.joinBashExpressions = joinBashExpressions;
|
|
|
827
825
|
"use strict";
|
|
828
826
|
|
|
829
827
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
830
|
-
exports.escapeSingleQuotes = exports.escapeDoubleQuotes = exports.escapeString = exports.bashEscape = void 0;
|
|
828
|
+
exports.escapeForDotEnv = exports.escapeBashExpression = exports.escapeSingleQuotes = exports.escapeDoubleQuotes = exports.escapeString = exports.bashEscape = void 0;
|
|
831
829
|
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
832
830
|
const BashExpression_1 = __nccwpck_require__(2376);
|
|
833
831
|
/**
|
|
834
832
|
* escapes a string or bash expression for bash
|
|
835
833
|
* it either can escape single or double quotes (double is default)
|
|
836
834
|
*/
|
|
837
|
-
const bashEscape = (value,
|
|
835
|
+
const bashEscape = (value, options = {
|
|
836
|
+
quotes: false,
|
|
837
|
+
newlines: false,
|
|
838
|
+
}) => {
|
|
838
839
|
if (value instanceof BashExpression_1.BashExpression) {
|
|
839
|
-
return
|
|
840
|
+
return (0, exports.escapeBashExpression)(value, options);
|
|
840
841
|
}
|
|
841
842
|
if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
|
|
842
|
-
return value.toString(
|
|
843
|
-
escape: mode,
|
|
844
|
-
});
|
|
843
|
+
return value.toString(options);
|
|
845
844
|
}
|
|
846
|
-
return (0, exports.escapeString)(value,
|
|
845
|
+
return (0, exports.escapeString)(value, options);
|
|
847
846
|
};
|
|
848
847
|
exports.bashEscape = bashEscape;
|
|
849
|
-
const escapeString = (value,
|
|
850
|
-
|
|
851
|
-
?
|
|
852
|
-
|
|
848
|
+
const escapeString = (value, { quotes, newlines }) => {
|
|
849
|
+
const quoteEscaped = quotes
|
|
850
|
+
? quotes === "double"
|
|
851
|
+
? (0, exports.escapeDoubleQuotes)(value)
|
|
852
|
+
: (0, exports.escapeSingleQuotes)(value)
|
|
853
|
+
: value;
|
|
854
|
+
if (newlines) {
|
|
855
|
+
return quoteEscaped === null || quoteEscaped === void 0 ? void 0 : quoteEscaped.replace(/\n/g, "\\n");
|
|
856
|
+
}
|
|
857
|
+
return quoteEscaped;
|
|
853
858
|
};
|
|
854
859
|
exports.escapeString = escapeString;
|
|
855
860
|
const escapeDoubleQuotes = (value) => value === null || value === void 0 ? void 0 : value.toString().replace(/"/g, '\\"');
|
|
856
861
|
exports.escapeDoubleQuotes = escapeDoubleQuotes;
|
|
857
862
|
const escapeSingleQuotes = (value) => value === null || value === void 0 ? void 0 : value.toString().replace(/'/g, "\\'");
|
|
858
863
|
exports.escapeSingleQuotes = escapeSingleQuotes;
|
|
864
|
+
const escapeBashExpression = (value, options) => {
|
|
865
|
+
// we can ignore the quotes option here, as the expression is already escaped
|
|
866
|
+
if (options.newlines) {
|
|
867
|
+
return value.transformWithCommand("sed '$!s/$/\\n/'");
|
|
868
|
+
}
|
|
869
|
+
return value;
|
|
870
|
+
};
|
|
871
|
+
exports.escapeBashExpression = escapeBashExpression;
|
|
872
|
+
/**
|
|
873
|
+
*
|
|
874
|
+
* what an absolute nightmare.
|
|
875
|
+
* unfortunatly, dotenv has many limitations. You can't escape quotes properly.
|
|
876
|
+
*
|
|
877
|
+
* In order to be very forgiving, we need to do some magic here:
|
|
878
|
+
*
|
|
879
|
+
* - when the value contains no newlines, we are fine
|
|
880
|
+
* - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
|
|
881
|
+
* - you can't escape quotes. this is a shitty limitation of dotenv and node
|
|
882
|
+
* - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
|
|
883
|
+
* - so we need to quote cleverly
|
|
884
|
+
* - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
|
|
885
|
+
*/
|
|
886
|
+
const escapeForDotEnv = (value) => {
|
|
887
|
+
if (value === undefined || value === null) {
|
|
888
|
+
return "";
|
|
889
|
+
}
|
|
890
|
+
if (typeof value === "string") {
|
|
891
|
+
// if string contains newlines, we need to wrap it in quotes
|
|
892
|
+
// we additionaly escape newlines, that give best compatibility
|
|
893
|
+
if (value.includes("\n")) {
|
|
894
|
+
const newlinesReplaces = value.replace(/\n/g, "\\n");
|
|
895
|
+
const availableQuotes = ['"', "'", "`"];
|
|
896
|
+
// we try to find a quote that is not in the string
|
|
897
|
+
const quote = availableQuotes.find((q) => !value.includes(q));
|
|
898
|
+
// if we found a quote, we can wrap the string in it
|
|
899
|
+
if (quote) {
|
|
900
|
+
return `${quote}${newlinesReplaces}${quote}`;
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
// we can't do really much here, so we just wrap it in double quotes
|
|
904
|
+
return `"${newlinesReplaces}"`;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
else {
|
|
908
|
+
// otherwise we can return as is
|
|
909
|
+
return value;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
else if (value instanceof BashExpression_1.BashExpression) {
|
|
913
|
+
return escapeBashExpressionForDotEnv(value);
|
|
914
|
+
}
|
|
915
|
+
else if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
|
|
916
|
+
// instead of doing it part-wise, we just do it all at once
|
|
917
|
+
const containsAnyBashExpression = value.parts.some((part) => part instanceof BashExpression_1.BashExpression);
|
|
918
|
+
if (!containsAnyBashExpression) {
|
|
919
|
+
return (0, exports.escapeForDotEnv)(value.toString({
|
|
920
|
+
quotes: "double",
|
|
921
|
+
}));
|
|
922
|
+
}
|
|
923
|
+
else {
|
|
924
|
+
const result = escapeBashExpressionForDotEnv(new BashExpression_1.BashExpression(value.toString({
|
|
925
|
+
quotes: "double",
|
|
926
|
+
})));
|
|
927
|
+
return result;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
else {
|
|
931
|
+
return value;
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
exports.escapeForDotEnv = escapeForDotEnv;
|
|
935
|
+
const escapeBashExpressionForDotEnv = (value) => {
|
|
936
|
+
// basically the same thing as above in awk.
|
|
937
|
+
// we optimize that later to make it shorter or create a script for it (either pre-script or bake it into the pipeline job)
|
|
938
|
+
// thx chatgpt for this
|
|
939
|
+
const awkCommand = 'awk \'{output = output (NR == 1 ? "" : "\\\\n") $0} END {if (output ~ /"/ && output ~ /\'\\\'\'/ && output ~ //) print "\\"" output "\\""; else if (output !~ /"/) print "\\"" output "\\""; else if (output !~ /\'\\\'\'/) print "\'"\'"\'" output "\'"\'"\'"; else print "" output ""}\'';
|
|
940
|
+
return value.transformWithCommand(awkCommand).toString();
|
|
941
|
+
};
|
|
859
942
|
//# sourceMappingURL=bashEscape.js.map
|
|
860
943
|
|
|
861
944
|
/***/ }),
|
|
@@ -969,7 +1052,11 @@ const getInjectVarsScript = (vars) => {
|
|
|
969
1052
|
// filter out null and undefined values
|
|
970
1053
|
return Object.entries(vars)
|
|
971
1054
|
.filter(([, value]) => !(0, lodash_1.isNil)(value))
|
|
972
|
-
.map(([key, value]) => `export ${key}="${value
|
|
1055
|
+
.map(([key, value]) => `export ${key}="${value
|
|
1056
|
+
? (0, bashEscape_1.bashEscape)(value, {
|
|
1057
|
+
quotes: "double",
|
|
1058
|
+
})
|
|
1059
|
+
: ""}"`);
|
|
973
1060
|
};
|
|
974
1061
|
exports.getInjectVarsScript = getInjectVarsScript;
|
|
975
1062
|
//# sourceMappingURL=getInjectVarsScript.js.map
|
|
@@ -1309,8 +1396,7 @@ const writeDotEnv = (context) => {
|
|
|
1309
1396
|
// filter out build variables, since they may interfer with caching like turbo
|
|
1310
1397
|
// build variables are rarely used anyway and we may treat them differently in the future
|
|
1311
1398
|
.filter(([key]) => !getBuildInfoVariables_1.ALL_BUILD_VARIABLES.includes(key))
|
|
1312
|
-
|
|
1313
|
-
.map(([key, value]) => `${key}='${(0, bashEscape_1.bashEscape)(value, "single")}'`)
|
|
1399
|
+
.map(([key, value]) => `${key}=${(0, bashEscape_1.escapeForDotEnv)(value)}`)
|
|
1314
1400
|
.join("\n");
|
|
1315
1401
|
return (0, gitlab_1.collapseableSection)("write-dotenv-" + context.name, "write dot env")([
|
|
1316
1402
|
`cat <<EOF > ${context.build.dir}/.env
|
|
@@ -6525,6 +6611,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
6525
6611
|
|
|
6526
6612
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6527
6613
|
exports.createVariableValueContainingReferencesFromString = exports.VariableValueContainingReferences = exports.VariableReference = exports.UnresolvableReference = void 0;
|
|
6614
|
+
const BashExpression_1 = __nccwpck_require__(2376);
|
|
6528
6615
|
const bashEscape_1 = __nccwpck_require__(2463);
|
|
6529
6616
|
class UnresolvableReference {
|
|
6530
6617
|
constructor(reference) {
|
|
@@ -6553,11 +6640,17 @@ class VariableValueContainingReferences {
|
|
|
6553
6640
|
? []
|
|
6554
6641
|
: [part]);
|
|
6555
6642
|
}
|
|
6556
|
-
toString(options = {
|
|
6643
|
+
toString(options = {
|
|
6644
|
+
quotes: false,
|
|
6645
|
+
newlines: false,
|
|
6646
|
+
}) {
|
|
6557
6647
|
return this.parts
|
|
6558
6648
|
.map((part) => {
|
|
6559
6649
|
if (typeof part === "string") {
|
|
6560
|
-
return
|
|
6650
|
+
return (0, bashEscape_1.escapeString)(part, options);
|
|
6651
|
+
}
|
|
6652
|
+
else if (part instanceof BashExpression_1.BashExpression) {
|
|
6653
|
+
return (0, bashEscape_1.escapeBashExpression)(part, options);
|
|
6561
6654
|
}
|
|
6562
6655
|
else {
|
|
6563
6656
|
return part.toString();
|
|
@@ -3998,35 +3998,120 @@ exports.joinBashExpressions = joinBashExpressions;
|
|
|
3998
3998
|
"use strict";
|
|
3999
3999
|
|
|
4000
4000
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4001
|
-
exports.escapeSingleQuotes = exports.escapeDoubleQuotes = exports.escapeString = exports.bashEscape = void 0;
|
|
4001
|
+
exports.escapeForDotEnv = exports.escapeBashExpression = exports.escapeSingleQuotes = exports.escapeDoubleQuotes = exports.escapeString = exports.bashEscape = void 0;
|
|
4002
4002
|
const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
|
|
4003
4003
|
const BashExpression_1 = __nccwpck_require__(42376);
|
|
4004
4004
|
/**
|
|
4005
4005
|
* escapes a string or bash expression for bash
|
|
4006
4006
|
* it either can escape single or double quotes (double is default)
|
|
4007
4007
|
*/
|
|
4008
|
-
const bashEscape = (value,
|
|
4008
|
+
const bashEscape = (value, options = {
|
|
4009
|
+
quotes: false,
|
|
4010
|
+
newlines: false,
|
|
4011
|
+
}) => {
|
|
4009
4012
|
if (value instanceof BashExpression_1.BashExpression) {
|
|
4010
|
-
return
|
|
4013
|
+
return (0, exports.escapeBashExpression)(value, options);
|
|
4011
4014
|
}
|
|
4012
4015
|
if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
|
|
4013
|
-
return value.toString(
|
|
4014
|
-
escape: mode,
|
|
4015
|
-
});
|
|
4016
|
+
return value.toString(options);
|
|
4016
4017
|
}
|
|
4017
|
-
return (0, exports.escapeString)(value,
|
|
4018
|
+
return (0, exports.escapeString)(value, options);
|
|
4018
4019
|
};
|
|
4019
4020
|
exports.bashEscape = bashEscape;
|
|
4020
|
-
const escapeString = (value,
|
|
4021
|
-
|
|
4022
|
-
?
|
|
4023
|
-
|
|
4021
|
+
const escapeString = (value, { quotes, newlines }) => {
|
|
4022
|
+
const quoteEscaped = quotes
|
|
4023
|
+
? quotes === "double"
|
|
4024
|
+
? (0, exports.escapeDoubleQuotes)(value)
|
|
4025
|
+
: (0, exports.escapeSingleQuotes)(value)
|
|
4026
|
+
: value;
|
|
4027
|
+
if (newlines) {
|
|
4028
|
+
return quoteEscaped === null || quoteEscaped === void 0 ? void 0 : quoteEscaped.replace(/\n/g, "\\n");
|
|
4029
|
+
}
|
|
4030
|
+
return quoteEscaped;
|
|
4024
4031
|
};
|
|
4025
4032
|
exports.escapeString = escapeString;
|
|
4026
4033
|
const escapeDoubleQuotes = (value) => value === null || value === void 0 ? void 0 : value.toString().replace(/"/g, '\\"');
|
|
4027
4034
|
exports.escapeDoubleQuotes = escapeDoubleQuotes;
|
|
4028
4035
|
const escapeSingleQuotes = (value) => value === null || value === void 0 ? void 0 : value.toString().replace(/'/g, "\\'");
|
|
4029
4036
|
exports.escapeSingleQuotes = escapeSingleQuotes;
|
|
4037
|
+
const escapeBashExpression = (value, options) => {
|
|
4038
|
+
// we can ignore the quotes option here, as the expression is already escaped
|
|
4039
|
+
if (options.newlines) {
|
|
4040
|
+
return value.transformWithCommand("sed '$!s/$/\\n/'");
|
|
4041
|
+
}
|
|
4042
|
+
return value;
|
|
4043
|
+
};
|
|
4044
|
+
exports.escapeBashExpression = escapeBashExpression;
|
|
4045
|
+
/**
|
|
4046
|
+
*
|
|
4047
|
+
* what an absolute nightmare.
|
|
4048
|
+
* unfortunatly, dotenv has many limitations. You can't escape quotes properly.
|
|
4049
|
+
*
|
|
4050
|
+
* In order to be very forgiving, we need to do some magic here:
|
|
4051
|
+
*
|
|
4052
|
+
* - when the value contains no newlines, we are fine
|
|
4053
|
+
* - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
|
|
4054
|
+
* - you can't escape quotes. this is a shitty limitation of dotenv and node
|
|
4055
|
+
* - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
|
|
4056
|
+
* - so we need to quote cleverly
|
|
4057
|
+
* - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
|
|
4058
|
+
*/
|
|
4059
|
+
const escapeForDotEnv = (value) => {
|
|
4060
|
+
if (value === undefined || value === null) {
|
|
4061
|
+
return "";
|
|
4062
|
+
}
|
|
4063
|
+
if (typeof value === "string") {
|
|
4064
|
+
// if string contains newlines, we need to wrap it in quotes
|
|
4065
|
+
// we additionaly escape newlines, that give best compatibility
|
|
4066
|
+
if (value.includes("\n")) {
|
|
4067
|
+
const newlinesReplaces = value.replace(/\n/g, "\\n");
|
|
4068
|
+
const availableQuotes = ['"', "'", "`"];
|
|
4069
|
+
// we try to find a quote that is not in the string
|
|
4070
|
+
const quote = availableQuotes.find((q) => !value.includes(q));
|
|
4071
|
+
// if we found a quote, we can wrap the string in it
|
|
4072
|
+
if (quote) {
|
|
4073
|
+
return `${quote}${newlinesReplaces}${quote}`;
|
|
4074
|
+
}
|
|
4075
|
+
else {
|
|
4076
|
+
// we can't do really much here, so we just wrap it in double quotes
|
|
4077
|
+
return `"${newlinesReplaces}"`;
|
|
4078
|
+
}
|
|
4079
|
+
}
|
|
4080
|
+
else {
|
|
4081
|
+
// otherwise we can return as is
|
|
4082
|
+
return value;
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4085
|
+
else if (value instanceof BashExpression_1.BashExpression) {
|
|
4086
|
+
return escapeBashExpressionForDotEnv(value);
|
|
4087
|
+
}
|
|
4088
|
+
else if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
|
|
4089
|
+
// instead of doing it part-wise, we just do it all at once
|
|
4090
|
+
const containsAnyBashExpression = value.parts.some((part) => part instanceof BashExpression_1.BashExpression);
|
|
4091
|
+
if (!containsAnyBashExpression) {
|
|
4092
|
+
return (0, exports.escapeForDotEnv)(value.toString({
|
|
4093
|
+
quotes: "double",
|
|
4094
|
+
}));
|
|
4095
|
+
}
|
|
4096
|
+
else {
|
|
4097
|
+
const result = escapeBashExpressionForDotEnv(new BashExpression_1.BashExpression(value.toString({
|
|
4098
|
+
quotes: "double",
|
|
4099
|
+
})));
|
|
4100
|
+
return result;
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4103
|
+
else {
|
|
4104
|
+
return value;
|
|
4105
|
+
}
|
|
4106
|
+
};
|
|
4107
|
+
exports.escapeForDotEnv = escapeForDotEnv;
|
|
4108
|
+
const escapeBashExpressionForDotEnv = (value) => {
|
|
4109
|
+
// basically the same thing as above in awk.
|
|
4110
|
+
// we optimize that later to make it shorter or create a script for it (either pre-script or bake it into the pipeline job)
|
|
4111
|
+
// thx chatgpt for this
|
|
4112
|
+
const awkCommand = 'awk \'{output = output (NR == 1 ? "" : "\\\\n") $0} END {if (output ~ /"/ && output ~ /\'\\\'\'/ && output ~ //) print "\\"" output "\\""; else if (output !~ /"/) print "\\"" output "\\""; else if (output !~ /\'\\\'\'/) print "\'"\'"\'" output "\'"\'"\'"; else print "" output ""}\'';
|
|
4113
|
+
return value.transformWithCommand(awkCommand).toString();
|
|
4114
|
+
};
|
|
4030
4115
|
//# sourceMappingURL=bashEscape.js.map
|
|
4031
4116
|
|
|
4032
4117
|
/***/ }),
|
|
@@ -4140,7 +4225,11 @@ const getInjectVarsScript = (vars) => {
|
|
|
4140
4225
|
// filter out null and undefined values
|
|
4141
4226
|
return Object.entries(vars)
|
|
4142
4227
|
.filter(([, value]) => !(0, lodash_1.isNil)(value))
|
|
4143
|
-
.map(([key, value]) => `export ${key}="${value
|
|
4228
|
+
.map(([key, value]) => `export ${key}="${value
|
|
4229
|
+
? (0, bashEscape_1.bashEscape)(value, {
|
|
4230
|
+
quotes: "double",
|
|
4231
|
+
})
|
|
4232
|
+
: ""}"`);
|
|
4144
4233
|
};
|
|
4145
4234
|
exports.getInjectVarsScript = getInjectVarsScript;
|
|
4146
4235
|
//# sourceMappingURL=getInjectVarsScript.js.map
|
|
@@ -4480,8 +4569,7 @@ const writeDotEnv = (context) => {
|
|
|
4480
4569
|
// filter out build variables, since they may interfer with caching like turbo
|
|
4481
4570
|
// build variables are rarely used anyway and we may treat them differently in the future
|
|
4482
4571
|
.filter(([key]) => !getBuildInfoVariables_1.ALL_BUILD_VARIABLES.includes(key))
|
|
4483
|
-
|
|
4484
|
-
.map(([key, value]) => `${key}='${(0, bashEscape_1.bashEscape)(value, "single")}'`)
|
|
4572
|
+
.map(([key, value]) => `${key}=${(0, bashEscape_1.escapeForDotEnv)(value)}`)
|
|
4485
4573
|
.join("\n");
|
|
4486
4574
|
return (0, gitlab_1.collapseableSection)("write-dotenv-" + context.name, "write dot env")([
|
|
4487
4575
|
`cat <<EOF > ${context.build.dir}/.env
|
|
@@ -9696,6 +9784,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
9696
9784
|
|
|
9697
9785
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9698
9786
|
exports.createVariableValueContainingReferencesFromString = exports.VariableValueContainingReferences = exports.VariableReference = exports.UnresolvableReference = void 0;
|
|
9787
|
+
const BashExpression_1 = __nccwpck_require__(42376);
|
|
9699
9788
|
const bashEscape_1 = __nccwpck_require__(12463);
|
|
9700
9789
|
class UnresolvableReference {
|
|
9701
9790
|
constructor(reference) {
|
|
@@ -9724,11 +9813,17 @@ class VariableValueContainingReferences {
|
|
|
9724
9813
|
? []
|
|
9725
9814
|
: [part]);
|
|
9726
9815
|
}
|
|
9727
|
-
toString(options = {
|
|
9816
|
+
toString(options = {
|
|
9817
|
+
quotes: false,
|
|
9818
|
+
newlines: false,
|
|
9819
|
+
}) {
|
|
9728
9820
|
return this.parts
|
|
9729
9821
|
.map((part) => {
|
|
9730
9822
|
if (typeof part === "string") {
|
|
9731
|
-
return
|
|
9823
|
+
return (0, bashEscape_1.escapeString)(part, options);
|
|
9824
|
+
}
|
|
9825
|
+
else if (part instanceof BashExpression_1.BashExpression) {
|
|
9826
|
+
return (0, bashEscape_1.escapeBashExpression)(part, options);
|
|
9732
9827
|
}
|
|
9733
9828
|
else {
|
|
9734
9829
|
return part.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printVariables.js","sourceRoot":"","sources":["../../../../../src/apps/catenv/printVariables.ts"],"names":[],"mappings":";;;AACA,oEAAmE;AAEnE,mCAIiB;AAEjB,MAAM,sBAAsB,GAAG,KAAK,EAAE,MAAc,EAAE,MAAe,EAAE,EAAE;;IACvE,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,2CAAmC,EACzE,MAAM,EACN,MAAM,CACP,CAAC;IAEF,IAAI,gBAAgB,EAAE,CAAC;QACrB,wCAAwC;QACxC,IAAI,MAAA,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,MAAM,mCAAI,IAAI,EAAE,CAAC;YACvD,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,MAAM,IAAA,qCAAkB,EAAC,IAAI,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAC/D,CAAC;SAAM,CAAC;QACN,6DAA6D;QAC7D,0EAA0E;QAC1E,mCAAmC;QACnC,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAChD,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE;;YAC3B,wCAAwC;YACxC,IAAI,MAAA,MAAM,CAAC,UAAU,CAAC,aAA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,GAAG,KAAK,EAAE,MAAc,EAAE,MAAe,EAAE,EAAE;IACtE,MAAM,SAAS,GAAG,MAAM,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE/D,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAJW,QAAA,cAAc,kBAIzB;AAEF,MAAM,wBAAwB,GAAG,CAAC,SAAiC,EAAE,EAAE,CACrE,IAAA,0BAAkB,EAAC,SAAS,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Config } from "../../../../pipeline/src/index.js";
|
|
2
|
-
import type { Choice
|
|
2
|
+
import type { Choice } from "./types";
|
|
3
3
|
export declare const getComponentFullPath: (gitRoot: string, config: Config, componentName: string) => string;
|
|
4
4
|
export declare const getCurrentComponentAndEnvFromChoice: (config: Config, choice?: Choice) => Promise<{
|
|
5
5
|
currentComponent: string;
|
|
6
6
|
env: string;
|
|
7
7
|
}>;
|
|
8
|
-
export declare const makeKeyValueString: (variables:
|
|
8
|
+
export declare const makeKeyValueString: (variables: Record<string, string>, keyPrefix?: string) => string;
|
|
9
9
|
export declare const sanitizeEnvVarName: (name: string) => string;
|
|
@@ -24,9 +24,8 @@ const getCurrentComponentAndEnvFromChoice = async (config, choice) => {
|
|
|
24
24
|
};
|
|
25
25
|
exports.getCurrentComponentAndEnvFromChoice = getCurrentComponentAndEnvFromChoice;
|
|
26
26
|
const makeKeyValueString = (variables, keyPrefix = "") => Object.entries(variables)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
([key, value]) => `${keyPrefix}${key}='${(0, pipeline_1.bashEscape)(value, "single")}'`)
|
|
27
|
+
// quotes are important, otherwise line breaks don't work properly
|
|
28
|
+
.map(([key, value]) => `${keyPrefix}${key}=${(0, pipeline_1.escapeForDotEnv)(value)}`)
|
|
30
29
|
.join("\n");
|
|
31
30
|
exports.makeKeyValueString = makeKeyValueString;
|
|
32
31
|
const sanitizeEnvVarName = (name) => name.replace(/[\s\-.]+/g, "_");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/apps/catenv/utils.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAC5B,mDAAkD;AAElD,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/apps/catenv/utils.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAC5B,mDAAkD;AAElD,kDAAsD;AAC/C,MAAM,oBAAoB,GAAG,CAClC,OAAe,EACf,MAAc,EACd,aAAqB,EACrB,EAAE;IACF,OAAO,IAAA,WAAI,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC;AAC7D,CAAC,CAAC;AANW,QAAA,oBAAoB,wBAM/B;AACF,MAAM,uBAAuB,GAAG,KAAK,EAAE,MAAc,EAAE,EAAE;IACvD,MAAM,OAAO,GAAG,MAAM,IAAA,qBAAU,GAAE,CAAC;IACnC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAC/C,UAAU,CAAC,UAAU,CAAC,IAAA,4BAAoB,EAAC,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAChE,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,mCAAmC,GAAG,KAAK,EACtD,MAAc,EACd,MAAe,EACf,EAAE;;IACF,MAAM,GAAG,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,mCAAI,OAAO,CAAC;IACnC,MAAM,gBAAgB,GACpB,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,mCAAI,CAAC,MAAM,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC;IAEnE,OAAO;QACL,gBAAgB;QAChB,GAAG;KACJ,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,mCAAmC,uCAY9C;AAEK,MAAM,kBAAkB,GAAG,CAChC,SAAiC,EACjC,SAAS,GAAG,EAAE,EACd,EAAE,CACF,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;IACvB,kEAAkE;KACjE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS,GAAG,GAAG,IAAI,IAAA,0BAAe,EAAC,KAAK,CAAC,EAAE,CAAC;KACrE,IAAI,CAAC,IAAI,CAAC,CAAC;AAPH,QAAA,kBAAkB,sBAOf;AAET,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAE,CACjD,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AADpB,QAAA,kBAAkB,sBACE"}
|
|
@@ -22,7 +22,6 @@ const writeDotEnvFiles = async (config, choice) => {
|
|
|
22
22
|
delete variables["_ALL_ENV_VAR_KEYS"];
|
|
23
23
|
const componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
|
|
24
24
|
const filePath = (0, path_1.join)(componentDir, ".env");
|
|
25
|
-
// many .dotenv don't like multiline values, so we sanitize them here
|
|
26
25
|
await (0, pipeline_1.writeGeneratedFile)(filePath, (0, utils_1.makeKeyValueString)(variables), {
|
|
27
26
|
commentChar: "#",
|
|
28
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeDotEnvFiles.js","sourceRoot":"","sources":["../../../../../src/apps/catenv/writeDotEnvFiles.ts"],"names":[],"mappings":";;;AAAA,kDAAsE;AACtE,+BAA4B;AAC5B,oEAAmE;AACnE,mDAAkD;AAElD,mCAIiB;AAEV,MAAM,gBAAgB,GAAG,KAAK,EAAE,MAAc,EAAE,MAAe,EAAE,EAAE;IACxE,MAAM,EAAE,GAAG,EAAE,gBAAg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,4 @@
|
|
|
1
|
-
import type { Config
|
|
1
|
+
import type { Config } from "../../../pipeline/src/index.js";
|
|
2
2
|
import type { CommandInstance } from "vorpal";
|
|
3
3
|
export { parseChoice } from "./parseChoice";
|
|
4
4
|
export declare const getProjectConfig: () => Promise<Config>;
|
|
@@ -14,9 +14,9 @@ export declare const getAllComponentsWithAllEnvsHierarchical: () => Promise<{
|
|
|
14
14
|
export declare const getAllPipelineContexts: () => Promise<import("../../../pipeline/src/index.js").ComponentContext[]>;
|
|
15
15
|
export declare const getEnvironment: (env: string, componentName: string) => Promise<import("../../../pipeline/src/index.js").Environment>;
|
|
16
16
|
export declare const getGitlabVar: (vorpal: CommandInstance, env: string, componentName: string, variableName: string) => Promise<string>;
|
|
17
|
-
export declare const getEnvVarsResolved: (vorpal: CommandInstance | null, env: string, componentName: string | null) => Promise<Record<string,
|
|
17
|
+
export declare const getEnvVarsResolved: (vorpal: CommandInstance | null, env: string, componentName: string | null) => Promise<Record<string, string>>;
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
* is used to get job only vars that should also be editable locally with catladder.
|
|
21
21
|
*/
|
|
22
|
-
export declare const getJobOnlyEnvVarsResolved: (vorpal: CommandInstance, env: string, componentName: string) => Promise<Record<string,
|
|
22
|
+
export declare const getJobOnlyEnvVarsResolved: (vorpal: CommandInstance, env: string, componentName: string) => Promise<Record<string, string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProjectConfig.js","sourceRoot":"","sources":["../../../../src/config/getProjectConfig.ts"],"names":[],"mappings":";;;AAKA,kDAM6B;AAG7B,4CAA6E;AAE7E,gDAA+C;AAE/C,2BAA2B;AAE3B,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AAEpB,IAAI,aAAa,GAAkB,IAAI,CAAC;AAExC,8BAA8B;AAC9B,MAAM,sBAAsB,GAAG,KAAK,IAAI,EAAE;IACxC,MAAM,OAAO,GAAG,MAAM,IAAA,qBAAU,GAAE,CAAC;IACn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AEK,MAAM,kBAAkB,GAAG,KAAK,EACrC,MAA8B,EAC9B,GAAW,EACX,aAA4B,EAC5B,EAAE;IACF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,IAAA,sBAAc,EAAC,GAAG,EAAE,aAAa,CAAC,CAAC;QAE5D,yEAAyE;QACzE,yCAAyC;QACzC,OAAO,cAAc,CAAC,MAAM,EAAE;YAC5B;gBACE,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;aAC9C;SACF,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,kBAAkB;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAvBW,QAAA,kBAAkB,sBAuB7B;AAEF;;;GAGG;AACI,MAAM,yBAAyB,GAAG,KAAK,EAC5C,MAAuB,EACvB,GAAW,EACX,aAAqB,EACrB,EAAE;IACF,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,IAAA,sBAAc,EAAC,GAAG,EAAE,aAAa,CAAC,CAAC;QAC5D,OAAO,cAAc,CAAC,MAAM,EAAE;YAC5B,UAAU,CAAC,WAAW,CAAC,KAAK;YAC5B,UAAU,CAAC,WAAW,CAAC,MAAM;SAC9B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,kBAAkB;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAfW,QAAA,yBAAyB,6BAepC"}
|
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import type { VariableValue } from "../variables/VariableValue";
|
|
2
|
-
|
|
2
|
+
import { BashExpression } from "./BashExpression";
|
|
3
|
+
export type QuotesEscapeMode = "single" | "double";
|
|
4
|
+
export type EscapeOptions = {
|
|
5
|
+
quotes?: QuotesEscapeMode | false;
|
|
6
|
+
newlines?: boolean;
|
|
7
|
+
};
|
|
3
8
|
/**
|
|
4
9
|
* escapes a string or bash expression for bash
|
|
5
10
|
* it either can escape single or double quotes (double is default)
|
|
6
11
|
*/
|
|
7
|
-
export declare const bashEscape: (value: VariableValue | any,
|
|
8
|
-
export declare const escapeString: (value: string | null | undefined,
|
|
12
|
+
export declare const bashEscape: (value: VariableValue | any, options?: EscapeOptions) => string | BashExpression;
|
|
13
|
+
export declare const escapeString: (value: string | null | undefined, { quotes, newlines }: EscapeOptions) => string;
|
|
9
14
|
export declare const escapeDoubleQuotes: (value: string | null | undefined) => string;
|
|
10
15
|
export declare const escapeSingleQuotes: (value: string | null | undefined) => string;
|
|
16
|
+
export declare const escapeBashExpression: (value: BashExpression, options: EscapeOptions) => BashExpression;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* what an absolute nightmare.
|
|
20
|
+
* unfortunatly, dotenv has many limitations. You can't escape quotes properly.
|
|
21
|
+
*
|
|
22
|
+
* In order to be very forgiving, we need to do some magic here:
|
|
23
|
+
*
|
|
24
|
+
* - when the value contains no newlines, we are fine
|
|
25
|
+
* - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
|
|
26
|
+
* - you can't escape quotes. this is a shitty limitation of dotenv and node
|
|
27
|
+
* - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
|
|
28
|
+
* - so we need to quote cleverly
|
|
29
|
+
* - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
|
|
30
|
+
*/
|
|
31
|
+
export declare const escapeForDotEnv: (value: VariableValue | undefined | null) => string;
|