@catladder/pipeline 1.102.0 → 1.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,6 +58,7 @@ var utils_1 = require("../../utils");
58
58
  var yarn_1 = require("../node/yarn");
59
59
  var constants_1 = require("./constants");
60
60
  var writeBuildInfo_1 = require("./writeBuildInfo");
61
+ var writeDotEnv_1 = require("./writeDotEnv");
61
62
  var createBuildJob = function (context, _a) {
62
63
  var _b, _c, _d, _e;
63
64
  var script = _a.script,
@@ -71,7 +72,7 @@ var createBuildJob = function (context, _a) {
71
72
  needs: [],
72
73
  cache: [],
73
74
  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 : {}),
74
- 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),
75
+ 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),
75
76
  artifacts: {
76
77
  paths: [(0, path_1.join)(context.componentConfig.dir, "__build_info.json")],
77
78
  reports: {
@@ -0,0 +1,7 @@
1
+ import type { Context } from "../../types";
2
+ /**
3
+ * writes a .env file in the components folder
4
+ * @param context
5
+ * @returns
6
+ */
7
+ export declare const writeDotEnv: (context: Context) => string[];
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var __read = this && this.__read || function (o, n) {
4
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
5
+ if (!m) return o;
6
+ var i = m.call(o),
7
+ r,
8
+ ar = [],
9
+ e;
10
+ try {
11
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
12
+ } catch (error) {
13
+ e = {
14
+ error: error
15
+ };
16
+ } finally {
17
+ try {
18
+ if (r && !r.done && (m = i["return"])) m.call(i);
19
+ } finally {
20
+ if (e) throw e.error;
21
+ }
22
+ }
23
+ return ar;
24
+ };
25
+ exports.__esModule = true;
26
+ exports.writeDotEnv = void 0;
27
+ /**
28
+ * writes a .env file in the components folder
29
+ * @param context
30
+ * @returns
31
+ */
32
+ var writeDotEnv = function (context) {
33
+ var envVars = context.environment.envVars;
34
+ // make key=value and sanitize multiline
35
+ var keyValueString = Object.entries(envVars).map(function (_a) {
36
+ var _b = __read(_a, 2),
37
+ key = _b[0],
38
+ value = _b[1];
39
+ return "".concat(key, "=").concat(value.replaceAll("\n", "\\n"));
40
+ }).join("\n");
41
+ return ["cat <<EOF > ".concat(context.componentConfig.dir, "/.env\n").concat(keyValueString, "\nEOF")];
42
+ };
43
+ exports.writeDotEnv = writeDotEnv;