@expo/steps 1.0.265 → 18.0.1

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.
Files changed (191) hide show
  1. package/LICENSE +21 -100
  2. package/README.md +1 -1
  3. package/{dist_commonjs → dist}/AbstractConfigParser.d.ts +5 -5
  4. package/{dist_commonjs/AbstractConfigParser.cjs → dist/AbstractConfigParser.js} +22 -20
  5. package/{dist_commonjs → dist}/BuildConfig.d.ts +3 -3
  6. package/{dist_commonjs/BuildConfig.cjs → dist/BuildConfig.js} +29 -32
  7. package/{dist_esm → dist}/BuildConfigParser.d.ts +5 -5
  8. package/{dist_commonjs/BuildConfigParser.cjs → dist/BuildConfigParser.js} +40 -48
  9. package/{dist_esm → dist}/BuildFunction.d.ts +6 -6
  10. package/{dist_commonjs/BuildFunction.cjs → dist/BuildFunction.js} +23 -13
  11. package/{dist_commonjs → dist}/BuildFunctionGroup.d.ts +4 -4
  12. package/{dist_commonjs/BuildFunctionGroup.cjs → dist/BuildFunctionGroup.js} +9 -7
  13. package/{dist_commonjs/BuildRuntimePlatform.cjs → dist/BuildRuntimePlatform.js} +0 -1
  14. package/{dist_esm → dist}/BuildStep.d.ts +5 -5
  15. package/{dist_commonjs/BuildStep.cjs → dist/BuildStep.js} +66 -46
  16. package/{dist_commonjs → dist}/BuildStepContext.d.ts +4 -4
  17. package/{dist_commonjs/BuildStepContext.cjs → dist/BuildStepContext.js} +28 -22
  18. package/{dist_commonjs/StepMetrics.cjs → dist/BuildStepEnv.js} +0 -1
  19. package/{dist_esm → dist}/BuildStepInput.d.ts +1 -1
  20. package/{dist_commonjs/BuildStepInput.cjs → dist/BuildStepInput.js} +23 -19
  21. package/{dist_commonjs → dist}/BuildStepOutput.d.ts +1 -1
  22. package/{dist_commonjs/BuildStepOutput.cjs → dist/BuildStepOutput.js} +9 -7
  23. package/{dist_commonjs → dist}/BuildTemporaryFiles.d.ts +1 -1
  24. package/{dist_commonjs/BuildTemporaryFiles.cjs → dist/BuildTemporaryFiles.js} +1 -2
  25. package/{dist_commonjs → dist}/BuildWorkflow.d.ts +3 -3
  26. package/{dist_commonjs/BuildWorkflow.cjs → dist/BuildWorkflow.js} +5 -3
  27. package/{dist_commonjs → dist}/BuildWorkflowValidator.d.ts +1 -1
  28. package/{dist_commonjs/BuildWorkflowValidator.cjs → dist/BuildWorkflowValidator.js} +25 -26
  29. package/{dist_commonjs/BuildStepEnv.cjs → dist/StepMetrics.js} +0 -1
  30. package/{dist_commonjs → dist}/StepsConfigParser.d.ts +5 -5
  31. package/{dist_commonjs/StepsConfigParser.cjs → dist/StepsConfigParser.js} +21 -25
  32. package/{dist_esm → dist}/cli/cli.d.ts +3 -3
  33. package/{dist_commonjs/cli/cli.cjs → dist/cli/cli.js} +17 -12
  34. package/{dist_commonjs/errors.cjs → dist/errors.js} +7 -4
  35. package/dist/index.d.ts +19 -0
  36. package/dist/index.js +69 -0
  37. package/{dist_commonjs/interpolation.cjs → dist/interpolation.js} +4 -5
  38. package/{dist_commonjs/scripts/runCustomFunction.cjs → dist/scripts/runCustomFunction.js} +10 -11
  39. package/{dist_commonjs → dist}/utils/customFunction.d.ts +4 -4
  40. package/{dist_commonjs/utils/customFunction.cjs → dist/utils/customFunction.js} +5 -8
  41. package/{dist_commonjs/utils/expodash/duplicates.cjs → dist/utils/expodash/duplicates.js} +0 -1
  42. package/{dist_commonjs/utils/expodash/uniq.cjs → dist/utils/expodash/uniq.js} +0 -1
  43. package/{dist_commonjs/utils/hashFiles.cjs → dist/utils/hashFiles.js} +1 -2
  44. package/{dist_commonjs/utils/jsepEval.cjs → dist/utils/jsepEval.js} +4 -5
  45. package/{dist_commonjs/utils/nullthrows.cjs → dist/utils/nullthrows.js} +1 -2
  46. package/{dist_commonjs/utils/shell/bin.cjs → dist/utils/shell/bin.js} +1 -4
  47. package/{dist_commonjs/utils/shell/command.cjs → dist/utils/shell/command.js} +0 -1
  48. package/{dist_commonjs → dist}/utils/shell/spawn.d.ts +2 -2
  49. package/{dist_commonjs/utils/shell/spawn.cjs → dist/utils/shell/spawn.js} +0 -1
  50. package/{dist_commonjs/utils/template.cjs → dist/utils/template.js} +10 -11
  51. package/package.json +29 -44
  52. package/dist_commonjs/AbstractConfigParser.js.map +0 -1
  53. package/dist_commonjs/BuildConfig.js.map +0 -1
  54. package/dist_commonjs/BuildConfigParser.d.ts +0 -33
  55. package/dist_commonjs/BuildConfigParser.js.map +0 -1
  56. package/dist_commonjs/BuildFunction.d.ts +0 -45
  57. package/dist_commonjs/BuildFunction.js.map +0 -1
  58. package/dist_commonjs/BuildFunctionGroup.js.map +0 -1
  59. package/dist_commonjs/BuildRuntimePlatform.js.map +0 -1
  60. package/dist_commonjs/BuildStep.d.ts +0 -100
  61. package/dist_commonjs/BuildStep.js.map +0 -1
  62. package/dist_commonjs/BuildStepContext.js.map +0 -1
  63. package/dist_commonjs/BuildStepEnv.js.map +0 -1
  64. package/dist_commonjs/BuildStepInput.d.ts +0 -47
  65. package/dist_commonjs/BuildStepInput.js.map +0 -1
  66. package/dist_commonjs/BuildStepOutput.js.map +0 -1
  67. package/dist_commonjs/BuildTemporaryFiles.js.map +0 -1
  68. package/dist_commonjs/BuildWorkflow.js.map +0 -1
  69. package/dist_commonjs/BuildWorkflowValidator.js.map +0 -1
  70. package/dist_commonjs/StepMetrics.js.map +0 -1
  71. package/dist_commonjs/StepsConfigParser.js.map +0 -1
  72. package/dist_commonjs/cli/cli.d.ts +0 -18
  73. package/dist_commonjs/cli/cli.js.map +0 -1
  74. package/dist_commonjs/errors.js.map +0 -1
  75. package/dist_commonjs/index.cjs +0 -60
  76. package/dist_commonjs/index.d.ts +0 -19
  77. package/dist_commonjs/index.js.map +0 -1
  78. package/dist_commonjs/interpolation.js.map +0 -1
  79. package/dist_commonjs/scripts/runCustomFunction.js.map +0 -1
  80. package/dist_commonjs/utils/customFunction.js.map +0 -1
  81. package/dist_commonjs/utils/expodash/duplicates.js.map +0 -1
  82. package/dist_commonjs/utils/expodash/uniq.js.map +0 -1
  83. package/dist_commonjs/utils/hashFiles.js.map +0 -1
  84. package/dist_commonjs/utils/jsepEval.js.map +0 -1
  85. package/dist_commonjs/utils/nullthrows.js.map +0 -1
  86. package/dist_commonjs/utils/shell/bin.js.map +0 -1
  87. package/dist_commonjs/utils/shell/command.js.map +0 -1
  88. package/dist_commonjs/utils/shell/spawn.js.map +0 -1
  89. package/dist_commonjs/utils/template.js.map +0 -1
  90. package/dist_esm/AbstractConfigParser.d.ts +0 -23
  91. package/dist_esm/AbstractConfigParser.js +0 -61
  92. package/dist_esm/AbstractConfigParser.js.map +0 -1
  93. package/dist_esm/BuildConfig.d.ts +0 -80
  94. package/dist_esm/BuildConfig.js +0 -281
  95. package/dist_esm/BuildConfig.js.map +0 -1
  96. package/dist_esm/BuildConfigParser.js +0 -233
  97. package/dist_esm/BuildConfigParser.js.map +0 -1
  98. package/dist_esm/BuildFunction.js +0 -62
  99. package/dist_esm/BuildFunction.js.map +0 -1
  100. package/dist_esm/BuildFunctionGroup.d.ts +0 -23
  101. package/dist_esm/BuildFunctionGroup.js +0 -36
  102. package/dist_esm/BuildFunctionGroup.js.map +0 -1
  103. package/dist_esm/BuildRuntimePlatform.d.ts +0 -4
  104. package/dist_esm/BuildRuntimePlatform.js +0 -6
  105. package/dist_esm/BuildRuntimePlatform.js.map +0 -1
  106. package/dist_esm/BuildStep.js +0 -354
  107. package/dist_esm/BuildStep.js.map +0 -1
  108. package/dist_esm/BuildStepContext.d.ts +0 -86
  109. package/dist_esm/BuildStepContext.js +0 -207
  110. package/dist_esm/BuildStepContext.js.map +0 -1
  111. package/dist_esm/BuildStepEnv.d.ts +0 -1
  112. package/dist_esm/BuildStepEnv.js +0 -2
  113. package/dist_esm/BuildStepEnv.js.map +0 -1
  114. package/dist_esm/BuildStepInput.js +0 -150
  115. package/dist_esm/BuildStepInput.js.map +0 -1
  116. package/dist_esm/BuildStepOutput.d.ts +0 -33
  117. package/dist_esm/BuildStepOutput.js +0 -57
  118. package/dist_esm/BuildStepOutput.js.map +0 -1
  119. package/dist_esm/BuildTemporaryFiles.d.ts +0 -5
  120. package/dist_esm/BuildTemporaryFiles.js +0 -31
  121. package/dist_esm/BuildTemporaryFiles.js.map +0 -1
  122. package/dist_esm/BuildWorkflow.d.ts +0 -14
  123. package/dist_esm/BuildWorkflow.js +0 -55
  124. package/dist_esm/BuildWorkflow.js.map +0 -1
  125. package/dist_esm/BuildWorkflowValidator.d.ts +0 -10
  126. package/dist_esm/BuildWorkflowValidator.js +0 -121
  127. package/dist_esm/BuildWorkflowValidator.js.map +0 -1
  128. package/dist_esm/StepMetrics.d.ts +0 -10
  129. package/dist_esm/StepMetrics.js +0 -2
  130. package/dist_esm/StepMetrics.js.map +0 -1
  131. package/dist_esm/StepsConfigParser.d.ts +0 -24
  132. package/dist_esm/StepsConfigParser.js +0 -133
  133. package/dist_esm/StepsConfigParser.js.map +0 -1
  134. package/dist_esm/cli/cli.js +0 -61
  135. package/dist_esm/cli/cli.js.map +0 -1
  136. package/dist_esm/errors.d.ts +0 -24
  137. package/dist_esm/errors.js +0 -24
  138. package/dist_esm/errors.js.map +0 -1
  139. package/dist_esm/index.d.ts +0 -19
  140. package/dist_esm/index.js +0 -18
  141. package/dist_esm/index.js.map +0 -1
  142. package/dist_esm/interpolation.d.ts +0 -5
  143. package/dist_esm/interpolation.js +0 -26
  144. package/dist_esm/interpolation.js.map +0 -1
  145. package/dist_esm/scripts/runCustomFunction.d.ts +0 -1
  146. package/dist_esm/scripts/runCustomFunction.js +0 -100
  147. package/dist_esm/scripts/runCustomFunction.js.map +0 -1
  148. package/dist_esm/utils/customFunction.d.ts +0 -18
  149. package/dist_esm/utils/customFunction.js +0 -49
  150. package/dist_esm/utils/customFunction.js.map +0 -1
  151. package/dist_esm/utils/expodash/duplicates.d.ts +0 -1
  152. package/dist_esm/utils/expodash/duplicates.js +0 -14
  153. package/dist_esm/utils/expodash/duplicates.js.map +0 -1
  154. package/dist_esm/utils/expodash/uniq.d.ts +0 -1
  155. package/dist_esm/utils/expodash/uniq.js +0 -5
  156. package/dist_esm/utils/expodash/uniq.js.map +0 -1
  157. package/dist_esm/utils/hashFiles.d.ts +0 -6
  158. package/dist_esm/utils/hashFiles.js +0 -31
  159. package/dist_esm/utils/hashFiles.js.map +0 -1
  160. package/dist_esm/utils/jsepEval.d.ts +0 -1
  161. package/dist_esm/utils/jsepEval.js +0 -169
  162. package/dist_esm/utils/jsepEval.js.map +0 -1
  163. package/dist_esm/utils/nullthrows.d.ts +0 -1
  164. package/dist_esm/utils/nullthrows.js +0 -7
  165. package/dist_esm/utils/nullthrows.js.map +0 -1
  166. package/dist_esm/utils/shell/bin.d.ts +0 -1
  167. package/dist_esm/utils/shell/bin.js +0 -5
  168. package/dist_esm/utils/shell/bin.js.map +0 -1
  169. package/dist_esm/utils/shell/command.d.ts +0 -4
  170. package/dist_esm/utils/shell/command.js +0 -13
  171. package/dist_esm/utils/shell/command.js.map +0 -1
  172. package/dist_esm/utils/shell/spawn.d.ts +0 -15
  173. package/dist_esm/utils/shell/spawn.js +0 -16
  174. package/dist_esm/utils/shell/spawn.js.map +0 -1
  175. package/dist_esm/utils/template.d.ts +0 -19
  176. package/dist_esm/utils/template.js +0 -106
  177. package/dist_esm/utils/template.js.map +0 -1
  178. /package/{dist_commonjs → dist}/BuildRuntimePlatform.d.ts +0 -0
  179. /package/{dist_commonjs → dist}/BuildStepEnv.d.ts +0 -0
  180. /package/{dist_commonjs → dist}/StepMetrics.d.ts +0 -0
  181. /package/{dist_commonjs → dist}/errors.d.ts +0 -0
  182. /package/{dist_commonjs → dist}/interpolation.d.ts +0 -0
  183. /package/{dist_commonjs → dist}/scripts/runCustomFunction.d.ts +0 -0
  184. /package/{dist_commonjs → dist}/utils/expodash/duplicates.d.ts +0 -0
  185. /package/{dist_commonjs → dist}/utils/expodash/uniq.d.ts +0 -0
  186. /package/{dist_commonjs → dist}/utils/hashFiles.d.ts +0 -0
  187. /package/{dist_commonjs → dist}/utils/jsepEval.d.ts +0 -0
  188. /package/{dist_commonjs → dist}/utils/nullthrows.d.ts +0 -0
  189. /package/{dist_commonjs → dist}/utils/shell/bin.d.ts +0 -0
  190. /package/{dist_commonjs → dist}/utils/shell/command.d.ts +0 -0
  191. /package/{dist_commonjs → dist}/utils/template.d.ts +0 -0
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BuildStepInput = exports.BuildStepInputValueTypeName = void 0;
7
7
  exports.makeBuildStepInputByIdMap = makeBuildStepInputByIdMap;
