@catladder/cli 0.0.0-main-722844ec → 0.0.0-main-e234c71e
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.js +4 -0
- package/dist/apps/catenv/catenv.js.map +1 -1
- package/dist/apps/catenv/writeEnvDTs.d.ts +3 -0
- package/dist/apps/catenv/writeEnvDTs.js +114 -0
- package/dist/apps/catenv/writeEnvDTs.js.map +1 -0
- package/dist/bundles/catenv/index.js +126 -1
- package/dist/bundles/cli/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/apps/catenv/catenv.ts +3 -0
- package/src/apps/catenv/writeEnvDTs.ts +71 -0
|
@@ -39,6 +39,7 @@ exports.__esModule = true;
|
|
|
39
39
|
var getProjectConfig_1 = require("../../config/getProjectConfig");
|
|
40
40
|
var printVariables_1 = require("./printVariables");
|
|
41
41
|
var writeDotEnvFiles_1 = require("./writeDotEnvFiles");
|
|
42
|
+
var writeEnvDTs_1 = require("./writeEnvDTs");
|
|
42
43
|
exports["default"] = (function (choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
44
|
var config;
|
|
44
45
|
return __generator(this, function (_a) {
|
|
@@ -54,6 +55,9 @@ exports["default"] = (function (choice) { return __awaiter(void 0, void 0, void
|
|
|
54
55
|
_a.sent();
|
|
55
56
|
return [4 /*yield*/, (0, writeDotEnvFiles_1.writeDotEnvFiles)(config, choice)];
|
|
56
57
|
case 3:
|
|
58
|
+
_a.sent();
|
|
59
|
+
return [4 /*yield*/, (0, writeEnvDTs_1.writeDTsFiles)(config, choice)];
|
|
60
|
+
case 4:
|
|
57
61
|
_a.sent();
|
|
58
62
|
return [2 /*return*/];
|
|
59
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catenv.js","sourceRoot":"","sources":["../../../src/apps/catenv/catenv.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAiE;AACjE,mDAAkD;AAElD,uDAAsD;
|
|
1
|
+
{"version":3,"file":"catenv.js","sourceRoot":"","sources":["../../../src/apps/catenv/catenv.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAiE;AACjE,mDAAkD;AAElD,uDAAsD;AACtD,6CAA8C;AAE9C,sBAAe,UAAO,MAAe;;;;oBACpB,qBAAM,IAAA,mCAAgB,GAAE,EAAA;;gBAAjC,MAAM,GAAG,SAAwB;gBACvC,IAAI,CAAC,MAAM,EAAE;oBACX,sBAAO;iBACR;gBAED,qBAAM,IAAA,+BAAc,EAAC,MAAM,EAAE,MAAM,CAAC,EAAA;;gBAApC,SAAoC,CAAC;gBAErC,qBAAM,IAAA,mCAAgB,EAAC,MAAM,EAAE,MAAM,CAAC,EAAA;;gBAAtC,SAAsC,CAAC;gBAEvC,qBAAM,IAAA,2BAAa,EAAC,MAAM,EAAE,MAAM,CAAC,EAAA;;gBAAnC,SAAmC,CAAC;;;;KACrC,EAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.__esModule = true;
|
|
39
|
+
exports.writeDTsFiles = void 0;
|
|
40
|
+
var fs_extra_1 = require("fs-extra");
|
|
41
|
+
var path_1 = require("path");
|
|
42
|
+
var getProjectConfig_1 = require("../../config/getProjectConfig");
|
|
43
|
+
var projects_1 = require("../../utils/projects");
|
|
44
|
+
var utils_1 = require("./utils");
|
|
45
|
+
var writeDTsFiles = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
+
var _a, env, currentComponent, componentsWithEnabledEnvDTsWrite, componentsToActuallyWriteDotEnvNow, gitRoot, _i, componentsToActuallyWriteDotEnvNow_1, componentName, envNames, envDTsContent, componentDir, filePath;
|
|
47
|
+
return __generator(this, function (_b) {
|
|
48
|
+
switch (_b.label) {
|
|
49
|
+
case 0: return [4 /*yield*/, (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice)];
|
|
50
|
+
case 1:
|
|
51
|
+
_a = _b.sent(), env = _a.env, currentComponent = _a.currentComponent;
|
|
52
|
+
componentsWithEnabledEnvDTsWrite = Object.entries(config.components)
|
|
53
|
+
.filter(function (_a) {
|
|
54
|
+
var component = _a[1];
|
|
55
|
+
return component === null || component === void 0 ? void 0 : component.envDTs;
|
|
56
|
+
})
|
|
57
|
+
.map(function (_a) {
|
|
58
|
+
var componentName = _a[0];
|
|
59
|
+
return componentName;
|
|
60
|
+
});
|
|
61
|
+
componentsToActuallyWriteDotEnvNow = currentComponent
|
|
62
|
+
? componentsWithEnabledEnvDTsWrite.includes(currentComponent)
|
|
63
|
+
? [currentComponent]
|
|
64
|
+
: []
|
|
65
|
+
: componentsWithEnabledEnvDTsWrite;
|
|
66
|
+
return [4 /*yield*/, (0, projects_1.getGitRoot)()];
|
|
67
|
+
case 2:
|
|
68
|
+
gitRoot = _b.sent();
|
|
69
|
+
_i = 0, componentsToActuallyWriteDotEnvNow_1 = componentsToActuallyWriteDotEnvNow;
|
|
70
|
+
_b.label = 3;
|
|
71
|
+
case 3:
|
|
72
|
+
if (!(_i < componentsToActuallyWriteDotEnvNow_1.length)) return [3 /*break*/, 7];
|
|
73
|
+
componentName = componentsToActuallyWriteDotEnvNow_1[_i];
|
|
74
|
+
return [4 /*yield*/, getEnvsForDTs(env, componentName)];
|
|
75
|
+
case 4:
|
|
76
|
+
envNames = _b.sent();
|
|
77
|
+
envDTsContent = createEnvDTsContent(envNames);
|
|
78
|
+
componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
|
|
79
|
+
filePath = (0, path_1.join)(componentDir, "env.d.ts");
|
|
80
|
+
return [4 /*yield*/, (0, fs_extra_1.writeFile)(filePath, envDTsContent)];
|
|
81
|
+
case 5:
|
|
82
|
+
_b.sent();
|
|
83
|
+
_b.label = 6;
|
|
84
|
+
case 6:
|
|
85
|
+
_i++;
|
|
86
|
+
return [3 /*break*/, 3];
|
|
87
|
+
case 7: return [2 /*return*/];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}); };
|
|
91
|
+
exports.writeDTsFiles = writeDTsFiles;
|
|
92
|
+
function getEnvsForDTs(env, componentName) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
var environment, allEnvKeys, hiddenEnvKeys, dTsEnvKeys;
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
switch (_a.label) {
|
|
97
|
+
case 0: return [4 /*yield*/, (0, getProjectConfig_1.getEnvironment)(env, componentName)];
|
|
98
|
+
case 1:
|
|
99
|
+
environment = _a.sent();
|
|
100
|
+
allEnvKeys = Object.keys(environment.envVars);
|
|
101
|
+
hiddenEnvKeys = new Set(environment.secretEnvVarKeys
|
|
102
|
+
.filter(function (s) { return s.hidden; })
|
|
103
|
+
.map(function (s) { return s.key; })
|
|
104
|
+
.concat(["_ALL_ENV_VAR_KEYS"]));
|
|
105
|
+
dTsEnvKeys = allEnvKeys.filter(function (k) { return !hiddenEnvKeys.has(k); });
|
|
106
|
+
return [2 /*return*/, dTsEnvKeys];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function createEnvDTsContent(envNames) {
|
|
112
|
+
return "/* tslint:disable prettier/prettier */\n/* eslint-disable prettier/prettier */\n/* prettier-ignore */\n// automatically generated by catladder. Do not modify!\nexport {}\n\ndeclare global {\n namespace NodeJS {\n interface ProcessEnv {\n".concat(envNames.map(function (name) { return " ".concat(name, ": string"); }).join("\n"), "\n }\n }\n}\n");
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=writeEnvDTs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeEnvDTs.js","sourceRoot":"","sources":["../../../src/apps/catenv/writeEnvDTs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAqC;AACrC,6BAA4B;AAC5B,kEAA+D;AAC/D,iDAAkD;AAElD,iCAGiB;AAEV,IAAM,aAAa,GAAG,UAAO,MAAc,EAAE,MAAe;;;;oBAC/B,qBAAM,IAAA,2CAAmC,EACzE,MAAM,EACN,MAAM,CACP,EAAA;;gBAHK,KAA4B,SAGjC,EAHO,GAAG,SAAA,EAAE,gBAAgB,sBAAA;gBAKvB,gCAAgC,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;qBACvE,MAAM,CAAC,UAAC,EAAa;wBAAV,SAAS,QAAA;oBAAM,OAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM;gBAAjB,CAAiB,CAAC;qBAC5C,GAAG,CAAC,UAAC,EAAe;wBAAd,aAAa,QAAA;oBAAM,OAAA,aAAa;gBAAb,CAAa,CAAC,CAAC;gBAErC,kCAAkC,GAAG,gBAAgB;oBACzD,CAAC,CAAC,gCAAgC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;wBAC3D,CAAC,CAAC,CAAC,gBAAgB,CAAC;wBACpB,CAAC,CAAC,EAAE;oBACN,CAAC,CAAC,gCAAgC,CAAC;gBACrB,qBAAM,IAAA,qBAAU,GAAE,EAAA;;gBAA5B,OAAO,GAAG,SAAkB;sBAE4B,EAAlC,yEAAkC;;;qBAAlC,CAAA,gDAAkC,CAAA;gBAAnD,aAAa;gBACL,qBAAM,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC,EAAA;;gBAAlD,QAAQ,GAAG,SAAuC;gBAClD,aAAa,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;gBAE9C,YAAY,GAAG,IAAA,4BAAoB,EAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;gBACpE,QAAQ,GAAG,IAAA,WAAI,EAAC,YAAY,EAAE,UAAU,CAAC,CAAC;gBAChD,qBAAM,IAAA,oBAAS,EAAC,QAAQ,EAAE,aAAa,CAAC,EAAA;;gBAAxC,SAAwC,CAAC;;;gBANf,IAAkC,CAAA;;;;;KAQ/D,CAAC;AAzBW,QAAA,aAAa,iBAyBxB;AAEF,SAAe,aAAa,CAC1B,GAAW,EACX,aAAqB;;;;;wBAED,qBAAM,IAAA,iCAAc,EAAC,GAAG,EAAE,aAAa,CAAC,EAAA;;oBAAtD,WAAW,GAAG,SAAwC;oBACtD,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;oBAC9C,aAAa,GAAG,IAAI,GAAG,CAC3B,WAAW,CAAC,gBAAgB;yBACzB,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,MAAM,EAAR,CAAQ,CAAC;yBACvB,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC;yBACjB,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC,CACjC,CAAC;oBACI,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAArB,CAAqB,CAAC,CAAC;oBAEnE,sBAAO,UAAU,EAAC;;;;CACnB;AAED,SAAS,mBAAmB,CAAC,QAAkB;IAC7C,OAAO,2PASP,QAAQ,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,gBAAS,IAAI,aAAU,EAAvB,CAAuB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,sBAI3D,CAAC;AACF,CAAC"}
|
|
@@ -46,6 +46,7 @@ exports.__esModule = true;
|
|
|
46
46
|
var getProjectConfig_1 = __nccwpck_require__(4146);
|
|
47
47
|
var printVariables_1 = __nccwpck_require__(7770);
|
|
48
48
|
var writeDotEnvFiles_1 = __nccwpck_require__(4295);
|
|
49
|
+
var writeEnvDTs_1 = __nccwpck_require__(4615);
|
|
49
50
|
exports["default"] = (function (choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
51
|
var config;
|
|
51
52
|
return __generator(this, function (_a) {
|
|
@@ -61,6 +62,9 @@ exports["default"] = (function (choice) { return __awaiter(void 0, void 0, void
|
|
|
61
62
|
_a.sent();
|
|
62
63
|
return [4 /*yield*/, (0, writeDotEnvFiles_1.writeDotEnvFiles)(config, choice)];
|
|
63
64
|
case 3:
|
|
65
|
+
_a.sent();
|
|
66
|
+
return [4 /*yield*/, (0, writeEnvDTs_1.writeDTsFiles)(config, choice)];
|
|
67
|
+
case 4:
|
|
64
68
|
_a.sent();
|
|
65
69
|
return [2 /*return*/];
|
|
66
70
|
}
|
|
@@ -403,6 +407,127 @@ exports.writeDotEnvFiles = writeDotEnvFiles;
|
|
|
403
407
|
|
|
404
408
|
/***/ }),
|
|
405
409
|
|
|
410
|
+
/***/ 4615:
|
|
411
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
412
|
+
|
|
413
|
+
"use strict";
|
|
414
|
+
|
|
415
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
416
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
417
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
418
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
419
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
420
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
421
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
425
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
426
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
427
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
428
|
+
function step(op) {
|
|
429
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
430
|
+
while (_) try {
|
|
431
|
+
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;
|
|
432
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
433
|
+
switch (op[0]) {
|
|
434
|
+
case 0: case 1: t = op; break;
|
|
435
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
436
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
437
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
438
|
+
default:
|
|
439
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
440
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
441
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
442
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
443
|
+
if (t[2]) _.ops.pop();
|
|
444
|
+
_.trys.pop(); continue;
|
|
445
|
+
}
|
|
446
|
+
op = body.call(thisArg, _);
|
|
447
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
448
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
exports.__esModule = true;
|
|
452
|
+
exports.writeDTsFiles = void 0;
|
|
453
|
+
var fs_extra_1 = __nccwpck_require__(5501);
|
|
454
|
+
var path_1 = __nccwpck_require__(1017);
|
|
455
|
+
var getProjectConfig_1 = __nccwpck_require__(4146);
|
|
456
|
+
var projects_1 = __nccwpck_require__(1619);
|
|
457
|
+
var utils_1 = __nccwpck_require__(4640);
|
|
458
|
+
var writeDTsFiles = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
459
|
+
var _a, env, currentComponent, componentsWithEnabledEnvDTsWrite, componentsToActuallyWriteDotEnvNow, gitRoot, _i, componentsToActuallyWriteDotEnvNow_1, componentName, envNames, envDTsContent, componentDir, filePath;
|
|
460
|
+
return __generator(this, function (_b) {
|
|
461
|
+
switch (_b.label) {
|
|
462
|
+
case 0: return [4 /*yield*/, (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice)];
|
|
463
|
+
case 1:
|
|
464
|
+
_a = _b.sent(), env = _a.env, currentComponent = _a.currentComponent;
|
|
465
|
+
componentsWithEnabledEnvDTsWrite = Object.entries(config.components)
|
|
466
|
+
.filter(function (_a) {
|
|
467
|
+
var component = _a[1];
|
|
468
|
+
return component === null || component === void 0 ? void 0 : component.envDTs;
|
|
469
|
+
})
|
|
470
|
+
.map(function (_a) {
|
|
471
|
+
var componentName = _a[0];
|
|
472
|
+
return componentName;
|
|
473
|
+
});
|
|
474
|
+
componentsToActuallyWriteDotEnvNow = currentComponent
|
|
475
|
+
? componentsWithEnabledEnvDTsWrite.includes(currentComponent)
|
|
476
|
+
? [currentComponent]
|
|
477
|
+
: []
|
|
478
|
+
: componentsWithEnabledEnvDTsWrite;
|
|
479
|
+
return [4 /*yield*/, (0, projects_1.getGitRoot)()];
|
|
480
|
+
case 2:
|
|
481
|
+
gitRoot = _b.sent();
|
|
482
|
+
_i = 0, componentsToActuallyWriteDotEnvNow_1 = componentsToActuallyWriteDotEnvNow;
|
|
483
|
+
_b.label = 3;
|
|
484
|
+
case 3:
|
|
485
|
+
if (!(_i < componentsToActuallyWriteDotEnvNow_1.length)) return [3 /*break*/, 7];
|
|
486
|
+
componentName = componentsToActuallyWriteDotEnvNow_1[_i];
|
|
487
|
+
return [4 /*yield*/, getEnvsForDTs(env, componentName)];
|
|
488
|
+
case 4:
|
|
489
|
+
envNames = _b.sent();
|
|
490
|
+
envDTsContent = createEnvDTsContent(envNames);
|
|
491
|
+
componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
|
|
492
|
+
filePath = (0, path_1.join)(componentDir, "env.d.ts");
|
|
493
|
+
return [4 /*yield*/, (0, fs_extra_1.writeFile)(filePath, envDTsContent)];
|
|
494
|
+
case 5:
|
|
495
|
+
_b.sent();
|
|
496
|
+
_b.label = 6;
|
|
497
|
+
case 6:
|
|
498
|
+
_i++;
|
|
499
|
+
return [3 /*break*/, 3];
|
|
500
|
+
case 7: return [2 /*return*/];
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}); };
|
|
504
|
+
exports.writeDTsFiles = writeDTsFiles;
|
|
505
|
+
function getEnvsForDTs(env, componentName) {
|
|
506
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
507
|
+
var environment, allEnvKeys, hiddenEnvKeys, dTsEnvKeys;
|
|
508
|
+
return __generator(this, function (_a) {
|
|
509
|
+
switch (_a.label) {
|
|
510
|
+
case 0: return [4 /*yield*/, (0, getProjectConfig_1.getEnvironment)(env, componentName)];
|
|
511
|
+
case 1:
|
|
512
|
+
environment = _a.sent();
|
|
513
|
+
allEnvKeys = Object.keys(environment.envVars);
|
|
514
|
+
hiddenEnvKeys = new Set(environment.secretEnvVarKeys
|
|
515
|
+
.filter(function (s) { return s.hidden; })
|
|
516
|
+
.map(function (s) { return s.key; })
|
|
517
|
+
.concat(["_ALL_ENV_VAR_KEYS"]));
|
|
518
|
+
dTsEnvKeys = allEnvKeys.filter(function (k) { return !hiddenEnvKeys.has(k); });
|
|
519
|
+
return [2 /*return*/, dTsEnvKeys];
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
function createEnvDTsContent(envNames) {
|
|
525
|
+
return "/* tslint:disable prettier/prettier */\n/* eslint-disable prettier/prettier */\n/* prettier-ignore */\n// automatically generated by catladder. Do not modify!\nexport {}\n\ndeclare global {\n namespace NodeJS {\n interface ProcessEnv {\n".concat(envNames.map(function (name) { return " ".concat(name, ": string"); }).join("\n"), "\n }\n }\n}\n");
|
|
526
|
+
}
|
|
527
|
+
//# sourceMappingURL=writeEnvDTs.js.map
|
|
528
|
+
|
|
529
|
+
/***/ }),
|
|
530
|
+
|
|
406
531
|
/***/ 820:
|
|
407
532
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
408
533
|
|
|
@@ -40584,7 +40709,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
40584
40709
|
|
|
40585
40710
|
exports.__esModule = true;
|
|
40586
40711
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
40587
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
40712
|
+
exports.PIPELINE_IMAGE_TAG = "main-e234c71e" || 0;
|
|
40588
40713
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
40589
40714
|
|
|
40590
40715
|
/***/ }),
|
|
@@ -351663,7 +351663,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
351663
351663
|
|
|
351664
351664
|
exports.__esModule = true;
|
|
351665
351665
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
351666
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
351666
|
+
exports.PIPELINE_IMAGE_TAG = "main-e234c71e" || 0;
|
|
351667
351667
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
351668
351668
|
|
|
351669
351669
|
/***/ }),
|