@catladder/cli 0.0.0-main-0acdca98 → 0.0.0-main-722844ec
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/apps/catenv/catenv.d.ts +2 -4
- package/dist/apps/catenv/catenv.js +8 -89
- package/dist/apps/catenv/catenv.js.map +1 -1
- package/dist/apps/catenv/printVariables.d.ts +3 -0
- package/dist/apps/catenv/printVariables.js +111 -0
- package/dist/apps/catenv/printVariables.js.map +1 -0
- package/dist/apps/catenv/types.d.ts +5 -0
- package/dist/apps/catenv/types.js +3 -0
- package/dist/apps/catenv/types.js.map +1 -0
- package/dist/apps/catenv/utils.d.ts +12 -0
- package/dist/apps/catenv/utils.js +108 -0
- package/dist/apps/catenv/utils.js.map +1 -0
- package/dist/apps/catenv/writeDotEnvFiles.d.ts +3 -0
- package/dist/apps/catenv/writeDotEnvFiles.js +93 -0
- package/dist/apps/catenv/writeDotEnvFiles.js.map +1 -0
- package/dist/bundles/catenv/index.js +365 -62
- package/dist/bundles/cli/index.js +53 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/apps/catenv/catenv.ts +8 -65
- package/src/apps/catenv/printVariables.ts +51 -0
- package/src/apps/catenv/types.ts +6 -0
- package/src/apps/catenv/utils.ts +49 -0
- package/src/apps/catenv/writeDotEnvFiles.ts +45 -0
- package/tsconfig.json +1 -1
|
@@ -6,6 +6,75 @@
|
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
8
8
|
|
|
9
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
10
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
11
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
13
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
14
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
15
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
19
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
20
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
21
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
22
|
+
function step(op) {
|
|
23
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
24
|
+
while (_) try {
|
|
25
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
26
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
27
|
+
switch (op[0]) {
|
|
28
|
+
case 0: case 1: t = op; break;
|
|
29
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
30
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
31
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
32
|
+
default:
|
|
33
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
34
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
35
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
36
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
37
|
+
if (t[2]) _.ops.pop();
|
|
38
|
+
_.trys.pop(); continue;
|
|
39
|
+
}
|
|
40
|
+
op = body.call(thisArg, _);
|
|
41
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
42
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.__esModule = true;
|
|
46
|
+
var getProjectConfig_1 = __nccwpck_require__(4146);
|
|
47
|
+
var printVariables_1 = __nccwpck_require__(7770);
|
|
48
|
+
var writeDotEnvFiles_1 = __nccwpck_require__(4295);
|
|
49
|
+
exports["default"] = (function (choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
var config;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
|
|
54
|
+
case 1:
|
|
55
|
+
config = _a.sent();
|
|
56
|
+
if (!config) {
|
|
57
|
+
return [2 /*return*/];
|
|
58
|
+
}
|
|
59
|
+
return [4 /*yield*/, (0, printVariables_1.printVariables)(config, choice)];
|
|
60
|
+
case 2:
|
|
61
|
+
_a.sent();
|
|
62
|
+
return [4 /*yield*/, (0, writeDotEnvFiles_1.writeDotEnvFiles)(config, choice)];
|
|
63
|
+
case 3:
|
|
64
|
+
_a.sent();
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}); });
|
|
69
|
+
//# sourceMappingURL=catenv.js.map
|
|
70
|
+
|
|
71
|
+
/***/ }),
|
|
72
|
+
|
|
73
|
+
/***/ 7770:
|
|
74
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
75
|
+
|
|
76
|
+
"use strict";
|
|
77
|
+
|
|
9
78
|
var __assign = (this && this.__assign) || function () {
|
|
10
79
|
__assign = Object.assign || function(t) {
|
|
11
80
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -54,48 +123,23 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
54
123
|
}
|
|
55
124
|
};
|
|
56
125
|
exports.__esModule = true;
|
|
126
|
+
exports.printVariables = void 0;
|
|
57
127
|
var getProjectConfig_1 = __nccwpck_require__(4146);
|
|
58
|
-
var
|
|
59
|
-
var path_1 = __nccwpck_require__(1017);
|
|
60
|
-
var getCurrentComponentName = function (components) { return __awaiter(void 0, void 0, void 0, function () {
|
|
61
|
-
var gitRoot, currentDir;
|
|
62
|
-
return __generator(this, function (_a) {
|
|
63
|
-
switch (_a.label) {
|
|
64
|
-
case 0: return [4 /*yield*/, (0, projects_1.getGitRoot)()];
|
|
65
|
-
case 1:
|
|
66
|
-
gitRoot = _a.sent();
|
|
67
|
-
currentDir = process.cwd();
|
|
68
|
-
return [2 /*return*/, Object.keys(components).find(function (c) {
|
|
69
|
-
return currentDir.startsWith((0, path_1.join)(gitRoot, components[c].dir));
|
|
70
|
-
})];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}); };
|
|
74
|
-
var sanitizeEnvVarName = function (name) { return name.replace(/[\s\-.]+/g, "_"); };
|
|
128
|
+
var utils_1 = __nccwpck_require__(4640);
|
|
75
129
|
var getAllVariablesToPrint = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
case
|
|
81
|
-
|
|
82
|
-
components = config.components;
|
|
83
|
-
if (!((_c = choice === null || choice === void 0 ? void 0 : choice.componentName) !== null && _c !== void 0)) return [3 /*break*/, 1];
|
|
84
|
-
_a = _c;
|
|
85
|
-
return [3 /*break*/, 3];
|
|
86
|
-
case 1: return [4 /*yield*/, getCurrentComponentName(components)];
|
|
87
|
-
case 2:
|
|
88
|
-
_a = (_d.sent());
|
|
89
|
-
_d.label = 3;
|
|
90
|
-
case 3:
|
|
91
|
-
currentComponent = _a;
|
|
130
|
+
var _a, env, currentComponent, variables;
|
|
131
|
+
return __generator(this, function (_b) {
|
|
132
|
+
switch (_b.label) {
|
|
133
|
+
case 0: return [4 /*yield*/, (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice)];
|
|
134
|
+
case 1:
|
|
135
|
+
_a = _b.sent(), env = _a.env, currentComponent = _a.currentComponent;
|
|
92
136
|
variables = {};
|
|
93
|
-
if (!currentComponent) return [3 /*break*/,
|
|
137
|
+
if (!currentComponent) return [3 /*break*/, 3];
|
|
94
138
|
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(null, env, currentComponent)];
|
|
95
|
-
case
|
|
96
|
-
variables =
|
|
97
|
-
return [3 /*break*/,
|
|
98
|
-
case
|
|
139
|
+
case 2:
|
|
140
|
+
variables = _b.sent();
|
|
141
|
+
return [3 /*break*/, 5];
|
|
142
|
+
case 3: return [4 /*yield*/, Object.keys(config.components).reduce(function (acc, componentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
143
|
var subappvars, _a;
|
|
100
144
|
return __generator(this, function (_b) {
|
|
101
145
|
switch (_b.label) {
|
|
@@ -107,47 +151,255 @@ var getAllVariablesToPrint = function (config, choice) { return __awaiter(void 0
|
|
|
107
151
|
case 2: return [2 /*return*/, __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_b.sent())])), subappvars]), Object.fromEntries(Object.entries(subappvars).map(function (_a) {
|
|
108
152
|
var key = _a[0], value = _a[1];
|
|
109
153
|
return [
|
|
110
|
-
"".concat(sanitizeEnvVarName(componentName.toUpperCase()), "_").concat(key),
|
|
154
|
+
"".concat((0, utils_1.sanitizeEnvVarName)(componentName.toUpperCase()), "_").concat(key),
|
|
111
155
|
value,
|
|
112
156
|
];
|
|
113
157
|
}))])];
|
|
114
158
|
}
|
|
115
159
|
});
|
|
116
160
|
}); }, {})];
|
|
117
|
-
case
|
|
161
|
+
case 4:
|
|
118
162
|
// when in a monorep and not in a subapp, merge all env vars.
|
|
119
163
|
// this is not 100% correct, but better than not exporting any vars at all
|
|
120
164
|
// so we also add prefixed variants
|
|
121
|
-
variables =
|
|
122
|
-
|
|
123
|
-
case
|
|
165
|
+
variables = _b.sent();
|
|
166
|
+
_b.label = 5;
|
|
167
|
+
case 5: return [2 /*return*/, variables];
|
|
124
168
|
}
|
|
125
169
|
});
|
|
126
170
|
}); };
|
|
127
|
-
|
|
128
|
-
var
|
|
171
|
+
var printVariables = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
172
|
+
var variables;
|
|
129
173
|
return __generator(this, function (_a) {
|
|
130
174
|
switch (_a.label) {
|
|
131
|
-
case 0: return [4 /*yield*/, (
|
|
175
|
+
case 0: return [4 /*yield*/, getAllVariablesToPrint(config, choice)];
|
|
132
176
|
case 1:
|
|
133
|
-
config = _a.sent();
|
|
134
|
-
if (!config) {
|
|
135
|
-
return [2 /*return*/];
|
|
136
|
-
}
|
|
137
|
-
return [4 /*yield*/, getAllVariablesToPrint(config, choice)];
|
|
138
|
-
case 2:
|
|
139
177
|
variables = _a.sent();
|
|
140
|
-
console.log(
|
|
141
|
-
.map(function (_a) {
|
|
142
|
-
var key = _a[0], value = _a[1];
|
|
143
|
-
return "export ".concat(key, "='").concat(value, "'");
|
|
144
|
-
})
|
|
145
|
-
.join("\n"));
|
|
178
|
+
console.log(makeExportKeyValuestring(variables));
|
|
146
179
|
return [2 /*return*/];
|
|
147
180
|
}
|
|
148
181
|
});
|
|
149
|
-
}); }
|
|
150
|
-
|
|
182
|
+
}); };
|
|
183
|
+
exports.printVariables = printVariables;
|
|
184
|
+
var makeExportKeyValuestring = function (variables) {
|
|
185
|
+
return (0, utils_1.makeKeyValueString)(variables, "export ");
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=printVariables.js.map
|
|
188
|
+
|
|
189
|
+
/***/ }),
|
|
190
|
+
|
|
191
|
+
/***/ 4640:
|
|
192
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
193
|
+
|
|
194
|
+
"use strict";
|
|
195
|
+
|
|
196
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
197
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
198
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
199
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
200
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
201
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
202
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
206
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
207
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
208
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
209
|
+
function step(op) {
|
|
210
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
211
|
+
while (_) try {
|
|
212
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
213
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
214
|
+
switch (op[0]) {
|
|
215
|
+
case 0: case 1: t = op; break;
|
|
216
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
217
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
218
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
219
|
+
default:
|
|
220
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
221
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
222
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
223
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
224
|
+
if (t[2]) _.ops.pop();
|
|
225
|
+
_.trys.pop(); continue;
|
|
226
|
+
}
|
|
227
|
+
op = body.call(thisArg, _);
|
|
228
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
229
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
exports.__esModule = true;
|
|
233
|
+
exports.sanitizeEnvVarName = exports.sanitizeMultiLine = exports.makeKeyValueString = exports.getCurrentComponentAndEnvFromChoice = exports.getComponentFullPath = void 0;
|
|
234
|
+
var path_1 = __nccwpck_require__(1017);
|
|
235
|
+
var projects_1 = __nccwpck_require__(1619);
|
|
236
|
+
var getComponentFullPath = function (gitRoot, config, componentName) {
|
|
237
|
+
return (0, path_1.join)(gitRoot, config.components[componentName].dir);
|
|
238
|
+
};
|
|
239
|
+
exports.getComponentFullPath = getComponentFullPath;
|
|
240
|
+
var getCurrentComponentName = function (config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
241
|
+
var gitRoot, currentDir;
|
|
242
|
+
return __generator(this, function (_a) {
|
|
243
|
+
switch (_a.label) {
|
|
244
|
+
case 0: return [4 /*yield*/, (0, projects_1.getGitRoot)()];
|
|
245
|
+
case 1:
|
|
246
|
+
gitRoot = _a.sent();
|
|
247
|
+
currentDir = process.cwd();
|
|
248
|
+
return [2 /*return*/, Object.keys(config.components).find(function (c) {
|
|
249
|
+
return currentDir.startsWith((0, exports.getComponentFullPath)(gitRoot, config, c));
|
|
250
|
+
})];
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}); };
|
|
254
|
+
var getCurrentComponentAndEnvFromChoice = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
255
|
+
var env, currentComponent, _a;
|
|
256
|
+
var _b, _c;
|
|
257
|
+
return __generator(this, function (_d) {
|
|
258
|
+
switch (_d.label) {
|
|
259
|
+
case 0:
|
|
260
|
+
env = (_b = choice === null || choice === void 0 ? void 0 : choice.env) !== null && _b !== void 0 ? _b : "local";
|
|
261
|
+
if (!((_c = choice === null || choice === void 0 ? void 0 : choice.componentName) !== null && _c !== void 0)) return [3 /*break*/, 1];
|
|
262
|
+
_a = _c;
|
|
263
|
+
return [3 /*break*/, 3];
|
|
264
|
+
case 1: return [4 /*yield*/, getCurrentComponentName(config)];
|
|
265
|
+
case 2:
|
|
266
|
+
_a = (_d.sent());
|
|
267
|
+
_d.label = 3;
|
|
268
|
+
case 3:
|
|
269
|
+
currentComponent = _a;
|
|
270
|
+
return [2 /*return*/, {
|
|
271
|
+
currentComponent: currentComponent,
|
|
272
|
+
env: env
|
|
273
|
+
}];
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}); };
|
|
277
|
+
exports.getCurrentComponentAndEnvFromChoice = getCurrentComponentAndEnvFromChoice;
|
|
278
|
+
var makeKeyValueString = function (variables, keyPrefix) {
|
|
279
|
+
if (keyPrefix === void 0) { keyPrefix = ""; }
|
|
280
|
+
return Object.entries(variables)
|
|
281
|
+
.map(function (_a) {
|
|
282
|
+
var key = _a[0], value = _a[1];
|
|
283
|
+
return "".concat(keyPrefix).concat(key, "='").concat(value, "'");
|
|
284
|
+
})
|
|
285
|
+
.join("\n");
|
|
286
|
+
};
|
|
287
|
+
exports.makeKeyValueString = makeKeyValueString;
|
|
288
|
+
var sanitizeMultiLine = function (variables) {
|
|
289
|
+
return Object.fromEntries(Object.entries(variables).map(function (_a) {
|
|
290
|
+
var key = _a[0], value = _a[1];
|
|
291
|
+
return [
|
|
292
|
+
key,
|
|
293
|
+
value.replaceAll("\n", "\\n"),
|
|
294
|
+
];
|
|
295
|
+
}));
|
|
296
|
+
};
|
|
297
|
+
exports.sanitizeMultiLine = sanitizeMultiLine;
|
|
298
|
+
var sanitizeEnvVarName = function (name) {
|
|
299
|
+
return name.replace(/[\s\-.]+/g, "_");
|
|
300
|
+
};
|
|
301
|
+
exports.sanitizeEnvVarName = sanitizeEnvVarName;
|
|
302
|
+
//# sourceMappingURL=utils.js.map
|
|
303
|
+
|
|
304
|
+
/***/ }),
|
|
305
|
+
|
|
306
|
+
/***/ 4295:
|
|
307
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
308
|
+
|
|
309
|
+
"use strict";
|
|
310
|
+
|
|
311
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
312
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
313
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
314
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
315
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
316
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
317
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
321
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
322
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
323
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
324
|
+
function step(op) {
|
|
325
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
326
|
+
while (_) try {
|
|
327
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
328
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
329
|
+
switch (op[0]) {
|
|
330
|
+
case 0: case 1: t = op; break;
|
|
331
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
332
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
333
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
334
|
+
default:
|
|
335
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
336
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
337
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
338
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
339
|
+
if (t[2]) _.ops.pop();
|
|
340
|
+
_.trys.pop(); continue;
|
|
341
|
+
}
|
|
342
|
+
op = body.call(thisArg, _);
|
|
343
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
344
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
exports.__esModule = true;
|
|
348
|
+
exports.writeDotEnvFiles = void 0;
|
|
349
|
+
var fs_extra_1 = __nccwpck_require__(5501);
|
|
350
|
+
var path_1 = __nccwpck_require__(1017);
|
|
351
|
+
var getProjectConfig_1 = __nccwpck_require__(4146);
|
|
352
|
+
var projects_1 = __nccwpck_require__(1619);
|
|
353
|
+
var utils_1 = __nccwpck_require__(4640);
|
|
354
|
+
var writeDotEnvFiles = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
355
|
+
var _a, env, currentComponent, componentsWithEnabledDotEnvWrite, componentsToActuallyWriteDotEnvNow, gitRoot, _i, componentsToActuallyWriteDotEnvNow_1, componentName, variables, componentDir, filePath, variablesSanitized;
|
|
356
|
+
return __generator(this, function (_b) {
|
|
357
|
+
switch (_b.label) {
|
|
358
|
+
case 0: return [4 /*yield*/, (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice)];
|
|
359
|
+
case 1:
|
|
360
|
+
_a = _b.sent(), env = _a.env, currentComponent = _a.currentComponent;
|
|
361
|
+
componentsWithEnabledDotEnvWrite = Object.entries(config.components)
|
|
362
|
+
.filter(function (_a) {
|
|
363
|
+
var component = _a[1];
|
|
364
|
+
return component === null || component === void 0 ? void 0 : component.dotEnv;
|
|
365
|
+
})
|
|
366
|
+
.map(function (_a) {
|
|
367
|
+
var componentName = _a[0];
|
|
368
|
+
return componentName;
|
|
369
|
+
});
|
|
370
|
+
componentsToActuallyWriteDotEnvNow = currentComponent
|
|
371
|
+
? componentsWithEnabledDotEnvWrite.includes(currentComponent)
|
|
372
|
+
? [currentComponent]
|
|
373
|
+
: []
|
|
374
|
+
: componentsWithEnabledDotEnvWrite;
|
|
375
|
+
return [4 /*yield*/, (0, projects_1.getGitRoot)()];
|
|
376
|
+
case 2:
|
|
377
|
+
gitRoot = _b.sent();
|
|
378
|
+
_i = 0, componentsToActuallyWriteDotEnvNow_1 = componentsToActuallyWriteDotEnvNow;
|
|
379
|
+
_b.label = 3;
|
|
380
|
+
case 3:
|
|
381
|
+
if (!(_i < componentsToActuallyWriteDotEnvNow_1.length)) return [3 /*break*/, 7];
|
|
382
|
+
componentName = componentsToActuallyWriteDotEnvNow_1[_i];
|
|
383
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(null, env, componentName)];
|
|
384
|
+
case 4:
|
|
385
|
+
variables = _b.sent();
|
|
386
|
+
componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
|
|
387
|
+
filePath = (0, path_1.join)(componentDir, ".env");
|
|
388
|
+
variablesSanitized = (0, utils_1.sanitizeMultiLine)(variables);
|
|
389
|
+
return [4 /*yield*/, (0, fs_extra_1.writeFile)(filePath, "# automatically created by catladder. Do not modify!\n\n" +
|
|
390
|
+
(0, utils_1.makeKeyValueString)(variablesSanitized))];
|
|
391
|
+
case 5:
|
|
392
|
+
_b.sent();
|
|
393
|
+
_b.label = 6;
|
|
394
|
+
case 6:
|
|
395
|
+
_i++;
|
|
396
|
+
return [3 /*break*/, 3];
|
|
397
|
+
case 7: return [2 /*return*/];
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}); };
|
|
401
|
+
exports.writeDotEnvFiles = writeDotEnvFiles;
|
|
402
|
+
//# sourceMappingURL=writeDotEnvFiles.js.map
|
|
151
403
|
|
|
152
404
|
/***/ }),
|
|
153
405
|
|
|
@@ -38817,6 +39069,7 @@ var utils_1 = __nccwpck_require__(7461);
|
|
|
38817
39069
|
var yarn_1 = __nccwpck_require__(464);
|
|
38818
39070
|
var constants_1 = __nccwpck_require__(1542);
|
|
38819
39071
|
var writeBuildInfo_1 = __nccwpck_require__(1754);
|
|
39072
|
+
var writeDotEnv_1 = __nccwpck_require__(1298);
|
|
38820
39073
|
var createBuildJob = function (context, _a) {
|
|
38821
39074
|
var _b, _c, _d, _e;
|
|
38822
39075
|
var script = _a.script,
|
|
@@ -38830,7 +39083,7 @@ var createBuildJob = function (context, _a) {
|
|
|
38830
39083
|
needs: [],
|
|
38831
39084
|
cache: [],
|
|
38832
39085
|
variables: __assign(__assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
38833
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
|
|
39086
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(context.componentConfig.dotEnv ? (0, writeDotEnv_1.writeDotEnv)(context) : []), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
|
|
38834
39087
|
artifacts: {
|
|
38835
39088
|
paths: [(0, path_1.join)(context.componentConfig.dir, "__build_info.json")],
|
|
38836
39089
|
reports: {
|
|
@@ -38861,6 +39114,56 @@ exports.writeBuildInfo = writeBuildInfo;
|
|
|
38861
39114
|
|
|
38862
39115
|
/***/ }),
|
|
38863
39116
|
|
|
39117
|
+
/***/ 1298:
|
|
39118
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
39119
|
+
|
|
39120
|
+
"use strict";
|
|
39121
|
+
|
|
39122
|
+
|
|
39123
|
+
var __read = this && this.__read || function (o, n) {
|
|
39124
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
39125
|
+
if (!m) return o;
|
|
39126
|
+
var i = m.call(o),
|
|
39127
|
+
r,
|
|
39128
|
+
ar = [],
|
|
39129
|
+
e;
|
|
39130
|
+
try {
|
|
39131
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
39132
|
+
} catch (error) {
|
|
39133
|
+
e = {
|
|
39134
|
+
error: error
|
|
39135
|
+
};
|
|
39136
|
+
} finally {
|
|
39137
|
+
try {
|
|
39138
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
39139
|
+
} finally {
|
|
39140
|
+
if (e) throw e.error;
|
|
39141
|
+
}
|
|
39142
|
+
}
|
|
39143
|
+
return ar;
|
|
39144
|
+
};
|
|
39145
|
+
exports.__esModule = true;
|
|
39146
|
+
exports.writeDotEnv = void 0;
|
|
39147
|
+
/**
|
|
39148
|
+
* writes a .env file in the components folder
|
|
39149
|
+
* @param context
|
|
39150
|
+
* @returns
|
|
39151
|
+
*/
|
|
39152
|
+
var writeDotEnv = function (context) {
|
|
39153
|
+
var envVars = context.environment.envVars;
|
|
39154
|
+
// make key=value and sanitize multiline
|
|
39155
|
+
var keyValueString = Object.entries(envVars).map(function (_a) {
|
|
39156
|
+
var _b = __read(_a, 2),
|
|
39157
|
+
key = _b[0],
|
|
39158
|
+
value = _b[1];
|
|
39159
|
+
return "".concat(key, "=").concat(value.replaceAll("\n", "\\n"));
|
|
39160
|
+
}).join("\n");
|
|
39161
|
+
return ["cat <<EOF > ".concat(context.componentConfig.dir, "/.env\n").concat(keyValueString, "\nEOF")];
|
|
39162
|
+
};
|
|
39163
|
+
exports.writeDotEnv = writeDotEnv;
|
|
39164
|
+
|
|
39165
|
+
/***/ }),
|
|
39166
|
+
|
|
38864
39167
|
/***/ 2644:
|
|
38865
39168
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
38866
39169
|
|
|
@@ -40281,7 +40584,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
40281
40584
|
|
|
40282
40585
|
exports.__esModule = true;
|
|
40283
40586
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
40284
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
40587
|
+
exports.PIPELINE_IMAGE_TAG = "main-722844ec" || 0;
|
|
40285
40588
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
40286
40589
|
|
|
40287
40590
|
/***/ }),
|
|
@@ -350148,6 +350148,7 @@ var utils_1 = __nccwpck_require__(37461);
|
|
|
350148
350148
|
var yarn_1 = __nccwpck_require__(10464);
|
|
350149
350149
|
var constants_1 = __nccwpck_require__(11542);
|
|
350150
350150
|
var writeBuildInfo_1 = __nccwpck_require__(51754);
|
|
350151
|
+
var writeDotEnv_1 = __nccwpck_require__(71298);
|
|
350151
350152
|
var createBuildJob = function (context, _a) {
|
|
350152
350153
|
var _b, _c, _d, _e;
|
|
350153
350154
|
var script = _a.script,
|
|
@@ -350161,7 +350162,7 @@ var createBuildJob = function (context, _a) {
|
|
|
350161
350162
|
needs: [],
|
|
350162
350163
|
cache: [],
|
|
350163
350164
|
variables: __assign(__assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
350164
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
|
|
350165
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(context.componentConfig.dotEnv ? (0, writeDotEnv_1.writeDotEnv)(context) : []), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
|
|
350165
350166
|
artifacts: {
|
|
350166
350167
|
paths: [(0, path_1.join)(context.componentConfig.dir, "__build_info.json")],
|
|
350167
350168
|
reports: {
|
|
@@ -350192,6 +350193,56 @@ exports.writeBuildInfo = writeBuildInfo;
|
|
|
350192
350193
|
|
|
350193
350194
|
/***/ }),
|
|
350194
350195
|
|
|
350196
|
+
/***/ 71298:
|
|
350197
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
350198
|
+
|
|
350199
|
+
"use strict";
|
|
350200
|
+
|
|
350201
|
+
|
|
350202
|
+
var __read = this && this.__read || function (o, n) {
|
|
350203
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
350204
|
+
if (!m) return o;
|
|
350205
|
+
var i = m.call(o),
|
|
350206
|
+
r,
|
|
350207
|
+
ar = [],
|
|
350208
|
+
e;
|
|
350209
|
+
try {
|
|
350210
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
350211
|
+
} catch (error) {
|
|
350212
|
+
e = {
|
|
350213
|
+
error: error
|
|
350214
|
+
};
|
|
350215
|
+
} finally {
|
|
350216
|
+
try {
|
|
350217
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
350218
|
+
} finally {
|
|
350219
|
+
if (e) throw e.error;
|
|
350220
|
+
}
|
|
350221
|
+
}
|
|
350222
|
+
return ar;
|
|
350223
|
+
};
|
|
350224
|
+
exports.__esModule = true;
|
|
350225
|
+
exports.writeDotEnv = void 0;
|
|
350226
|
+
/**
|
|
350227
|
+
* writes a .env file in the components folder
|
|
350228
|
+
* @param context
|
|
350229
|
+
* @returns
|
|
350230
|
+
*/
|
|
350231
|
+
var writeDotEnv = function (context) {
|
|
350232
|
+
var envVars = context.environment.envVars;
|
|
350233
|
+
// make key=value and sanitize multiline
|
|
350234
|
+
var keyValueString = Object.entries(envVars).map(function (_a) {
|
|
350235
|
+
var _b = __read(_a, 2),
|
|
350236
|
+
key = _b[0],
|
|
350237
|
+
value = _b[1];
|
|
350238
|
+
return "".concat(key, "=").concat(value.replaceAll("\n", "\\n"));
|
|
350239
|
+
}).join("\n");
|
|
350240
|
+
return ["cat <<EOF > ".concat(context.componentConfig.dir, "/.env\n").concat(keyValueString, "\nEOF")];
|
|
350241
|
+
};
|
|
350242
|
+
exports.writeDotEnv = writeDotEnv;
|
|
350243
|
+
|
|
350244
|
+
/***/ }),
|
|
350245
|
+
|
|
350195
350246
|
/***/ 62644:
|
|
350196
350247
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
350197
350248
|
|
|
@@ -351612,7 +351663,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
351612
351663
|
|
|
351613
351664
|
exports.__esModule = true;
|
|
351614
351665
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
351615
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
351666
|
+
exports.PIPELINE_IMAGE_TAG = "main-722844ec" || 0;
|
|
351616
351667
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
351617
351668
|
|
|
351618
351669
|
/***/ }),
|