8
8
  const assert_1 = __importDefault(require("assert"));
9
- const errors_js_1 = require("./errors.cjs");
10
- const template_js_1 = require("./utils/template.cjs");
11
- const interpolation_js_1 = require("./interpolation.cjs");
9
+ const errors_1 = require("./errors");
10
+ const interpolation_1 = require("./interpolation");
11
+ const template_1 = require("./utils/template");
12
12
  var BuildStepInputValueTypeName;
13
13
  (function (BuildStepInputValueTypeName) {
14
14
  BuildStepInputValueTypeName["STRING"] = "string";
@@ -17,6 +17,14 @@ var BuildStepInputValueTypeName;
17
17
  BuildStepInputValueTypeName["JSON"] = "json";
18
18
  })(BuildStepInputValueTypeName || (exports.BuildStepInputValueTypeName = BuildStepInputValueTypeName = {}));
19
19
  class BuildStepInput {
20
+ ctx;
21
+ id;
22
+ stepDisplayName;
23
+ defaultValue;
24
+ allowedValues;
25
+ allowedValueTypeName;
26
+ required;
27
+ _value;
20
28
  static createProvider(params) {
21
29
  return (ctx, stepDisplayName) => new BuildStepInput(ctx, { ...params, stepDisplayName });
22
30
  }
@@ -30,12 +38,11 @@ class BuildStepInput {
30
38
  this.allowedValueTypeName = allowedValueTypeName;
31
39
  }
32
40
  getValue({ interpolationContext, }) {
33
- var _a;
34
- const rawValue = (_a = this._value) !== null && _a !== void 0 ? _a : this.defaultValue;
41
+ const rawValue = this._value ?? this.defaultValue;
35
42
  if (this.required && rawValue === undefined) {
36
- throw new errors_js_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" is required but it was not set.`);
43
+ throw new errors_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" is required but it was not set.`);
37
44
  }
38
- const interpolatedValue = (0, interpolation_js_1.interpolateJobContext)({
45
+ const interpolatedValue = (0, interpolation_1.interpolateJobContext)({
39
46
  target: rawValue,
40
47
  context: interpolationContext,
41
48
  });
@@ -47,7 +54,7 @@ class BuildStepInput {
47
54
  if (valueDoesNotRequireInterpolation) {
48
55
  if (typeof interpolatedValue !== this.allowedValueTypeName &&
49
56
  interpolatedValue !== undefined) {
50
- throw new errors_js_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" must be of type "${this.allowedValueTypeName}".`);
57
+ throw new errors_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" must be of type "${this.allowedValueTypeName}".`);
51
58
  }
52
59
  returnValue = interpolatedValue;
53
60
  }
@@ -56,25 +63,23 @@ class BuildStepInput {
56
63
  // so this will never be true.
57
64
  (0, assert_1.default)(interpolatedValue !== undefined);
58
65
  const valueInterpolatedWithGlobalContext = this.ctx.interpolate(interpolatedValue);
59
- const valueInterpolatedWithOutputsAndGlobalContext = (0, template_js_1.interpolateWithOutputs)(valueInterpolatedWithGlobalContext, (path) => { var _a; return (_a = this.ctx.getStepOutputValue(path)) !== null && _a !== void 0 ? _a : ''; });
66
+ const valueInterpolatedWithOutputsAndGlobalContext = (0, template_1.interpolateWithOutputs)(valueInterpolatedWithGlobalContext, path => this.ctx.getStepOutputValue(path) ?? '');
60
67
  returnValue = this.parseInputValueToAllowedType(valueInterpolatedWithOutputsAndGlobalContext);
61
68
  }
62
69
  return returnValue;
63
70
  }
64
71
  get rawValue() {
65
- var _a;
66
- return (_a = this._value) !== null && _a !== void 0 ? _a : this.defaultValue;
72
+ return this._value ?? this.defaultValue;
67
73
  }
68
74
  set(value) {
69
75
  if (this.required && value === undefined) {
70
- throw new errors_js_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" is required.`);
76
+ throw new errors_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" is required.`);
71
77
  }
72
78
  this._value = value;
73
79
  return this;
74
80
  }
75
81
  isRawValueOneOfAllowedValues() {
76
- var _a;
77
- const value = (_a = this._value) !== null && _a !== void 0 ? _a : this.defaultValue;
82
+ const value = this._value ?? this.defaultValue;
78
83
  if (this.allowedValues === undefined || value === undefined) {
79
84
  return true;
80
85
  }
@@ -82,7 +87,7 @@ class BuildStepInput {
82
87
  }
83
88
  isRawValueStepOrContextReference() {
84
89
  return (typeof this.rawValue === 'string' &&
85
- (!!template_js_1.BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX.exec(this.rawValue) ||
90
+ (!!template_1.BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX.exec(this.rawValue) ||
86
91
  // If value is an interpolation reference we're going to render whatever it evaluates to.
87
92
  // See `interpolateJobContext`.
88
93
  (this.rawValue.startsWith('${{') && this.rawValue.endsWith('}}'))));
@@ -119,7 +124,7 @@ class BuildStepInput {
119
124
  parseInputValueToNumber(value) {
120
125
  const numberValue = Number(value);
121
126
  if (Number.isNaN(numberValue)) {
122
- throw new errors_js_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" must be of type "${this.allowedValueTypeName}".`);
127
+ throw new errors_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" must be of type "${this.allowedValueTypeName}".`);
123
128
  }
124
129
  return numberValue;
125
130
  }
@@ -131,7 +136,7 @@ class BuildStepInput {
131
136
  return false;
132
137
  }
133
138
  else {
134
- throw new errors_js_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" must be of type "${this.allowedValueTypeName}".`);
139
+ throw new errors_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" must be of type "${this.allowedValueTypeName}".`);
135
140
  }
136
141
  }
137
142
  parseInputValueToObject(value) {
@@ -139,7 +144,7 @@ class BuildStepInput {
139
144
  return JSON.parse(value);
140
145
  }
141
146
  catch (e) {
142
- throw new errors_js_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" must be of type "${this.allowedValueTypeName}".`, {
147
+ throw new errors_1.BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" must be of type "${this.allowedValueTypeName}".`, {
143
148
  cause: e,
144
149
  });
145
150
  }
@@ -155,4 +160,3 @@ function makeBuildStepInputByIdMap(inputs) {
155
160
  return acc;
156
161
  }, {});
157
162
  }
158
- //# sourceMappingURL=BuildStepInput.js.map
@@ -1,4 +1,4 @@
1
- import { BuildStepGlobalContext } from './BuildStepContext.js';
1
+ import { BuildStepGlobalContext } from './BuildStepContext';
2
2
  export type BuildStepOutputById = Record<string, BuildStepOutput>;
3
3
  export type BuildStepOutputProvider = (ctx: BuildStepGlobalContext, stepDisplayName: string) => BuildStepOutput;
4
4
  interface BuildStepOutputProviderParams<R extends boolean = boolean> {
@@ -2,14 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BuildStepOutput = void 0;
4
4
  exports.makeBuildStepOutputByIdMap = makeBuildStepOutputByIdMap;
5
- const errors_js_1 = require("./errors.cjs");
5
+ const errors_1 = require("./errors");
6
6
  class BuildStepOutput {
7
+ ctx;
8
+ id;
9
+ stepDisplayName;
10
+ required;
11
+ _value;
7
12
  static createProvider(params) {
8
13
  return (ctx, stepDisplayName) => new BuildStepOutput(ctx, { ...params, stepDisplayName });
9
14
  }
10
- constructor(
11
- // @ts-expect-error ctx is not used in this class but let's keep it here for consistency
12
- ctx, { id, stepDisplayName, required }) {
15
+ constructor(ctx, { id, stepDisplayName, required }) {
13
16
  this.ctx = ctx;
14
17
  this.id = id;
15
18
  this.stepDisplayName = stepDisplayName;
@@ -20,13 +23,13 @@ class BuildStepOutput {
20
23
  }
21
24
  get value() {
22
25
  if (this.required && this._value === undefined) {
23
- throw new errors_js_1.BuildStepRuntimeError(`Output parameter "${this.id}" for step "${this.stepDisplayName}" is required but it was not set.`);
26
+ throw new errors_1.BuildStepRuntimeError(`Output parameter "${this.id}" for step "${this.stepDisplayName}" is required but it was not set.`);
24
27
  }
25
28
  return this._value;
26
29
  }
27
30
  set(value) {
28
31
  if (this.required && value === undefined) {
29
- throw new errors_js_1.BuildStepRuntimeError(`Output parameter "${this.id}" for step "${this.stepDisplayName}" is required.`);
32
+ throw new errors_1.BuildStepRuntimeError(`Output parameter "${this.id}" for step "${this.stepDisplayName}" is required.`);
30
33
  }
31
34
  this._value = value;
32
35
  return this;
@@ -59,4 +62,3 @@ function makeBuildStepOutputByIdMap(outputs) {
59
62
  return acc;
60
63
  }, {});
61
64
  }
62
- //# sourceMappingURL=BuildStepOutput.js.map
@@ -1,4 +1,4 @@
1
- import { BuildStepGlobalContext } from './BuildStepContext.js';
1
+ import { BuildStepGlobalContext } from './BuildStepContext';
2
2
  export declare function saveScriptToTemporaryFileAsync(ctx: BuildStepGlobalContext, stepId: string, scriptContents: string): Promise<string>;
3
3
  export declare function cleanUpStepTemporaryDirectoriesAsync(ctx: BuildStepGlobalContext, stepId: string): Promise<void>;
4
4
  export declare function getTemporaryOutputsDirPath(ctx: BuildStepGlobalContext, stepId: string): string;
@@ -7,8 +7,8 @@ exports.saveScriptToTemporaryFileAsync = saveScriptToTemporaryFileAsync;
7
7
  exports.cleanUpStepTemporaryDirectoriesAsync = cleanUpStepTemporaryDirectoriesAsync;
8
8
  exports.getTemporaryOutputsDirPath = getTemporaryOutputsDirPath;
9
9
  exports.getTemporaryEnvsDirPath = getTemporaryEnvsDirPath;
10
- const path_1 = __importDefault(require("path"));
11
10
  const promises_1 = __importDefault(require("fs/promises"));
11
+ const path_1 = __importDefault(require("path"));
12
12
  const uuid_1 = require("uuid");
13
13
  async function saveScriptToTemporaryFileAsync(ctx, stepId, scriptContents) {
14
14
  const scriptsDir = getTemporaryScriptsDirPath(ctx, stepId);
@@ -37,4 +37,3 @@ function getTemporaryOutputsDirPath(ctx, stepId) {
37
37
  function getTemporaryEnvsDirPath(ctx, stepId) {
38
38
  return path_1.default.join(getTemporaryStepDirPath(ctx, stepId), 'envs');
39
39
  }
40
- //# sourceMappingURL=BuildTemporaryFiles.js.map
@@ -1,6 +1,6 @@
1
- import { BuildFunctionById } from './BuildFunction.js';
2
- import { BuildStep } from './BuildStep.js';
3
- import { BuildStepGlobalContext } from './BuildStepContext.js';
1
+ import { BuildFunctionById } from './BuildFunction';
2
+ import { BuildStep } from './BuildStep';
3
+ import { BuildStepGlobalContext } from './BuildStepContext';
4
4
  export declare class BuildWorkflow {
5
5
  private readonly ctx;
6
6
  readonly buildSteps: BuildStep[];
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BuildWorkflow = void 0;
4
4
  class BuildWorkflow {
5
+ ctx;
6
+ buildSteps;
7
+ buildFunctions;
5
8
  constructor(ctx, { buildSteps, buildFunctions }) {
6
9
  this.ctx = ctx;
7
10
  this.buildSteps = buildSteps;
@@ -17,7 +20,7 @@ class BuildWorkflow {
17
20
  catch (err) {
18
21
  step.ctx.logger.error({ err });
19
22
  step.ctx.logger.error(`Runner failed to evaluate if it should execute step "${step.displayName}", using step's if condition "${step.ifCondition}". This can be caused by trying to access non-existing object property. If you think this is a bug report it here: https://github.com/expo/eas-cli/issues.`);
20
- maybeError = maybeError !== null && maybeError !== void 0 ? maybeError : err;
23
+ maybeError = maybeError ?? err;
21
24
  this.ctx.markAsFailed();
22
25
  }
23
26
  if (shouldExecuteStep) {
@@ -29,7 +32,7 @@ class BuildWorkflow {
29
32
  }
30
33
  catch (err) {
31
34
  stepResult = 'failed';
32
- maybeError = maybeError !== null && maybeError !== void 0 ? maybeError : err;
35
+ maybeError = maybeError ?? err;
33
36
  this.ctx.markAsFailed();
34
37
  }
35
38
  finally {
@@ -56,4 +59,3 @@ class BuildWorkflow {
56
59
  }
57
60
  }
58
61
  exports.BuildWorkflow = BuildWorkflow;
59
- //# sourceMappingURL=BuildWorkflow.js.map
@@ -1,4 +1,4 @@
1
- import { BuildWorkflow } from './BuildWorkflow.js';
1
+ import { BuildWorkflow } from './BuildWorkflow';
2
2
  export declare class BuildWorkflowValidator {
3
3
  private readonly workflow;
4
4
  constructor(workflow: BuildWorkflow);
@@ -4,14 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BuildWorkflowValidator = void 0;
7
- const path_1 = __importDefault(require("path"));
8
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
9
- const BuildStepInput_js_1 = require("./BuildStepInput.cjs");
10
- const errors_js_1 = require("./errors.cjs");
11
- const duplicates_js_1 = require("./utils/expodash/duplicates.cjs");
12
- const nullthrows_js_1 = require("./utils/nullthrows.cjs");
13
- const template_js_1 = require("./utils/template.cjs");
8
+ const path_1 = __importDefault(require("path"));
9
+ const BuildStepInput_1 = require("./BuildStepInput");
10
+ const errors_1 = require("./errors");
11
+ const duplicates_1 = require("./utils/expodash/duplicates");
12
+ const nullthrows_1 = require("./utils/nullthrows");
13
+ const template_1 = require("./utils/template");
14
14
  class BuildWorkflowValidator {
15
+ workflow;
15
16
  constructor(workflow) {
16
17
  this.workflow = workflow;
17
18
  }
@@ -22,38 +23,37 @@ class BuildWorkflowValidator {
22
23
  errors.push(...this.validateAllowedPlatforms());
23
24
  errors.push(...(await this.validateCustomFunctionModulesAsync()));
24
25
  if (errors.length !== 0) {
25
- throw new errors_js_1.BuildWorkflowError('Build workflow is invalid.', errors);
26
+ throw new errors_1.BuildWorkflowError('Build workflow is invalid.', errors);
26
27
  }
27
28
  }
28
29
  validateUniqueStepIds() {
29
30
  const stepIds = this.workflow.buildSteps.map(({ id }) => id);
30
- const duplicatedStepIds = (0, duplicates_js_1.duplicates)(stepIds);
31
+ const duplicatedStepIds = (0, duplicates_1.duplicates)(stepIds);
31
32
  if (duplicatedStepIds.length === 0) {
32
33
  return [];
33
34
  }
34
35
  else {
35
- const error = new errors_js_1.BuildConfigError(`Duplicated step IDs: ${duplicatedStepIds.map((i) => `"${i}"`).join(', ')}`);
36
+ const error = new errors_1.BuildConfigError(`Duplicated step IDs: ${duplicatedStepIds.map(i => `"${i}"`).join(', ')}`);
36
37
  return [error];
37
38
  }
38
39
  }
39
40
  validateInputs() {
40
- var _a;
41
41
  const errors = [];
42
- const allStepIds = new Set(this.workflow.buildSteps.map((s) => s.id));
42
+ const allStepIds = new Set(this.workflow.buildSteps.map(s => s.id));
43
43
  const visitedStepByStepId = {};
44
44
  for (const currentStep of this.workflow.buildSteps) {
45
- for (const currentStepInput of (_a = currentStep.inputs) !== null && _a !== void 0 ? _a : []) {
45
+ for (const currentStepInput of currentStep.inputs ?? []) {
46
46
  if (currentStepInput.required && currentStepInput.rawValue === undefined) {
47
- const error = new errors_js_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" is required but it was not set.`);
47
+ const error = new errors_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" is required but it was not set.`);
48
48
  errors.push(error);
49
49
  }
50
50
  const currentType = typeof currentStepInput.rawValue === 'object'
51
- ? BuildStepInput_js_1.BuildStepInputValueTypeName.JSON
51
+ ? BuildStepInput_1.BuildStepInputValueTypeName.JSON
52
52
  : typeof currentStepInput.rawValue;
53
53
  if (currentStepInput.rawValue !== undefined &&
54
54
  !currentStepInput.isRawValueStepOrContextReference() &&
55
55
  currentType !== currentStepInput.allowedValueTypeName) {
56
- const error = new errors_js_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" is set to "${typeof currentStepInput.rawValue === 'object'
56
+ const error = new errors_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" is set to "${typeof currentStepInput.rawValue === 'object'
57
57
  ? JSON.stringify(currentStepInput.rawValue)
58
58
  : currentStepInput.rawValue}" which is not of type "${currentStepInput.allowedValueTypeName}" or is not step or context reference.`);
59
59
  errors.push(error);
@@ -62,28 +62,28 @@ class BuildWorkflowValidator {
62
62
  continue;
63
63
  }
64
64
  if (!currentStepInput.isRawValueOneOfAllowedValues()) {
65
- const error = new errors_js_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" is set to "${currentStepInput.rawValue}" which is not one of the allowed values: ${(0, nullthrows_js_1.nullthrows)(currentStepInput.allowedValues)
66
- .map((i) => `"${i}"`)
65
+ const error = new errors_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" is set to "${currentStepInput.rawValue}" which is not one of the allowed values: ${(0, nullthrows_1.nullthrows)(currentStepInput.allowedValues)
66
+ .map(i => `"${i}"`)
67
67
  .join(', ')}.`);
68
68
  errors.push(error);
69
69
  }
70
70
  const paths = typeof currentStepInput.defaultValue === 'string'
71
- ? (0, template_js_1.findOutputPaths)(currentStepInput.defaultValue)
71
+ ? (0, template_1.findOutputPaths)(currentStepInput.defaultValue)
72
72
  : [];
73
73
  for (const { stepId: referencedStepId, outputId: referencedStepOutputId } of paths) {
74
74
  if (!(referencedStepId in visitedStepByStepId)) {
75
75
  if (allStepIds.has(referencedStepId)) {
76
- const error = new errors_js_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" uses an expression that references an output parameter from the future step "${referencedStepId}".`);
76
+ const error = new errors_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" uses an expression that references an output parameter from the future step "${referencedStepId}".`);
77
77
  errors.push(error);
78
78
  }
79
79
  else {
80
- const error = new errors_js_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" uses an expression that references an output parameter from a non-existent step "${referencedStepId}".`);
80
+ const error = new errors_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" uses an expression that references an output parameter from a non-existent step "${referencedStepId}".`);
81
81
  errors.push(error);
82
82
  }
83
83
  }
84
84
  else {
85
85
  if (!visitedStepByStepId[referencedStepId].hasOutputParameter(referencedStepOutputId)) {
86
- const error = new errors_js_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" uses an expression that references an undefined output parameter "${referencedStepOutputId}" from step "${referencedStepId}".`);
86
+ const error = new errors_1.BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" uses an expression that references an undefined output parameter "${referencedStepOutputId}" from step "${referencedStepId}".`);
87
87
  errors.push(error);
88
88
  }
89
89
  }
@@ -97,8 +97,8 @@ class BuildWorkflowValidator {
97
97
  const errors = [];
98
98
  for (const step of this.workflow.buildSteps) {
99
99
  if (!step.canBeRunOnRuntimePlatform()) {
100
- const error = new errors_js_1.BuildConfigError(`Step "${step.displayName}" is not allowed on platform "${step.ctx.global.runtimePlatform}". Allowed platforms for this step are: ${(0, nullthrows_js_1.nullthrows)(step.supportedRuntimePlatforms, `step.supportedRuntimePlatforms can't be falsy if canBeRunOnRuntimePlatform() is false`)
101
- .map((p) => `"${p}"`)
100
+ const error = new errors_1.BuildConfigError(`Step "${step.displayName}" is not allowed on platform "${step.ctx.global.runtimePlatform}". Allowed platforms for this step are: ${(0, nullthrows_1.nullthrows)(step.supportedRuntimePlatforms, `step.supportedRuntimePlatforms can't be falsy if canBeRunOnRuntimePlatform() is false`)
101
+ .map(p => `"${p}"`)
102
102
  .join(', ')}.`);
103
103
  errors.push(error);
104
104
  }
@@ -112,12 +112,12 @@ class BuildWorkflowValidator {
112
112
  continue;
113
113
  }
114
114
  if (!(await fs_extra_1.default.exists(buildFunction.customFunctionModulePath))) {
115
- const error = new errors_js_1.BuildConfigError(`Custom function module path "${buildFunction.customFunctionModulePath}" for function "${buildFunction.id}" does not exist.`);
115
+ const error = new errors_1.BuildConfigError(`Custom function module path "${buildFunction.customFunctionModulePath}" for function "${buildFunction.id}" does not exist.`);
116
116
  errors.push(error);
117
117
  continue;
118
118
  }
119
119
  if (!(await fs_extra_1.default.exists(path_1.default.join(buildFunction.customFunctionModulePath, 'package.json')))) {
120
- const error = new errors_js_1.BuildConfigError(`Custom function module path "${buildFunction.customFunctionModulePath}" for function "${buildFunction.id}" does not contain a package.json file.`);
120
+ const error = new errors_1.BuildConfigError(`Custom function module path "${buildFunction.customFunctionModulePath}" for function "${buildFunction.id}" does not contain a package.json file.`);
121
121
  errors.push(error);
122
122
  }
123
123
  }
@@ -125,4 +125,3 @@ class BuildWorkflowValidator {
125
125
  }
126
126
  }
127
127
  exports.BuildWorkflowValidator = BuildWorkflowValidator;
128
- //# sourceMappingURL=BuildWorkflowValidator.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=BuildStepEnv.js.map
@@ -1,9 +1,9 @@
1
1
  import { Step } from '@expo/eas-build-job';
2
- import { BuildFunction, BuildFunctionById } from './BuildFunction.js';
3
- import { BuildFunctionGroup } from './BuildFunctionGroup.js';
4
- import { BuildStepGlobalContext } from './BuildStepContext.js';
5
- import { BuildStep } from './BuildStep.js';
6
- import { AbstractConfigParser } from './AbstractConfigParser.js';
2
+ import { AbstractConfigParser } from './AbstractConfigParser';
3
+ import { BuildFunction, BuildFunctionById } from './BuildFunction';
4
+ import { BuildFunctionGroup } from './BuildFunctionGroup';
5
+ import { BuildStep } from './BuildStep';
6
+ import { BuildStepGlobalContext } from './BuildStepContext';
7
7
  export declare class StepsConfigParser extends AbstractConfigParser {
8
8
  private readonly steps;
9
9
  constructor(ctx: BuildStepGlobalContext, { steps, externalFunctions, externalFunctionGroups, }: {
@@ -4,14 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.StepsConfigParser = void 0;
7
- const node_assert_1 = __importDefault(require("node:assert"));
8
7
  const eas_build_job_1 = require("@expo/eas-build-job");
9
- const BuildFunctionGroup_js_1 = require("./BuildFunctionGroup.cjs");
10
- const BuildStep_js_1 = require("./BuildStep.cjs");
11
- const AbstractConfigParser_js_1 = require("./AbstractConfigParser.cjs");
12
- const errors_js_1 = require("./errors.cjs");
13
- const BuildStepOutput_js_1 = require("./BuildStepOutput.cjs");
14
- class StepsConfigParser extends AbstractConfigParser_js_1.AbstractConfigParser {
8
+ const node_assert_1 = __importDefault(require("node:assert"));
9
+ const AbstractConfigParser_1 = require("./AbstractConfigParser");
10
+ const BuildFunctionGroup_1 = require("./BuildFunctionGroup");
11
+ const BuildStep_1 = require("./BuildStep");
12
+ const BuildStepOutput_1 = require("./BuildStepOutput");
13
+ const errors_1 = require("./errors");
14
+ class StepsConfigParser extends AbstractConfigParser_1.AbstractConfigParser {
15
+ steps;
15
16
  constructor(ctx, { steps, externalFunctions, externalFunctionGroups, }) {
16
17
  super(ctx, {
17
18
  externalFunctions,
@@ -20,14 +21,13 @@ class StepsConfigParser extends AbstractConfigParser_js_1.AbstractConfigParser {
20
21
  this.steps = steps;
21
22
  }
22
23
  async parseConfigToBuildStepsAndBuildFunctionByIdMappingAsync() {
23
- var _a;
24
24
  const validatedSteps = (0, eas_build_job_1.validateSteps)(this.steps);
25
25
  StepsConfigParser.validateAllFunctionsExist(validatedSteps, {
26
26
  externalFunctionIds: this.getExternalFunctionFullIds(),
27
27
  externalFunctionGroupIds: this.getExternalFunctionGroupFullIds(),
28
28
  });
29
29
  const buildFunctionById = this.createBuildFunctionByIdMappingForExternalFunctions();
30
- const buildFunctionGroupById = (0, BuildFunctionGroup_js_1.createBuildFunctionGroupByIdMapping)((_a = this.externalFunctionGroups) !== null && _a !== void 0 ? _a : []);
30
+ const buildFunctionGroupById = (0, BuildFunctionGroup_1.createBuildFunctionGroupByIdMapping)(this.externalFunctionGroups ?? []);
31
31
  const buildSteps = [];
32
32
  for (const stepConfig of validatedSteps) {
33
33
  buildSteps.push(...this.createBuildStepsFromStepConfig(stepConfig, {
@@ -62,14 +62,14 @@ class StepsConfigParser extends AbstractConfigParser_js_1.AbstractConfigParser {
62
62
  });
63
63
  }
64
64
  else {
65
- throw new errors_js_1.BuildConfigError('Invalid job step configuration detected. Step must be shell or function step');
65
+ throw new errors_1.BuildConfigError('Invalid job step configuration detected. Step must be shell or function step');
66
66
  }
67
67
  }
68
68
  createBuildStepFromShellStepConfig(step) {
69
- const id = BuildStep_js_1.BuildStep.getNewId(step.id);
70
- const displayName = BuildStep_js_1.BuildStep.getDisplayName({ id, name: step.name, command: step.run });
69
+ const id = BuildStep_1.BuildStep.getNewId(step.id);
70
+ const displayName = BuildStep_1.BuildStep.getDisplayName({ id, name: step.name, command: step.run });
71
71
  const outputs = step.outputs && this.createBuildStepOutputsFromDefinition(step.outputs, displayName);
72
- return new BuildStep_js_1.BuildStep(this.ctx, {
72
+ return new BuildStep_1.BuildStep(this.ctx, {
73
73
  id,
74
74
  outputs,
75
75
  name: step.name,
@@ -106,14 +106,11 @@ class StepsConfigParser extends AbstractConfigParser_js_1.AbstractConfigParser {
106
106
  ];
107
107
  }
108
108
  createBuildStepOutputsFromDefinition(stepOutputs, stepDisplayName) {
109
- return stepOutputs.map((entry) => {
110
- var _a;
111
- return new BuildStepOutput_js_1.BuildStepOutput(this.ctx, {
112
- id: entry.name,
113
- stepDisplayName,
114
- required: (_a = entry.required) !== null && _a !== void 0 ? _a : true,
115
- });
116
- });
109
+ return stepOutputs.map(entry => new BuildStepOutput_1.BuildStepOutput(this.ctx, {
110
+ id: entry.name,
111
+ stepDisplayName,
112
+ required: entry.required ?? true,
113
+ }));
117
114
  }
118
115
  static validateAllFunctionsExist(steps, { externalFunctionIds, externalFunctionGroupIds, }) {
119
116
  const calledFunctionsOrFunctionGroupsSet = new Set();
@@ -125,16 +122,15 @@ class StepsConfigParser extends AbstractConfigParser_js_1.AbstractConfigParser {
125
122
  const calledFunctionsOrFunctionGroup = Array.from(calledFunctionsOrFunctionGroupsSet);
126
123
  const externalFunctionIdsSet = new Set(externalFunctionIds);
127
124
  const externalFunctionGroupsIdsSet = new Set(externalFunctionGroupIds);
128
- const nonExistentFunctionsOrFunctionGroups = calledFunctionsOrFunctionGroup.filter((calledFunctionOrFunctionGroup) => {
125
+ const nonExistentFunctionsOrFunctionGroups = calledFunctionsOrFunctionGroup.filter(calledFunctionOrFunctionGroup => {
129
126
  return (!externalFunctionIdsSet.has(calledFunctionOrFunctionGroup) &&
130
127
  !externalFunctionGroupsIdsSet.has(calledFunctionOrFunctionGroup));
131
128
  });
132
129
  if (nonExistentFunctionsOrFunctionGroups.length > 0) {
133
- throw new errors_js_1.BuildConfigError(`Calling non-existent functions: ${nonExistentFunctionsOrFunctionGroups
134
- .map((f) => `"${f}"`)
130
+ throw new errors_1.BuildConfigError(`Calling non-existent functions: ${nonExistentFunctionsOrFunctionGroups
131
+ .map(f => `"${f}"`)
135
132
  .join(', ')}.`);
136
133
  }
137
134
  }
138
135
  }
139
136
  exports.StepsConfigParser = StepsConfigParser;
140
- //# sourceMappingURL=StepsConfigParser.js.map
@@ -1,8 +1,8 @@
1
1
  import { StaticJobInterpolationContext } from '@expo/eas-build-job';
2
2
  import { bunyan } from '@expo/logger';
3
- import { ExternalBuildContextProvider } from '../BuildStepContext.js';
4
- import { BuildRuntimePlatform } from '../BuildRuntimePlatform.js';
5
- import { BuildStepEnv } from '../BuildStepEnv.js';
3
+ import { BuildRuntimePlatform } from '../BuildRuntimePlatform';
4
+ import { ExternalBuildContextProvider } from '../BuildStepContext';
5
+ import { BuildStepEnv } from '../BuildStepEnv';
6
6
  export declare class CliContextProvider implements ExternalBuildContextProvider {
7
7
  readonly logger: bunyan;
8
8
  readonly runtimePlatform: BuildRuntimePlatform;
@@ -2,19 +2,25 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
- var _a;
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
7
6
  exports.CliContextProvider = void 0;
8
- const path_1 = __importDefault(require("path"));
9
7
  const logger_1 = require("@expo/logger");
10
- const BuildConfigParser_js_1 = require("../BuildConfigParser.cjs");
11
- const BuildStepContext_js_1 = require("../BuildStepContext.cjs");
12
- const errors_js_1 = require("../errors.cjs");
8
+ const path_1 = __importDefault(require("path"));
9
+ const BuildConfigParser_1 = require("../BuildConfigParser");
10
+ const BuildStepContext_1 = require("../BuildStepContext");
11
+ const errors_1 = require("../errors");
13
12
  const logger = (0, logger_1.createLogger)({
14
13
  name: 'steps-cli',
15
14
  level: 'info',
16
15
  });
17
16
  class CliContextProvider {
17
+ logger;
18
+ runtimePlatform;
19
+ projectSourceDirectory;
20
+ projectTargetDirectory;
21
+ defaultWorkingDirectory;
22
+ buildLogsDirectory;
23
+ _env = {};
18
24
  constructor(logger, runtimePlatform, projectSourceDirectory, projectTargetDirectory, defaultWorkingDirectory, buildLogsDirectory) {
19
25
  this.logger = logger;
20
26
  this.runtimePlatform = runtimePlatform;
@@ -22,7 +28,6 @@ class CliContextProvider {
22
28
  this.projectTargetDirectory = projectTargetDirectory;
23
29
  this.defaultWorkingDirectory = defaultWorkingDirectory;
24
30
  this.buildLogsDirectory = buildLogsDirectory;
25
- this._env = {};
26
31
  }
27
32
  get env() {
28
33
  return this._env;
@@ -40,8 +45,8 @@ class CliContextProvider {
40
45
  }
41
46
  exports.CliContextProvider = CliContextProvider;
42
47
  async function runAsync(configPath, relativeProjectDirectory, runtimePlatform) {
43
- const ctx = new BuildStepContext_js_1.BuildStepGlobalContext(new CliContextProvider(logger, runtimePlatform, relativeProjectDirectory, relativeProjectDirectory, relativeProjectDirectory, relativeProjectDirectory), false);
44
- const parser = new BuildConfigParser_js_1.BuildConfigParser(ctx, {
48
+ const ctx = new BuildStepContext_1.BuildStepGlobalContext(new CliContextProvider(logger, runtimePlatform, relativeProjectDirectory, relativeProjectDirectory, relativeProjectDirectory, relativeProjectDirectory), false);
49
+ const parser = new BuildConfigParser_1.BuildConfigParser(ctx, {
45
50
  configPath,
46
51
  });
47
52
  const workflow = await parser.parseAsync();
@@ -49,20 +54,20 @@ async function runAsync(configPath, relativeProjectDirectory, runtimePlatform) {
49
54
  }
50
55
  const relativeConfigPath = process.argv[2];
51
56
  const relativeProjectDirectoryPath = process.argv[3];
52
- const platform = ((_a = process.argv[4]) !== null && _a !== void 0 ? _a : process.platform);
57
+ const platform = (process.argv[4] ??
58
+ process.platform);
53
59
  if (!relativeConfigPath || !relativeProjectDirectoryPath) {
54
60
  console.error('Usage: yarn cli config.yml path/to/project/directory [darwin|linux]');
55
61
  process.exit(1);
56
62
  }
57
63
  const configPath = path_1.default.resolve(process.cwd(), relativeConfigPath);
58
64
  const workingDirectory = path_1.default.resolve(process.cwd(), relativeProjectDirectoryPath);
59
- runAsync(configPath, workingDirectory, platform).catch((err) => {
65
+ runAsync(configPath, workingDirectory, platform).catch(err => {
60
66
  logger.error({ err }, 'Build failed');
61
- if (err instanceof errors_js_1.BuildWorkflowError) {
67
+ if (err instanceof errors_1.BuildWorkflowError) {
62
68
  logger.error('Failed to parse the custom build config file.');
63
69
  for (const detailedErr of err.errors) {
64
70
  logger.error({ err: detailedErr });
65
71
  }
66
72
  }
67
73
  });
68
- //# sourceMappingURL=cli.js.map
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BuildWorkflowError = exports.BuildStepRuntimeError = exports.BuildInternalError = exports.BuildConfigYAMLError = exports.BuildConfigError = void 0;
4
4
  class UserError extends Error {
5
+ message;
6
+ cause;
7
+ metadata;
5
8
  constructor(message, extra) {
6
- var _a;
7
9
  super(message);
8
10
  this.message = message;
9
- this.metadata = (_a = extra === null || extra === void 0 ? void 0 : extra.cause) !== null && _a !== void 0 ? _a : {};
10
- this.cause = extra === null || extra === void 0 ? void 0 : extra.cause;
11
+ this.metadata = extra?.cause ?? {};
12
+ this.cause = extra?.cause;
11
13
  }
12
14
  }
13
15
  class BuildConfigError extends UserError {
@@ -22,6 +24,8 @@ class BuildStepRuntimeError extends UserError {
22
24
  }
23
25
  exports.BuildStepRuntimeError = BuildStepRuntimeError;
24
26
  class BuildWorkflowError extends UserError {
27
+ message;
28
+ errors;
25
29
  constructor(message, errors, extra) {
26
30
  super(message, extra);
27
31
  this.message = message;
@@ -29,4 +33,3 @@ class BuildWorkflowError extends UserError {
29
33
  }
30
34
  }
31
35
  exports.BuildWorkflowError = BuildWorkflowError;
32
- //# sourceMappingURL=errors.js.map