@expo/steps 1.0.265 → 1.0.271

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 (207) hide show
  1. package/{dist_commonjs → dist}/AbstractConfigParser.d.ts +5 -5
  2. package/{dist_commonjs/AbstractConfigParser.cjs → dist/AbstractConfigParser.js} +13 -13
  3. package/dist/AbstractConfigParser.js.map +1 -0
  4. package/{dist_commonjs → dist}/BuildConfig.d.ts +3 -3
  5. package/{dist_commonjs/BuildConfig.cjs → dist/BuildConfig.js} +22 -22
  6. package/dist/BuildConfig.js.map +1 -0
  7. package/{dist_esm → dist}/BuildConfigParser.d.ts +5 -5
  8. package/{dist_commonjs/BuildConfigParser.cjs → dist/BuildConfigParser.js} +31 -31
  9. package/dist/BuildConfigParser.js.map +1 -0
  10. package/{dist_esm → dist}/BuildFunction.d.ts +6 -6
  11. package/{dist_commonjs/BuildFunction.cjs → dist/BuildFunction.js} +6 -6
  12. package/dist/BuildFunction.js.map +1 -0
  13. package/{dist_commonjs → dist}/BuildFunctionGroup.d.ts +4 -4
  14. package/{dist_commonjs/BuildFunctionGroup.cjs → dist/BuildFunctionGroup.js} +4 -4
  15. package/dist/BuildFunctionGroup.js.map +1 -0
  16. package/{dist_esm → dist}/BuildStep.d.ts +5 -5
  17. package/{dist_commonjs/BuildStep.cjs → dist/BuildStep.js} +29 -29
  18. package/dist/BuildStep.js.map +1 -0
  19. package/{dist_commonjs → dist}/BuildStepContext.d.ts +4 -4
  20. package/{dist_commonjs/BuildStepContext.cjs → dist/BuildStepContext.js} +10 -10
  21. package/dist/BuildStepContext.js.map +1 -0
  22. package/{dist_esm → dist}/BuildStepInput.d.ts +1 -1
  23. package/{dist_commonjs/BuildStepInput.cjs → dist/BuildStepInput.js} +12 -12
  24. package/dist/BuildStepInput.js.map +1 -0
  25. package/{dist_commonjs → dist}/BuildStepOutput.d.ts +1 -1
  26. package/{dist_commonjs/BuildStepOutput.cjs → dist/BuildStepOutput.js} +3 -3
  27. package/dist/BuildStepOutput.js.map +1 -0
  28. package/{dist_commonjs → dist}/BuildTemporaryFiles.d.ts +1 -1
  29. package/{dist_commonjs → dist}/BuildTemporaryFiles.js.map +1 -1
  30. package/{dist_commonjs → dist}/BuildWorkflow.d.ts +3 -3
  31. package/dist/BuildWorkflow.js.map +1 -0
  32. package/{dist_commonjs → dist}/BuildWorkflowValidator.d.ts +1 -1
  33. package/{dist_commonjs/BuildWorkflowValidator.cjs → dist/BuildWorkflowValidator.js} +19 -19
  34. package/dist/BuildWorkflowValidator.js.map +1 -0
  35. package/{dist_commonjs → dist}/StepsConfigParser.d.ts +5 -5
  36. package/{dist_commonjs/StepsConfigParser.cjs → dist/StepsConfigParser.js} +13 -13
  37. package/dist/StepsConfigParser.js.map +1 -0
  38. package/{dist_esm → dist}/cli/cli.d.ts +3 -3
  39. package/{dist_commonjs/cli/cli.cjs → dist/cli/cli.js} +6 -6
  40. package/dist/cli/cli.js.map +1 -0
  41. package/dist/index.d.ts +19 -0
  42. package/{dist_commonjs/index.cjs → dist/index.js} +30 -30
  43. package/dist/index.js.map +1 -0
  44. package/{dist_commonjs/interpolation.cjs → dist/interpolation.js} +3 -3
  45. package/dist/interpolation.js.map +1 -0
  46. package/{dist_commonjs/scripts/runCustomFunction.cjs → dist/scripts/runCustomFunction.js} +9 -9
  47. package/dist/scripts/runCustomFunction.js.map +1 -0
  48. package/{dist_commonjs → dist}/utils/customFunction.d.ts +4 -4
  49. package/{dist_commonjs/utils/customFunction.cjs → dist/utils/customFunction.js} +4 -6
  50. package/dist/utils/customFunction.js.map +1 -0
  51. package/{dist_commonjs/utils/shell/bin.cjs → dist/utils/shell/bin.js} +1 -3
  52. package/dist/utils/shell/bin.js.map +1 -0
  53. package/{dist_commonjs/utils/template.cjs → dist/utils/template.js} +7 -7
  54. package/dist/utils/template.js.map +1 -0
  55. package/package.json +11 -23
  56. package/dist_commonjs/AbstractConfigParser.js.map +0 -1
  57. package/dist_commonjs/BuildConfig.js.map +0 -1
  58. package/dist_commonjs/BuildConfigParser.d.ts +0 -33
  59. package/dist_commonjs/BuildConfigParser.js.map +0 -1
  60. package/dist_commonjs/BuildFunction.d.ts +0 -45
  61. package/dist_commonjs/BuildFunction.js.map +0 -1
  62. package/dist_commonjs/BuildFunctionGroup.js.map +0 -1
  63. package/dist_commonjs/BuildStep.d.ts +0 -100
  64. package/dist_commonjs/BuildStep.js.map +0 -1
  65. package/dist_commonjs/BuildStepContext.js.map +0 -1
  66. package/dist_commonjs/BuildStepInput.d.ts +0 -47
  67. package/dist_commonjs/BuildStepInput.js.map +0 -1
  68. package/dist_commonjs/BuildStepOutput.js.map +0 -1
  69. package/dist_commonjs/BuildWorkflow.js.map +0 -1
  70. package/dist_commonjs/BuildWorkflowValidator.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/index.d.ts +0 -19
  75. package/dist_commonjs/index.js.map +0 -1
  76. package/dist_commonjs/interpolation.js.map +0 -1
  77. package/dist_commonjs/scripts/runCustomFunction.js.map +0 -1
  78. package/dist_commonjs/utils/customFunction.js.map +0 -1
  79. package/dist_commonjs/utils/shell/bin.js.map +0 -1
  80. package/dist_commonjs/utils/template.js.map +0 -1
  81. package/dist_esm/AbstractConfigParser.d.ts +0 -23
  82. package/dist_esm/AbstractConfigParser.js +0 -61
  83. package/dist_esm/AbstractConfigParser.js.map +0 -1
  84. package/dist_esm/BuildConfig.d.ts +0 -80
  85. package/dist_esm/BuildConfig.js +0 -281
  86. package/dist_esm/BuildConfig.js.map +0 -1
  87. package/dist_esm/BuildConfigParser.js +0 -233
  88. package/dist_esm/BuildConfigParser.js.map +0 -1
  89. package/dist_esm/BuildFunction.js +0 -62
  90. package/dist_esm/BuildFunction.js.map +0 -1
  91. package/dist_esm/BuildFunctionGroup.d.ts +0 -23
  92. package/dist_esm/BuildFunctionGroup.js +0 -36
  93. package/dist_esm/BuildFunctionGroup.js.map +0 -1
  94. package/dist_esm/BuildRuntimePlatform.d.ts +0 -4
  95. package/dist_esm/BuildRuntimePlatform.js +0 -6
  96. package/dist_esm/BuildRuntimePlatform.js.map +0 -1
  97. package/dist_esm/BuildStep.js +0 -354
  98. package/dist_esm/BuildStep.js.map +0 -1
  99. package/dist_esm/BuildStepContext.d.ts +0 -86
  100. package/dist_esm/BuildStepContext.js +0 -207
  101. package/dist_esm/BuildStepContext.js.map +0 -1
  102. package/dist_esm/BuildStepEnv.d.ts +0 -1
  103. package/dist_esm/BuildStepEnv.js +0 -2
  104. package/dist_esm/BuildStepEnv.js.map +0 -1
  105. package/dist_esm/BuildStepInput.js +0 -150
  106. package/dist_esm/BuildStepInput.js.map +0 -1
  107. package/dist_esm/BuildStepOutput.d.ts +0 -33
  108. package/dist_esm/BuildStepOutput.js +0 -57
  109. package/dist_esm/BuildStepOutput.js.map +0 -1
  110. package/dist_esm/BuildTemporaryFiles.d.ts +0 -5
  111. package/dist_esm/BuildTemporaryFiles.js +0 -31
  112. package/dist_esm/BuildTemporaryFiles.js.map +0 -1
  113. package/dist_esm/BuildWorkflow.d.ts +0 -14
  114. package/dist_esm/BuildWorkflow.js +0 -55
  115. package/dist_esm/BuildWorkflow.js.map +0 -1
  116. package/dist_esm/BuildWorkflowValidator.d.ts +0 -10
  117. package/dist_esm/BuildWorkflowValidator.js +0 -121
  118. package/dist_esm/BuildWorkflowValidator.js.map +0 -1
  119. package/dist_esm/StepMetrics.d.ts +0 -10
  120. package/dist_esm/StepMetrics.js +0 -2
  121. package/dist_esm/StepMetrics.js.map +0 -1
  122. package/dist_esm/StepsConfigParser.d.ts +0 -24
  123. package/dist_esm/StepsConfigParser.js +0 -133
  124. package/dist_esm/StepsConfigParser.js.map +0 -1
  125. package/dist_esm/cli/cli.js +0 -61
  126. package/dist_esm/cli/cli.js.map +0 -1
  127. package/dist_esm/errors.d.ts +0 -24
  128. package/dist_esm/errors.js +0 -24
  129. package/dist_esm/errors.js.map +0 -1
  130. package/dist_esm/index.d.ts +0 -19
  131. package/dist_esm/index.js +0 -18
  132. package/dist_esm/index.js.map +0 -1
  133. package/dist_esm/interpolation.d.ts +0 -5
  134. package/dist_esm/interpolation.js +0 -26
  135. package/dist_esm/interpolation.js.map +0 -1
  136. package/dist_esm/scripts/runCustomFunction.d.ts +0 -1
  137. package/dist_esm/scripts/runCustomFunction.js +0 -100
  138. package/dist_esm/scripts/runCustomFunction.js.map +0 -1
  139. package/dist_esm/utils/customFunction.d.ts +0 -18
  140. package/dist_esm/utils/customFunction.js +0 -49
  141. package/dist_esm/utils/customFunction.js.map +0 -1
  142. package/dist_esm/utils/expodash/duplicates.d.ts +0 -1
  143. package/dist_esm/utils/expodash/duplicates.js +0 -14
  144. package/dist_esm/utils/expodash/duplicates.js.map +0 -1
  145. package/dist_esm/utils/expodash/uniq.d.ts +0 -1
  146. package/dist_esm/utils/expodash/uniq.js +0 -5
  147. package/dist_esm/utils/expodash/uniq.js.map +0 -1
  148. package/dist_esm/utils/hashFiles.d.ts +0 -6
  149. package/dist_esm/utils/hashFiles.js +0 -31
  150. package/dist_esm/utils/hashFiles.js.map +0 -1
  151. package/dist_esm/utils/jsepEval.d.ts +0 -1
  152. package/dist_esm/utils/jsepEval.js +0 -169
  153. package/dist_esm/utils/jsepEval.js.map +0 -1
  154. package/dist_esm/utils/nullthrows.d.ts +0 -1
  155. package/dist_esm/utils/nullthrows.js +0 -7
  156. package/dist_esm/utils/nullthrows.js.map +0 -1
  157. package/dist_esm/utils/shell/bin.d.ts +0 -1
  158. package/dist_esm/utils/shell/bin.js +0 -5
  159. package/dist_esm/utils/shell/bin.js.map +0 -1
  160. package/dist_esm/utils/shell/command.d.ts +0 -4
  161. package/dist_esm/utils/shell/command.js +0 -13
  162. package/dist_esm/utils/shell/command.js.map +0 -1
  163. package/dist_esm/utils/shell/spawn.d.ts +0 -15
  164. package/dist_esm/utils/shell/spawn.js +0 -16
  165. package/dist_esm/utils/shell/spawn.js.map +0 -1
  166. package/dist_esm/utils/template.d.ts +0 -19
  167. package/dist_esm/utils/template.js +0 -106
  168. package/dist_esm/utils/template.js.map +0 -1
  169. /package/{dist_commonjs → dist}/BuildRuntimePlatform.d.ts +0 -0
  170. /package/{dist_commonjs/BuildRuntimePlatform.cjs → dist/BuildRuntimePlatform.js} +0 -0
  171. /package/{dist_commonjs → dist}/BuildRuntimePlatform.js.map +0 -0
  172. /package/{dist_commonjs → dist}/BuildStepEnv.d.ts +0 -0
  173. /package/{dist_commonjs/BuildStepEnv.cjs → dist/BuildStepEnv.js} +0 -0
  174. /package/{dist_commonjs → dist}/BuildStepEnv.js.map +0 -0
  175. /package/{dist_commonjs/BuildTemporaryFiles.cjs → dist/BuildTemporaryFiles.js} +0 -0
  176. /package/{dist_commonjs/BuildWorkflow.cjs → dist/BuildWorkflow.js} +0 -0
  177. /package/{dist_commonjs → dist}/StepMetrics.d.ts +0 -0
  178. /package/{dist_commonjs/StepMetrics.cjs → dist/StepMetrics.js} +0 -0
  179. /package/{dist_commonjs → dist}/StepMetrics.js.map +0 -0
  180. /package/{dist_commonjs → dist}/errors.d.ts +0 -0
  181. /package/{dist_commonjs/errors.cjs → dist/errors.js} +0 -0
  182. /package/{dist_commonjs → dist}/errors.js.map +0 -0
  183. /package/{dist_commonjs → dist}/interpolation.d.ts +0 -0
  184. /package/{dist_commonjs → dist}/scripts/runCustomFunction.d.ts +0 -0
  185. /package/{dist_commonjs → dist}/utils/expodash/duplicates.d.ts +0 -0
  186. /package/{dist_commonjs/utils/expodash/duplicates.cjs → dist/utils/expodash/duplicates.js} +0 -0
  187. /package/{dist_commonjs → dist}/utils/expodash/duplicates.js.map +0 -0
  188. /package/{dist_commonjs → dist}/utils/expodash/uniq.d.ts +0 -0
  189. /package/{dist_commonjs/utils/expodash/uniq.cjs → dist/utils/expodash/uniq.js} +0 -0
  190. /package/{dist_commonjs → dist}/utils/expodash/uniq.js.map +0 -0
  191. /package/{dist_commonjs → dist}/utils/hashFiles.d.ts +0 -0
  192. /package/{dist_commonjs/utils/hashFiles.cjs → dist/utils/hashFiles.js} +0 -0
  193. /package/{dist_commonjs → dist}/utils/hashFiles.js.map +0 -0
  194. /package/{dist_commonjs → dist}/utils/jsepEval.d.ts +0 -0
  195. /package/{dist_commonjs/utils/jsepEval.cjs → dist/utils/jsepEval.js} +0 -0
  196. /package/{dist_commonjs → dist}/utils/jsepEval.js.map +0 -0
  197. /package/{dist_commonjs → dist}/utils/nullthrows.d.ts +0 -0
  198. /package/{dist_commonjs/utils/nullthrows.cjs → dist/utils/nullthrows.js} +0 -0
  199. /package/{dist_commonjs → dist}/utils/nullthrows.js.map +0 -0
  200. /package/{dist_commonjs → dist}/utils/shell/bin.d.ts +0 -0
  201. /package/{dist_commonjs → dist}/utils/shell/command.d.ts +0 -0
  202. /package/{dist_commonjs/utils/shell/command.cjs → dist/utils/shell/command.js} +0 -0
  203. /package/{dist_commonjs → dist}/utils/shell/command.js.map +0 -0
  204. /package/{dist_commonjs → dist}/utils/shell/spawn.d.ts +0 -0
  205. /package/{dist_commonjs/utils/shell/spawn.cjs → dist/utils/shell/spawn.js} +0 -0
  206. /package/{dist_commonjs → dist}/utils/shell/spawn.js.map +0 -0
  207. /package/{dist_commonjs → dist}/utils/template.d.ts +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuildStepContext.js","sourceRoot":"","sources":["../src/BuildStepContext.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,0DAA2B;AAG3B,+BAAoC;AAGpC,uDAAiD;AACjD,iDAIwB;AACxB,qDAI6B;AAC7B,2CAAoD;AAoCpD,MAAa,sBAAsB;IASjC,YACmB,QAAsC,EACvC,WAAoB;QADnB,aAAQ,GAAR,QAAQ,CAA8B;QACvC,gBAAW,GAAX,WAAW,CAAS;QAP9B,gBAAW,GAAG,KAAK,CAAC;QACpB,8BAAyB,GAAG,KAAK,CAAC;QAClC,aAAQ,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,CAAC,IAAI,CAAC,GAAG,CAAC,uBAAuB,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACpF,CAAC;IAEM,SAAS;QACd,OAAO;YACL,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;YACvD,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE;SAC7B,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,WAAW,CACvB,UAAsC,EACtC,MAAc;QAEd,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzF,OAAO,IAAI,gBAAgB,CAAC,kBAAkB,EAAE;YAC9C,MAAM;YACN,wBAAwB,EAAE,UAAU,CAAC,wBAAwB;SAC9D,CAAC,CAAC;IACL,CAAC;CACF;AAnDD,4CAmDC","sourcesContent":["import os from 'os';\nimport path from 'path';\n\nimport fg from 'fast-glob';\nimport { Env, JobInterpolationContext, StaticJobInterpolationContext } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { StepMetricInput, StepMetricsCollection } from './StepMetrics.js';\nimport { hashFiles } from './utils/hashFiles.js';\nimport {\n BuildStep,\n BuildStepOutputAccessor,\n SerializedBuildStepOutputAccessor,\n} from './BuildStep.js';\nimport {\n getObjectValueForInterpolation,\n interpolateWithGlobalContext,\n parseOutputPath,\n} from './utils/template.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport { BuildRuntimePlatform } from './BuildRuntimePlatform.js';\nimport { BuildStepEnv } from './BuildStepEnv.js';\n\ninterface SerializedExternalBuildContextProvider {\n projectSourceDirectory: string;\n projectTargetDirectory: string;\n defaultWorkingDirectory: string;\n buildLogsDirectory: string;\n runtimePlatform: BuildRuntimePlatform;\n // We omit steps, because they should be calculated live based on global context.\n staticContext: Omit<StaticJobInterpolationContext, 'steps'>;\n env: BuildStepEnv;\n}\n\nexport interface ExternalBuildContextProvider {\n readonly projectSourceDirectory: string;\n readonly projectTargetDirectory: string;\n readonly defaultWorkingDirectory: string;\n readonly buildLogsDirectory: string;\n readonly runtimePlatform: BuildRuntimePlatform;\n readonly logger: bunyan;\n\n readonly staticContext: () => Omit<StaticJobInterpolationContext, 'steps'>;\n\n readonly env: BuildStepEnv;\n updateEnv(env: BuildStepEnv): void;\n}\n\nexport interface SerializedBuildStepGlobalContext {\n stepsInternalBuildDirectory: string;\n stepById: Record<string, SerializedBuildStepOutputAccessor>;\n provider: SerializedExternalBuildContextProvider;\n skipCleanup: boolean;\n}\n\nexport class BuildStepGlobalContext {\n public stepsInternalBuildDirectory: string;\n public readonly runtimePlatform: BuildRuntimePlatform;\n public readonly baseLogger: bunyan;\n private didCheckOut = false;\n private _hasAnyPreviousStepFailed = false;\n private stepById: Record<string, BuildStepOutputAccessor> = {};\n private readonly _stepMetrics: StepMetricsCollection = [];\n\n constructor(\n private readonly provider: ExternalBuildContextProvider,\n public readonly skipCleanup: boolean\n ) {\n this.stepsInternalBuildDirectory = path.join(os.tmpdir(), 'eas-build', uuidv4());\n this.runtimePlatform = provider.runtimePlatform;\n this.baseLogger = provider.logger;\n this._hasAnyPreviousStepFailed = false;\n }\n\n public get projectSourceDirectory(): string {\n return this.provider.projectSourceDirectory;\n }\n\n public get projectTargetDirectory(): string {\n return this.provider.projectTargetDirectory;\n }\n\n public get defaultWorkingDirectory(): string {\n return this.didCheckOut ? this.provider.defaultWorkingDirectory : this.projectTargetDirectory;\n }\n\n public get buildLogsDirectory(): string {\n return this.provider.buildLogsDirectory;\n }\n\n public get env(): BuildStepEnv {\n return this.provider.env;\n }\n\n public get staticContext(): StaticJobInterpolationContext {\n return {\n ...this.provider.staticContext(),\n steps: Object.fromEntries(\n Object.values(this.stepById).map((step) => [\n step.id,\n {\n outputs: Object.fromEntries(\n step.outputs.map((output) => {\n return [output.id, output.rawValue];\n })\n ),\n },\n ])\n ),\n };\n }\n\n public updateEnv(updatedEnv: BuildStepEnv): void {\n this.provider.updateEnv(updatedEnv);\n }\n\n public registerStep(step: BuildStep): void {\n this.stepById[step.id] = step;\n }\n\n public getStepOutputValue(path: string): string | undefined {\n const { stepId, outputId } = parseOutputPath(path);\n if (!(stepId in this.stepById)) {\n throw new BuildStepRuntimeError(`Step \"${stepId}\" does not exist.`);\n }\n return this.stepById[stepId].getOutputValueByName(outputId);\n }\n\n public getInterpolationContext(): JobInterpolationContext {\n const hasAnyPreviousStepFailed = this.hasAnyPreviousStepFailed;\n\n return {\n ...this.staticContext,\n always: () => true,\n never: () => false,\n success: () => !hasAnyPreviousStepFailed,\n failure: () => hasAnyPreviousStepFailed,\n env: this.env as Env,\n fromJSON: (json: string) => JSON.parse(json),\n toJSON: (value: unknown) => JSON.stringify(value),\n contains: (value, substring) => value.includes(substring),\n startsWith: (value, prefix) => value.startsWith(prefix),\n endsWith: (value, suffix) => value.endsWith(suffix),\n hashFiles: (...patterns: string[]) => this.hashFiles(...patterns),\n replaceAll: (input: string, stringToReplace: string, replacementString: string) => {\n while (input.includes(stringToReplace)) {\n input = input.replace(stringToReplace, replacementString);\n }\n return input;\n },\n substring: (input: string, start: number, end?: number) => input.substring(start, end),\n };\n }\n\n public interpolate<InterpolableType extends string | object>(\n value: InterpolableType\n ): InterpolableType {\n return interpolateWithGlobalContext(value, (path) => {\n return (\n getObjectValueForInterpolation(path, {\n eas: {\n runtimePlatform: this.runtimePlatform,\n ...this.staticContext,\n env: this.env,\n },\n })?.toString() ?? ''\n );\n });\n }\n\n public stepCtx(options: { logger: bunyan; relativeWorkingDirectory?: string }): BuildStepContext {\n return new BuildStepContext(this, options);\n }\n\n public markAsCheckedOut(logger: bunyan): void {\n this.didCheckOut = true;\n logger.info(\n `Changing default working directory to ${this.defaultWorkingDirectory} (was ${this.projectTargetDirectory})`\n );\n }\n\n public get hasAnyPreviousStepFailed(): boolean {\n return this._hasAnyPreviousStepFailed;\n }\n\n public markAsFailed(): void {\n this._hasAnyPreviousStepFailed = true;\n }\n\n public get stepMetrics(): StepMetricsCollection {\n return this._stepMetrics;\n }\n\n public addStepMetric(metric: StepMetricInput): void {\n this._stepMetrics.push({ ...metric, platform: this.runtimePlatform });\n }\n\n public wasCheckedOut(): boolean {\n return this.didCheckOut;\n }\n\n public hashFiles(...patterns: string[]): string {\n const cwd = this.defaultWorkingDirectory;\n const workspacePath = path.resolve(cwd);\n\n // Use glob to find matching files across all patterns\n const filePaths = fg.sync(patterns, {\n cwd,\n absolute: true,\n onlyFiles: true,\n });\n\n if (filePaths.length === 0) {\n return '';\n }\n\n const validFilePaths = filePaths.filter((file) =>\n file.startsWith(`${workspacePath}${path.sep}`)\n );\n\n if (validFilePaths.length === 0) {\n return '';\n }\n\n return hashFiles(validFilePaths);\n }\n\n public serialize(): SerializedBuildStepGlobalContext {\n return {\n stepsInternalBuildDirectory: this.stepsInternalBuildDirectory,\n stepById: Object.fromEntries(\n Object.entries(this.stepById).map(([id, step]) => [id, step.serialize()])\n ),\n provider: {\n projectSourceDirectory: this.provider.projectSourceDirectory,\n projectTargetDirectory: this.provider.projectTargetDirectory,\n defaultWorkingDirectory: this.provider.defaultWorkingDirectory,\n buildLogsDirectory: this.provider.buildLogsDirectory,\n runtimePlatform: this.provider.runtimePlatform,\n staticContext: this.provider.staticContext(),\n env: this.provider.env,\n },\n skipCleanup: this.skipCleanup,\n };\n }\n\n public static deserialize(\n serialized: SerializedBuildStepGlobalContext,\n logger: bunyan\n ): BuildStepGlobalContext {\n const deserializedProvider: ExternalBuildContextProvider = {\n projectSourceDirectory: serialized.provider.projectSourceDirectory,\n projectTargetDirectory: serialized.provider.projectTargetDirectory,\n defaultWorkingDirectory: serialized.provider.defaultWorkingDirectory,\n buildLogsDirectory: serialized.provider.buildLogsDirectory,\n runtimePlatform: serialized.provider.runtimePlatform,\n logger,\n staticContext: () => serialized.provider.staticContext,\n env: serialized.provider.env,\n updateEnv: () => {},\n };\n const ctx = new BuildStepGlobalContext(deserializedProvider, serialized.skipCleanup);\n for (const [id, stepOutputAccessor] of Object.entries(serialized.stepById)) {\n ctx.stepById[id] = BuildStepOutputAccessor.deserialize(stepOutputAccessor);\n }\n ctx.stepsInternalBuildDirectory = serialized.stepsInternalBuildDirectory;\n\n return ctx;\n }\n}\n\nexport interface SerializedBuildStepContext {\n relativeWorkingDirectory?: string;\n global: SerializedBuildStepGlobalContext;\n}\n\nexport class BuildStepContext {\n public readonly logger: bunyan;\n public readonly relativeWorkingDirectory?: string;\n\n constructor(\n private readonly ctx: BuildStepGlobalContext,\n {\n logger,\n relativeWorkingDirectory,\n }: {\n logger: bunyan;\n relativeWorkingDirectory?: string;\n }\n ) {\n this.logger = logger ?? ctx.baseLogger;\n this.relativeWorkingDirectory = relativeWorkingDirectory;\n }\n\n public get global(): BuildStepGlobalContext {\n return this.ctx;\n }\n\n public get workingDirectory(): string {\n if (!this.relativeWorkingDirectory) {\n return this.ctx.defaultWorkingDirectory;\n }\n\n if (path.isAbsolute(this.relativeWorkingDirectory)) {\n return path.join(this.ctx.projectTargetDirectory, this.relativeWorkingDirectory);\n }\n\n return path.join(this.ctx.defaultWorkingDirectory, this.relativeWorkingDirectory);\n }\n\n public serialize(): SerializedBuildStepContext {\n return {\n relativeWorkingDirectory: this.relativeWorkingDirectory,\n global: this.ctx.serialize(),\n };\n }\n\n public static deserialize(\n serialized: SerializedBuildStepContext,\n logger: bunyan\n ): BuildStepContext {\n const deserializedGlobal = BuildStepGlobalContext.deserialize(serialized.global, logger);\n return new BuildStepContext(deserializedGlobal, {\n logger,\n relativeWorkingDirectory: serialized.relativeWorkingDirectory,\n });\n }\n}\n"]}
@@ -1,47 +0,0 @@
1
- import { JobInterpolationContext } from '@expo/eas-build-job';
2
- import { BuildStepGlobalContext } from './BuildStepContext.js';
3
- export declare enum BuildStepInputValueTypeName {
4
- STRING = "string",
5
- BOOLEAN = "boolean",
6
- NUMBER = "number",
7
- JSON = "json"
8
- }
9
- export type BuildStepInputValueType<T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName> = T extends BuildStepInputValueTypeName.STRING ? string : T extends BuildStepInputValueTypeName.BOOLEAN ? boolean : T extends BuildStepInputValueTypeName.NUMBER ? number : Record<string, unknown>;
10
- export type BuildStepInputById = Record<string, BuildStepInput>;
11
- export type BuildStepInputProvider = (ctx: BuildStepGlobalContext, stepId: string) => BuildStepInput;
12
- interface BuildStepInputProviderParams<T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName, R extends boolean = boolean> {
13
- id: string;
14
- allowedValues?: unknown[];
15
- defaultValue?: unknown;
16
- required: R;
17
- allowedValueTypeName: T;
18
- }
19
- interface BuildStepInputParams<T extends BuildStepInputValueTypeName, R extends boolean> extends BuildStepInputProviderParams<T, R> {
20
- stepDisplayName: string;
21
- }
22
- export declare class BuildStepInput<T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName, R extends boolean = boolean> {
23
- private readonly ctx;
24
- readonly id: string;
25
- readonly stepDisplayName: string;
26
- readonly defaultValue?: unknown;
27
- readonly allowedValues?: unknown[];
28
- readonly allowedValueTypeName: T;
29
- readonly required: R;
30
- private _value?;
31
- static createProvider(params: BuildStepInputProviderParams): BuildStepInputProvider;
32
- constructor(ctx: BuildStepGlobalContext, { id, stepDisplayName, allowedValues, defaultValue, required, allowedValueTypeName, }: BuildStepInputParams<T, R>);
33
- getValue({ interpolationContext, }: {
34
- interpolationContext: JobInterpolationContext;
35
- }): R extends true ? BuildStepInputValueType<T> : BuildStepInputValueType<T> | undefined;
36
- get rawValue(): unknown;
37
- set(value: unknown): BuildStepInput;
38
- isRawValueOneOfAllowedValues(): boolean;
39
- isRawValueStepOrContextReference(): boolean;
40
- private parseInputValueToAllowedType;
41
- private parseInputValueToString;
42
- private parseInputValueToNumber;
43
- private parseInputValueToBoolean;
44
- private parseInputValueToObject;
45
- }
46
- export declare function makeBuildStepInputByIdMap(inputs?: BuildStepInput[]): BuildStepInputById;
47
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuildStepInput.js","sourceRoot":"","sources":["../src/BuildStepInput.ts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,IAAI,CAClH,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,uBAAuB,CAAC,KAAgC;QAC9D,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,iCAAqB,CAC7B,oBAAoB,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,eAAe,sBAAsB,IAAI,CAAC,oBAAoB,IAAI,EACjH;gBACE,KAAK,EAAE,CAAC;aACT,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAnLD,wCAmLC;AAED,SAAgB,yBAAyB,CAAC,MAAyB;IACjE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAClC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;QACtB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAwB,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import assert from 'assert';\n\nimport { JobInterpolationContext } from '@expo/eas-build-job';\n\nimport { BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport {\n BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX,\n interpolateWithOutputs,\n} from './utils/template.js';\nimport { interpolateJobContext } from './interpolation.js';\n\nexport enum BuildStepInputValueTypeName {\n STRING = 'string',\n BOOLEAN = 'boolean',\n NUMBER = 'number',\n JSON = 'json',\n}\n\nexport type BuildStepInputValueType<\n T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName,\n> = T extends BuildStepInputValueTypeName.STRING\n ? string\n : T extends BuildStepInputValueTypeName.BOOLEAN\n ? boolean\n : T extends BuildStepInputValueTypeName.NUMBER\n ? number\n : Record<string, unknown>;\n\nexport type BuildStepInputById = Record<string, BuildStepInput>;\nexport type BuildStepInputProvider = (\n ctx: BuildStepGlobalContext,\n stepId: string\n) => BuildStepInput;\n\ninterface BuildStepInputProviderParams<\n T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName,\n R extends boolean = boolean,\n> {\n id: string;\n allowedValues?: unknown[];\n defaultValue?: unknown;\n required: R;\n allowedValueTypeName: T;\n}\n\ninterface BuildStepInputParams<T extends BuildStepInputValueTypeName, R extends boolean>\n extends BuildStepInputProviderParams<T, R> {\n stepDisplayName: string;\n}\n\nexport class BuildStepInput<\n T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName,\n R extends boolean = boolean,\n> {\n public readonly id: string;\n public readonly stepDisplayName: string;\n public readonly defaultValue?: unknown;\n public readonly allowedValues?: unknown[];\n public readonly allowedValueTypeName: T;\n public readonly required: R;\n\n private _value?: unknown;\n\n public static createProvider(params: BuildStepInputProviderParams): BuildStepInputProvider {\n return (ctx, stepDisplayName) => new BuildStepInput(ctx, { ...params, stepDisplayName });\n }\n\n constructor(\n private readonly ctx: BuildStepGlobalContext,\n {\n id,\n stepDisplayName,\n allowedValues,\n defaultValue,\n required,\n allowedValueTypeName,\n }: BuildStepInputParams<T, R>\n ) {\n this.id = id;\n this.stepDisplayName = stepDisplayName;\n this.allowedValues = allowedValues;\n this.defaultValue = defaultValue;\n this.required = required;\n this.allowedValueTypeName = allowedValueTypeName;\n }\n\n public getValue({\n interpolationContext,\n }: {\n interpolationContext: JobInterpolationContext;\n }): R extends true ? BuildStepInputValueType<T> : BuildStepInputValueType<T> | undefined {\n const rawValue = this._value ?? this.defaultValue;\n if (this.required && rawValue === undefined) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required but it was not set.`\n );\n }\n\n const interpolatedValue = interpolateJobContext({\n target: rawValue,\n context: interpolationContext,\n });\n\n const valueDoesNotRequireInterpolation =\n interpolatedValue === undefined ||\n interpolatedValue === null ||\n typeof interpolatedValue === 'boolean' ||\n typeof interpolatedValue === 'number';\n let returnValue;\n if (valueDoesNotRequireInterpolation) {\n if (\n typeof interpolatedValue !== this.allowedValueTypeName &&\n interpolatedValue !== undefined\n ) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`\n );\n }\n returnValue = interpolatedValue as BuildStepInputValueType<T>;\n } else {\n // `valueDoesNotRequireInterpolation` checks that `rawValue` is not undefined\n // so this will never be true.\n assert(interpolatedValue !== undefined);\n const valueInterpolatedWithGlobalContext = this.ctx.interpolate(interpolatedValue);\n const valueInterpolatedWithOutputsAndGlobalContext = interpolateWithOutputs(\n valueInterpolatedWithGlobalContext,\n (path) => this.ctx.getStepOutputValue(path) ?? ''\n );\n returnValue = this.parseInputValueToAllowedType(valueInterpolatedWithOutputsAndGlobalContext);\n }\n return returnValue;\n }\n\n public get rawValue(): unknown {\n return this._value ?? this.defaultValue;\n }\n\n public set(value: unknown): BuildStepInput {\n if (this.required && value === undefined) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required.`\n );\n }\n\n this._value = value;\n return this;\n }\n\n public isRawValueOneOfAllowedValues(): boolean {\n const value = this._value ?? this.defaultValue;\n if (this.allowedValues === undefined || value === undefined) {\n return true;\n }\n return this.allowedValues.includes(value);\n }\n\n public isRawValueStepOrContextReference(): boolean {\n return (\n typeof this.rawValue === 'string' &&\n (!!BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX.exec(this.rawValue) ||\n // If value is an interpolation reference we're going to render whatever it evaluates to.\n // See `interpolateJobContext`.\n (this.rawValue.startsWith('${{') && this.rawValue.endsWith('}}')))\n );\n }\n\n private parseInputValueToAllowedType(\n value: string | object | boolean | number\n ): BuildStepInputValueType<T> {\n if (typeof value === 'object') {\n return value as BuildStepInputValueType<T>;\n }\n if (this.allowedValueTypeName === BuildStepInputValueTypeName.STRING) {\n return this.parseInputValueToString(value) as BuildStepInputValueType<T>;\n } else if (this.allowedValueTypeName === BuildStepInputValueTypeName.NUMBER) {\n return this.parseInputValueToNumber(value) as BuildStepInputValueType<T>;\n } else if (this.allowedValueTypeName === BuildStepInputValueTypeName.BOOLEAN) {\n return this.parseInputValueToBoolean(value) as BuildStepInputValueType<T>;\n } else {\n return this.parseInputValueToObject(value) as BuildStepInputValueType<T>;\n }\n }\n\n private parseInputValueToString(value: string | boolean | number): string {\n let parsedValue = value;\n try {\n parsedValue = JSON.parse(`\"${value}\"`);\n } catch (err) {\n if (!(err instanceof SyntaxError)) {\n throw err;\n }\n }\n return parsedValue as string;\n }\n\n private parseInputValueToNumber(value: string | boolean | number): number {\n const numberValue = Number(value);\n if (Number.isNaN(numberValue)) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`\n );\n }\n return numberValue;\n }\n\n private parseInputValueToBoolean(value: string | boolean | number): boolean {\n if (value === 'true' || value === true) {\n return true;\n } else if (value === 'false' || value === false) {\n return false;\n } else {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`\n );\n }\n }\n\n private parseInputValueToObject(value: string | boolean | number): Record<string, any> {\n try {\n return JSON.parse(value as string);\n } catch (e: any) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`,\n {\n cause: e,\n }\n );\n }\n }\n}\n\nexport function makeBuildStepInputByIdMap(inputs?: BuildStepInput[]): BuildStepInputById {\n if (inputs === undefined) {\n return {};\n }\n return inputs.reduce((acc, input) => {\n acc[input.id] = input;\n return acc;\n }, {} as BuildStepInputById);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuildStepOutput.js","sourceRoot":"","sources":["../src/BuildStepOutput.ts"],"names":[],"mappings":";;;AA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YACvB,KAAK,EAAE,IAAI,CAAC,MAAM;SACnB,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,UAAqC;QAC7D,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,SAAS,EAAE;YAClD,EAAE,EAAE,UAAU,CAAC,EAAE;YACjB,eAAe,EAAE,UAAU,CAAC,eAAe;YAC3C,QAAQ,EAAE,UAAU,CAAC,QAAQ;SAC9B,CAAC,CAAC;QACH,YAAY,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;QACvC,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AA9DD,0CA8DC;AAED,SAAgB,0BAA0B,CAAC,OAA2B;IACpE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACpC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACxB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAyB,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import { BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStepRuntimeError } from './errors.js';\n\nexport type BuildStepOutputById = Record<string, BuildStepOutput>;\nexport type BuildStepOutputProvider = (\n ctx: BuildStepGlobalContext,\n stepDisplayName: string\n) => BuildStepOutput;\n\ninterface BuildStepOutputProviderParams<R extends boolean = boolean> {\n id: string;\n required: R;\n}\n\ninterface BuildStepOutputParams<R extends boolean = boolean>\n extends BuildStepOutputProviderParams<R> {\n stepDisplayName: string;\n}\n\ntype BuildStepOutputValueType<R extends boolean = boolean> = R extends true\n ? string\n : string | undefined;\n\nexport interface SerializedBuildStepOutput<R extends boolean = boolean> {\n id: string;\n stepDisplayName: string;\n required: R;\n value?: string;\n}\n\nexport class BuildStepOutput<R extends boolean = boolean> {\n public readonly id: string;\n public readonly stepDisplayName: string;\n public readonly required: R;\n\n private _value?: string;\n\n public static createProvider(params: BuildStepOutputProviderParams): BuildStepOutputProvider {\n return (ctx, stepDisplayName) => new BuildStepOutput(ctx, { ...params, stepDisplayName });\n }\n\n constructor(\n // @ts-expect-error ctx is not used in this class but let's keep it here for consistency\n private readonly ctx: BuildStepGlobalContext | undefined,\n { id, stepDisplayName, required }: BuildStepOutputParams<R>\n ) {\n this.id = id;\n this.stepDisplayName = stepDisplayName;\n this.required = required;\n }\n\n public get rawValue(): string | undefined {\n return this._value;\n }\n\n public get value(): BuildStepOutputValueType<R> {\n if (this.required && this._value === undefined) {\n throw new BuildStepRuntimeError(\n `Output parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required but it was not set.`\n );\n }\n return this._value as BuildStepOutputValueType<R>;\n }\n\n public set(value: BuildStepOutputValueType<R>): BuildStepOutput {\n if (this.required && value === undefined) {\n throw new BuildStepRuntimeError(\n `Output parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required.`\n );\n }\n this._value = value;\n return this;\n }\n\n public serialize(): SerializedBuildStepOutput {\n return {\n id: this.id,\n stepDisplayName: this.stepDisplayName,\n required: this.required,\n value: this._value,\n };\n }\n\n public static deserialize(serialized: SerializedBuildStepOutput): BuildStepOutput {\n const deserialized = new BuildStepOutput(undefined, {\n id: serialized.id,\n stepDisplayName: serialized.stepDisplayName,\n required: serialized.required,\n });\n deserialized._value = serialized.value;\n return deserialized;\n }\n}\n\nexport function makeBuildStepOutputByIdMap(outputs?: BuildStepOutput[]): BuildStepOutputById {\n if (outputs === undefined) {\n return {};\n }\n return outputs.reduce((acc, output) => {\n acc[output.id] = output;\n return acc;\n }, {} as BuildStepOutputById);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuildWorkflow.js","sourceRoot":"","sources":["../src/BuildWorkflow.ts"],"names":[],"mappings":";;;AAKA,MAAa,aAAa;IAIxB,YACmB,GAA2B,EAC5C,EAAE,UAAU,EAAE,cAAc,EAAkE;QAD7E,QAA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AW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC;gBAC5E,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,CAAC;QACH,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,UAAU,CAAC;QACnB,CAAC;IACH,CAAC;IAEO,kBAAkB,CAAC,IAAe,EAAE,MAAwB,EAAE,UAAkB;QACtF,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC;YACrB,SAAS,EAAE,IAAI,CAAC,WAAW;YAC3B,MAAM;YACN,UAAU;SACX,CAAC,CAAC;IACL,CAAC;CACF;AA9DD,sCA8DC","sourcesContent":["import { BuildFunctionById } from './BuildFunction.js';\nimport { BuildStep } from './BuildStep.js';\nimport { BuildStepGlobalContext } from './BuildStepContext.js';\nimport { StepMetricResult } from './StepMetrics.js';\n\nexport class BuildWorkflow {\n public readonly buildSteps: BuildStep[];\n public readonly buildFunctions: BuildFunctionById;\n\n constructor(\n private readonly ctx: BuildStepGlobalContext,\n { buildSteps, buildFunctions }: { buildSteps: BuildStep[]; buildFunctions: BuildFunctionById }\n ) {\n this.buildSteps = buildSteps;\n this.buildFunctions = buildFunctions;\n }\n\n public async executeAsync(): Promise<void> {\n let maybeError: Error | null = null;\n for (const step of this.buildSteps) {\n let shouldExecuteStep = false;\n\n try {\n shouldExecuteStep = step.shouldExecuteStep();\n } catch (err: any) {\n step.ctx.logger.error({ err });\n step.ctx.logger.error(\n `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.`\n );\n maybeError = maybeError ?? err;\n this.ctx.markAsFailed();\n }\n\n if (shouldExecuteStep) {\n const startTime = performance.now();\n let stepResult: StepMetricResult;\n try {\n await step.executeAsync();\n stepResult = 'success';\n } catch (err: any) {\n stepResult = 'failed';\n maybeError = maybeError ?? err;\n this.ctx.markAsFailed();\n } finally {\n this.collectStepMetrics(step, stepResult!, performance.now() - startTime);\n }\n } else {\n step.skip();\n }\n }\n\n if (maybeError) {\n throw maybeError;\n }\n }\n\n private collectStepMetrics(step: BuildStep, result: StepMetricResult, durationMs: number): void {\n if (!step.__metricsId) {\n return;\n }\n\n this.ctx.addStepMetric({\n metricsId: step.__metricsId,\n result,\n durationMs,\n });\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuildWorkflowValidator.js","sourceRoot":"","sources":["../src/BuildWorkflowValidator.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAG1B,2DAAkE;AAElE,2CAAmE;AACnE,kEAA4D;AAC5D,yDAAmD;AACnD,qDAAsD;AAEtD,MAAa,sBAAsB;IACjC,YAA6B,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAEjD,KAAK,CAAC,aAAa;QACxB,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC;QAChD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAC;QAClE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,8BAAkB,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAEO,qBAAqB;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,E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BAAwB,mBAAmB,aAAa,CAAC,EAAE,yCAAyC,CACnJ,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5JD,wDA4JC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\n\nimport { BuildStep } from './BuildStep.js';\nimport { BuildStepInputValueTypeName } from './BuildStepInput.js';\nimport { BuildWorkflow } from './BuildWorkflow.js';\nimport { BuildConfigError, BuildWorkflowError } from './errors.js';\nimport { duplicates } from './utils/expodash/duplicates.js';\nimport { nullthrows } from './utils/nullthrows.js';\nimport { findOutputPaths } from './utils/template.js';\n\nexport class BuildWorkflowValidator {\n constructor(private readonly workflow: BuildWorkflow) {}\n\n public async validateAsync(): Promise<void> {\n const errors: BuildConfigError[] = [];\n errors.push(...this.validateUniqueStepIds());\n errors.push(...this.validateInputs());\n errors.push(...this.validateAllowedPlatforms());\n errors.push(...(await this.validateCustomFunctionModulesAsync()));\n if (errors.length !== 0) {\n throw new BuildWorkflowError('Build workflow is invalid.', errors);\n }\n }\n\n private validateUniqueStepIds(): BuildConfigError[] {\n const stepIds = this.workflow.buildSteps.map(({ id }) => id);\n const duplicatedStepIds = duplicates(stepIds);\n if (duplicatedStepIds.length === 0) {\n return [];\n } else {\n const error = new BuildConfigError(\n `Duplicated step IDs: ${duplicatedStepIds.map((i) => `\"${i}\"`).join(', ')}`\n );\n return [error];\n }\n }\n\n private validateInputs(): BuildConfigError[] {\n const errors: BuildConfigError[] = [];\n\n const allStepIds = new Set(this.workflow.buildSteps.map((s) => s.id));\n const visitedStepByStepId: Record<string, BuildStep> = {};\n for (const currentStep of this.workflow.buildSteps) {\n for (const currentStepInput of currentStep.inputs ?? []) {\n if (currentStepInput.required && currentStepInput.rawValue === undefined) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" is required but it was not set.`\n );\n errors.push(error);\n }\n\n const currentType =\n typeof currentStepInput.rawValue === 'object'\n ? BuildStepInputValueTypeName.JSON\n : typeof currentStepInput.rawValue;\n if (\n currentStepInput.rawValue !== undefined &&\n !currentStepInput.isRawValueStepOrContextReference() &&\n currentType !== currentStepInput.allowedValueTypeName\n ) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${\n currentStep.displayName\n }\" is set to \"${\n typeof currentStepInput.rawValue === 'object'\n ? JSON.stringify(currentStepInput.rawValue)\n : currentStepInput.rawValue\n }\" which is not of type \"${\n currentStepInput.allowedValueTypeName\n }\" or is not step or context reference.`\n );\n errors.push(error);\n }\n\n if (currentStepInput.defaultValue === undefined) {\n continue;\n }\n if (!currentStepInput.isRawValueOneOfAllowedValues()) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${\n currentStep.displayName\n }\" is set to \"${currentStepInput.rawValue}\" which is not one of the allowed values: ${nullthrows(\n currentStepInput.allowedValues\n )\n .map((i) => `\"${i}\"`)\n .join(', ')}.`\n );\n errors.push(error);\n }\n const paths =\n typeof currentStepInput.defaultValue === 'string'\n ? findOutputPaths(currentStepInput.defaultValue)\n : [];\n for (const { stepId: referencedStepId, outputId: referencedStepOutputId } of paths) {\n if (!(referencedStepId in visitedStepByStepId)) {\n if (allStepIds.has(referencedStepId)) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an output parameter from the future step \"${referencedStepId}\".`\n );\n errors.push(error);\n } else {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an output parameter from a non-existent step \"${referencedStepId}\".`\n );\n errors.push(error);\n }\n } else {\n if (!visitedStepByStepId[referencedStepId].hasOutputParameter(referencedStepOutputId)) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an undefined output parameter \"${referencedStepOutputId}\" from step \"${referencedStepId}\".`\n );\n errors.push(error);\n }\n }\n }\n }\n visitedStepByStepId[currentStep.id] = currentStep;\n }\n\n return errors;\n }\n\n private validateAllowedPlatforms(): BuildConfigError[] {\n const errors: BuildConfigError[] = [];\n for (const step of this.workflow.buildSteps) {\n if (!step.canBeRunOnRuntimePlatform()) {\n const error = new BuildConfigError(\n `Step \"${step.displayName}\" is not allowed on platform \"${\n step.ctx.global.runtimePlatform\n }\". Allowed platforms for this step are: ${nullthrows(\n step.supportedRuntimePlatforms,\n `step.supportedRuntimePlatforms can't be falsy if canBeRunOnRuntimePlatform() is false`\n )\n .map((p) => `\"${p}\"`)\n .join(', ')}.`\n );\n errors.push(error);\n }\n }\n return errors;\n }\n\n private async validateCustomFunctionModulesAsync(): Promise<BuildConfigError[]> {\n const errors: BuildConfigError[] = [];\n for (const buildFunction of Object.values(this.workflow.buildFunctions)) {\n if (!buildFunction.customFunctionModulePath) {\n continue;\n }\n\n if (!(await fs.exists(buildFunction.customFunctionModulePath))) {\n const error = new BuildConfigError(\n `Custom function module path \"${buildFunction.customFunctionModulePath}\" for function \"${buildFunction.id}\" does not exist.`\n );\n errors.push(error);\n continue;\n }\n\n if (!(await fs.exists(path.join(buildFunction.customFunctionModulePath, 'package.json')))) {\n const error = new BuildConfigError(\n `Custom function module path \"${buildFunction.customFunctionModulePath}\" for function \"${buildFunction.id}\" does not contain a package.json file.`\n );\n errors.push(error);\n }\n }\n return errors;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"StepsConfigParser.js","sourceRoot":"","sources":["../src/StepsConfigParser.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAiC;AAEjC,uDAO6B;AAG7B,mEAIiC;AAEjC,iDAA2C;AAC3C,uEAAiE;AACjE,2CAA+C;AAC/C,6DAAuD;AAEvD,MAAa,iBAAkB,SAAQ,8CAAoB;IAGzD,YACE,GAA2B,EAC3B,EACE,KAAK,EACL,iBAAiB,EACjB,sBAAsB,GAKvB;QAED,KAAK,C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AK,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gBACd,kCAAkC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QACD,MAAM,8BAA8B,GAAG,KAAK,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QACtF,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAC5D,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACvE,MAAM,oCAAoC,GAAG,8BAA8B,CAAC,MAAM,CAChF,CAAC,6BAA6B,EAAE,EAAE;YAChC,OAAO,CACL,CAAC,sBAAsB,CAAC,GAAG,CAAC,6BAA6B,CAAC;gBAC1D,CAAC,4BAA4B,CAAC,GAAG,CAAC,6BAA6B,CAAC,CACjE,CAAC;QACJ,CAAC,CACF,CAAC;QACF,IAAI,oCAAoC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpD,MAAM,IAAI,4BAAgB,CACxB,mCAAmC,oCAAoC;iBACpE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;iBACpB,IAAI,CAAC,IAAI,CAAC,GAAG,CACjB,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAnMD,8CAmMC","sourcesContent":["import assert from 'node:assert';\n\nimport {\n FunctionStep,\n isStepFunctionStep,\n isStepShellStep,\n ShellStep,\n Step,\n validateSteps,\n} from '@expo/eas-build-job';\n\nimport { BuildFunction, BuildFunctionById } from './BuildFunction.js';\nimport {\n BuildFunctionGroup,\n BuildFunctionGroupById,\n createBuildFunctionGroupByIdMapping,\n} from './BuildFunctionGroup.js';\nimport { BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStep } from './BuildStep.js';\nimport { AbstractConfigParser } from './AbstractConfigParser.js';\nimport { BuildConfigError } from './errors.js';\nimport { BuildStepOutput } from './BuildStepOutput.js';\n\nexport class StepsConfigParser extends AbstractConfigParser {\n private readonly steps: Step[];\n\n constructor(\n ctx: BuildStepGlobalContext,\n {\n steps,\n externalFunctions,\n externalFunctionGroups,\n }: {\n steps: Step[];\n externalFunctions?: BuildFunction[];\n externalFunctionGroups?: BuildFunctionGroup[];\n }\n ) {\n super(ctx, {\n externalFunctions,\n externalFunctionGroups,\n });\n\n this.steps = steps;\n }\n\n protected async parseConfigToBuildStepsAndBuildFunctionByIdMappingAsync(): Promise<{\n buildSteps: BuildStep[];\n buildFunctionById: BuildFunctionById;\n }> {\n const validatedSteps = validateSteps(this.steps);\n StepsConfigParser.validateAllFunctionsExist(validatedSteps, {\n externalFunctionIds: this.getExternalFunctionFullIds(),\n externalFunctionGroupIds: this.getExternalFunctionGroupFullIds(),\n });\n\n const buildFunctionById = this.createBuildFunctionByIdMappingForExternalFunctions();\n const buildFunctionGroupById = createBuildFunctionGroupByIdMapping(\n this.externalFunctionGroups ?? []\n );\n\n const buildSteps: BuildStep[] = [];\n for (const stepConfig of validatedSteps) {\n buildSteps.push(\n ...this.createBuildStepsFromStepConfig(stepConfig, {\n buildFunctionById,\n buildFunctionGroupById,\n })\n );\n }\n\n return {\n buildSteps,\n buildFunctionById,\n };\n }\n\n private createBuildFunctionByIdMappingForExternalFunctions(): BuildFunctionById {\n const result: BuildFunctionById = {};\n\n if (this.externalFunctions === undefined) {\n return result;\n }\n\n for (const buildFunction of this.externalFunctions) {\n const fullId = buildFunction.getFullId();\n result[fullId] = buildFunction;\n }\n return result;\n }\n\n private createBuildStepsFromStepConfig(\n stepConfig: Step,\n {\n buildFunctionById,\n buildFunctionGroupById,\n }: {\n buildFunctionById: BuildFunctionById;\n buildFunctionGroupById: BuildFunctionGroupById;\n }\n ): BuildStep[] {\n if (isStepShellStep(stepConfig)) {\n return [this.createBuildStepFromShellStepConfig(stepConfig)];\n } else if (isStepFunctionStep(stepConfig)) {\n return this.createBuildStepsFromFunctionStepConfig(stepConfig, {\n buildFunctionById,\n buildFunctionGroupById,\n });\n } else {\n throw new BuildConfigError(\n 'Invalid job step configuration detected. Step must be shell or function step'\n );\n }\n }\n\n private createBuildStepFromShellStepConfig(step: ShellStep): BuildStep {\n const id = BuildStep.getNewId(step.id);\n const displayName = BuildStep.getDisplayName({ id, name: step.name, command: step.run });\n const outputs =\n step.outputs && this.createBuildStepOutputsFromDefinition(step.outputs, displayName);\n return new BuildStep(this.ctx, {\n id,\n outputs,\n name: step.name,\n displayName,\n workingDirectory: step.working_directory,\n shell: step.shell,\n command: step.run,\n env: step.env,\n ifCondition: step.if,\n __metricsId: step.__metrics_id,\n });\n }\n\n private createBuildStepsFromFunctionStepConfig(\n step: FunctionStep,\n {\n buildFunctionById,\n buildFunctionGroupById,\n }: {\n buildFunctionById: BuildFunctionById;\n buildFunctionGroupById: BuildFunctionGroupById;\n }\n ): BuildStep[] {\n const functionId = step.uses;\n const maybeFunctionGroup = buildFunctionGroupById[functionId];\n if (maybeFunctionGroup) {\n // TODO: allow to set id, name, working_directory, shell, env and if for function groups\n return maybeFunctionGroup.createBuildStepsFromFunctionGroupCall(this.ctx, {\n callInputs: step.with,\n });\n }\n\n const buildFunction = buildFunctionById[functionId];\n assert(buildFunction, 'function ID must be ID of function or function group');\n\n return [\n buildFunction.createBuildStepFromFunctionCall(this.ctx, {\n id: step.id,\n name: step.name,\n callInputs: step.with,\n workingDirectory: step.working_directory,\n shell: step.shell,\n env: step.env,\n ifCondition: step.if,\n }),\n ];\n }\n\n private createBuildStepOutputsFromDefinition(\n stepOutputs: Required<ShellStep>['outputs'],\n stepDisplayName: string\n ): BuildStepOutput[] {\n return stepOutputs.map(\n (entry) =>\n new BuildStepOutput(this.ctx, {\n id: entry.name,\n stepDisplayName,\n required: entry.required ?? true,\n })\n );\n }\n\n private static validateAllFunctionsExist(\n steps: Step[],\n {\n externalFunctionIds,\n externalFunctionGroupIds,\n }: {\n externalFunctionIds: string[];\n externalFunctionGroupIds: string[];\n }\n ): void {\n const calledFunctionsOrFunctionGroupsSet = new Set<string>();\n for (const step of steps) {\n if (step.uses) {\n calledFunctionsOrFunctionGroupsSet.add(step.uses);\n }\n }\n const calledFunctionsOrFunctionGroup = Array.from(calledFunctionsOrFunctionGroupsSet);\n const externalFunctionIdsSet = new Set(externalFunctionIds);\n const externalFunctionGroupsIdsSet = new Set(externalFunctionGroupIds);\n const nonExistentFunctionsOrFunctionGroups = calledFunctionsOrFunctionGroup.filter(\n (calledFunctionOrFunctionGroup) => {\n return (\n !externalFunctionIdsSet.has(calledFunctionOrFunctionGroup) &&\n !externalFunctionGroupsIdsSet.has(calledFunctionOrFunctionGroup)\n );\n }\n );\n if (nonExistentFunctionsOrFunctionGroups.length > 0) {\n throw new BuildConfigError(\n `Calling non-existent functions: ${nonExistentFunctionsOrFunctionGroups\n .map((f) => `\"${f}\"`)\n .join(', ')}.`\n );\n }\n }\n}\n"]}
@@ -1,18 +0,0 @@
1
- import { StaticJobInterpolationContext } from '@expo/eas-build-job';
2
- import { bunyan } from '@expo/logger';
3
- import { ExternalBuildContextProvider } from '../BuildStepContext.js';
4
- import { BuildRuntimePlatform } from '../BuildRuntimePlatform.js';
5
- import { BuildStepEnv } from '../BuildStepEnv.js';
6
- export declare class CliContextProvider implements ExternalBuildContextProvider {
7
- readonly logger: bunyan;
8
- readonly runtimePlatform: BuildRuntimePlatform;
9
- readonly projectSourceDirectory: string;
10
- readonly projectTargetDirectory: string;
11
- readonly defaultWorkingDirectory: string;
12
- readonly buildLogsDirectory: string;
13
- private _env;
14
- constructor(logger: bunyan, runtimePlatform: BuildRuntimePlatform, projectSourceDirectory: string, projectTargetDirectory: string, defaultWorkingDirectory: string, buildLogsDirectory: string);
15
- get env(): BuildStepEnv;
16
- staticContext(): Omit<StaticJobInterpolationContext, 'steps'>;
17
- updateEnv(env: BuildStepEnv): void;
18
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";;;;;;;AAAA,g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AAQ,CAAC,YAAY,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC3C,MAAM,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACrD,MAAM,QAAQ,GAAyB,CAAC,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCACrD,OAAO,CAAC,QAAQ,CAAyB,CAAC;AAE5C,IAAI,CAAC,kBAAkB,IAAI,CAAC,4BAA4B,EAAE,CAAC;IACzD,OAAO,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACrF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC;AACnE,MAAM,gBAAgB,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,4BAA4B,CAAC,CAAC;AAEnF,QAAQ,CAAC,UAAU,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC7D,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;IACtC,IAAI,GAAG,YAAY,8BAAkB,EAAE,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAC9D,KAAK,MAAM,WAAW,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import path from 'path';\n\nimport { Job, Metadata, StaticJobInterpolationContext } from '@expo/eas-build-job';\nimport { bunyan, createLogger } from '@expo/logger';\n\nimport { BuildConfigParser } from '../BuildConfigParser.js';\nimport { ExternalBuildContextProvider, BuildStepGlobalContext } from '../BuildStepContext.js';\nimport { BuildWorkflowError } from '../errors.js';\nimport { BuildRuntimePlatform } from '../BuildRuntimePlatform.js';\nimport { BuildStepEnv } from '../BuildStepEnv.js';\n\nconst logger = createLogger({\n name: 'steps-cli',\n level: 'info',\n});\n\nexport class CliContextProvider implements ExternalBuildContextProvider {\n private _env: BuildStepEnv = {};\n\n constructor(\n public readonly logger: bunyan,\n public readonly runtimePlatform: BuildRuntimePlatform,\n public readonly projectSourceDirectory: string,\n public readonly projectTargetDirectory: string,\n public readonly defaultWorkingDirectory: string,\n public readonly buildLogsDirectory: string\n ) {}\n public get env(): BuildStepEnv {\n return this._env;\n }\n public staticContext(): Omit<StaticJobInterpolationContext, 'steps'> {\n return {\n job: {} as Job,\n metadata: {} as Metadata,\n expoApiServerURL: 'http://api.expo.test',\n };\n }\n public updateEnv(env: BuildStepEnv): void {\n this._env = env;\n }\n}\n\nasync function runAsync(\n configPath: string,\n relativeProjectDirectory: string,\n runtimePlatform: BuildRuntimePlatform\n): Promise<void> {\n const ctx = new BuildStepGlobalContext(\n new CliContextProvider(\n logger,\n runtimePlatform,\n relativeProjectDirectory,\n relativeProjectDirectory,\n relativeProjectDirectory,\n relativeProjectDirectory\n ),\n false\n );\n const parser = new BuildConfigParser(ctx, {\n configPath,\n });\n const workflow = await parser.parseAsync();\n await workflow.executeAsync();\n}\n\nconst relativeConfigPath = process.argv[2];\nconst relativeProjectDirectoryPath = process.argv[3];\nconst platform: BuildRuntimePlatform = (process.argv[4] ??\n process.platform) as BuildRuntimePlatform;\n\nif (!relativeConfigPath || !relativeProjectDirectoryPath) {\n console.error('Usage: yarn cli config.yml path/to/project/directory [darwin|linux]');\n process.exit(1);\n}\n\nconst configPath = path.resolve(process.cwd(), relativeConfigPath);\nconst workingDirectory = path.resolve(process.cwd(), relativeProjectDirectoryPath);\n\nrunAsync(configPath, workingDirectory, platform).catch((err) => {\n logger.error({ err }, 'Build failed');\n if (err instanceof BuildWorkflowError) {\n logger.error('Failed to parse the custom build config file.');\n for (const detailedErr of err.errors) {\n logger.error({ err: detailedErr });\n }\n }\n});\n"]}
@@ -1,19 +0,0 @@
1
- export { BuildStepContext } from './BuildStepContext.js';
2
- export { readAndValidateBuildConfigFromPathAsync } from './BuildConfig.js';
3
- export { BuildConfigParser } from './BuildConfigParser.js';
4
- export { StepsConfigParser } from './StepsConfigParser.js';
5
- export { BuildFunction } from './BuildFunction.js';
6
- export { BuildRuntimePlatform } from './BuildRuntimePlatform.js';
7
- export { BuildStepInput, BuildStepInputValueTypeName } from './BuildStepInput.js';
8
- export { BuildStepOutput } from './BuildStepOutput.js';
9
- export { BuildStepGlobalContext, ExternalBuildContextProvider } from './BuildStepContext.js';
10
- export { BuildWorkflow } from './BuildWorkflow.js';
11
- export { BuildStepEnv } from './BuildStepEnv.js';
12
- export { BuildFunctionGroup } from './BuildFunctionGroup.js';
13
- export { BuildStep } from './BuildStep.js';
14
- export * as errors from './errors.js';
15
- export * from './interpolation.js';
16
- export * from './utils/shell/spawn.js';
17
- export * from './utils/jsepEval.js';
18
- export * from './utils/hashFiles.js';
19
- export { StepMetric, StepMetricResult, StepMetricsCollection } from './StepMetrics.js';
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAyD;AAAhD,uHAAA,gBAAgB,OAAA;AACzB,mDAA2E;AAAlE,yIAAA,uCAAuC,OAAA;AAChD,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA;AAC7B,yDAAkF;AAAzE,mHAAA,cAAc,OAAA;AAAE,gIAAA,2BAA2B,OAAA;AACpD,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,6DAA6F;AAApF,6HAAA,sBAAsB,OAAA;AAC/B,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AAEtB,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAC3B,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAClB,sDAAsC;AACtC,qDAAmC;AACnC,yDAAuC;AACvC,sDAAoC;AACpC,uDAAqC","sourcesContent":["export { BuildStepContext } from './BuildStepContext.js';\nexport { readAndValidateBuildConfigFromPathAsync } from './BuildConfig.js';\nexport { BuildConfigParser } from './BuildConfigParser.js';\nexport { StepsConfigParser } from './StepsConfigParser.js';\nexport { BuildFunction } from './BuildFunction.js';\nexport { BuildRuntimePlatform } from './BuildRuntimePlatform.js';\nexport { BuildStepInput, BuildStepInputValueTypeName } from './BuildStepInput.js';\nexport { BuildStepOutput } from './BuildStepOutput.js';\nexport { BuildStepGlobalContext, ExternalBuildContextProvider } from './BuildStepContext.js';\nexport { BuildWorkflow } from './BuildWorkflow.js';\nexport { BuildStepEnv } from './BuildStepEnv.js';\nexport { BuildFunctionGroup } from './BuildFunctionGroup.js';\nexport { BuildStep } from './BuildStep.js';\nexport * as errors from './errors.js';\nexport * from './interpolation.js';\nexport * from './utils/shell/spawn.js';\nexport * from './utils/jsepEval.js';\nexport * from './utils/hashFiles.js';\nexport { StepMetric, StepMetricResult, StepMetricsCollection } from './StepMetrics.js';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"interpolation.js","sourceRoot":"","sources":["../src/interpolation.ts"],"names":[],"mappings":";;AAIA,sDA8BC;AAhCD,qDAA+C;AAE/C,SAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,OAAO,GAIR;IACC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,mFAAmF;QACnF,0GAA0G;QAC1G,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACtD,OAAO,IAAA,sBAAQ,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAChD,CAAC;QAED,wFAAwF;QACxF,8DAA8D;QAC9D,OAAO,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;YAC/D,OAAO,GAAG,IAAA,sBAAQ,EAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAClF,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,EAAE,CAAC;QAChD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;YAC3C,GAAG;YACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;SAClD,CAAC,CACH,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { JobInterpolationContext } from '@expo/eas-build-job';\n\nimport { jsepEval } from './utils/jsepEval.js';\n\nexport function interpolateJobContext({\n target,\n context,\n}: {\n target: unknown;\n context: JobInterpolationContext;\n}): unknown {\n if (typeof target === 'string') {\n // If the value is e.g. `build: ${{ inputs.build }}`, we will interpolate the value\n // without changing `inputs.build` type, i.e. if it is an object it'll be like `build: {...inputs.build}`.\n if (target.startsWith('${{') && target.endsWith('}}')) {\n return jsepEval(target.slice(3, -2), context);\n }\n\n // Otherwise we replace all occurrences of `${{...}}` with the result of the expression.\n // e.g. `echo ${{ build.profile }}` becomes `echo production`.\n return target.replace(/\\$\\{\\{(.+?)\\}\\}/g, (_match, expression) => {\n return `${jsepEval(expression, context)}`;\n });\n } else if (Array.isArray(target)) {\n return target.map((value) => interpolateJobContext({ target: value, context }));\n } else if (typeof target === 'object' && target) {\n return Object.fromEntries(\n Object.entries(target).map(([key, value]) => [\n key,\n interpolateJobContext({ target: value, context }),\n ])\n );\n }\n return target;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"runCustomFunction.js","sourceRoot":"","sources":["../../src/scripts/runCustomFunction.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,yCAA4C;AAE5C,wEAAyC;AAEzC,8DAAwD;AACxD,kEAGoC;AACpC,gEAA0D;AAE1D,sDAAqD;AAErD,KAAK,UAAU,wBAAwB;IACrC,MAAM,kCAAkC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAErC,IAAA,gBAAM,EAAC,kCAAkC,EAAE,gDAAgD,CAAC,CAAC;IAC7F,IAAA,gBAAM,EAAC,YAAY,EAAE,sCAAsC,CAAC,CAAC;IAE7D,IAAI,2BAAmE,CAAC;IACxE,IAAI,CAAC;QACH,2BAA2B,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC1D,MAAM,CAAC,CAAC;IACV,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC;QAC1B,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE;oBACN,KAAK,EAAE,CAAC,GAAQ,EAAE,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E,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;gBACzC,GAAG;gBACH,KAAK,EAAE,MAAM;aACd,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IACD,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED,KAAK,wBAAwB,EAAE,CAAC","sourcesContent":["import assert from 'assert';\n\nimport { createLogger } from '@expo/logger';\nimport { SpawnPromise, SpawnResult } from '@expo/spawn-async';\nimport cloneDeep from 'lodash.clonedeep';\n\nimport { BuildStepOutput } from '../BuildStepOutput.js';\nimport {\n SerializedCustomBuildFunctionArguments,\n deserializeInputs,\n} from '../utils/customFunction.js';\nimport { BuildStepContext } from '../BuildStepContext.js';\nimport { BuildStepFunction } from '../BuildStep.js';\nimport { spawnAsync } from '../utils/shell/spawn.js';\n\nasync function runCustomJsFunctionAsync(): Promise<void> {\n const customJavascriptFunctionModulePath = process.argv[2];\n const functionArgs = process.argv[3];\n\n assert(customJavascriptFunctionModulePath, 'customJavascriptFunctionModulePath is required');\n assert(functionArgs, 'serializedFunctionParams is required');\n\n let serializedFunctionArguments: SerializedCustomBuildFunctionArguments;\n try {\n serializedFunctionArguments = JSON.parse(functionArgs);\n } catch (e) {\n console.error('Failed to parse serializedFunctionParams');\n throw e;\n }\n\n const logger = createLogger({\n name: 'customFunctionLogger',\n streams: [\n {\n type: 'raw',\n stream: {\n write: (rec: any) => {\n if (rec) {\n switch (rec.level) {\n case 20: // Debug level\n if (rec.msg) {\n console.debug(rec.msg);\n }\n break;\n case 30: // Info level\n if (rec.msg) {\n console.log(rec.msg);\n }\n break;\n case 40: // Warn level\n if (rec.msg) {\n console.warn(rec.msg);\n }\n break;\n case 50: // Error level\n case 60: // Fatal level\n if (rec.msg) {\n console.error(rec.msg);\n }\n break;\n default:\n break;\n }\n }\n },\n },\n },\n ],\n });\n\n const ctx = BuildStepContext.deserialize(serializedFunctionArguments.ctx, logger);\n const inputs = deserializeInputs(serializedFunctionArguments.inputs);\n const outputs = Object.fromEntries(\n Object.entries(serializedFunctionArguments.outputs).map(([id, output]) => [\n id,\n BuildStepOutput.deserialize(output),\n ])\n );\n const env = serializedFunctionArguments.env;\n const envBefore = cloneDeep(serializedFunctionArguments.env);\n\n let customModule: { default: BuildStepFunction };\n try {\n customModule = await require(customJavascriptFunctionModulePath);\n } catch (e) {\n console.error('Failed to load custom function module');\n throw e;\n }\n\n const customJavascriptFunction = customModule.default;\n\n await customJavascriptFunction(ctx, { inputs, outputs, env });\n\n const promises: SpawnPromise<SpawnResult>[] = [];\n for (const output of Object.values(outputs)) {\n if (output.rawValue) {\n assert(output.value, 'output.value is required');\n promises.push(\n spawnAsync('set-output', [output.id, output.value], {\n env,\n stdio: 'pipe',\n })\n );\n }\n }\n for (const envName of Object.keys(env)) {\n const envValue = env[envName];\n if (envValue !== envBefore[envName] && envValue) {\n promises.push(\n spawnAsync('set-env', [envName, envValue], {\n env,\n stdio: 'pipe',\n })\n );\n }\n }\n await Promise.all(promises);\n}\n\nvoid runCustomJsFunctionAsync();\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"customFunction.js","sourceRoot":"","sources":["../../src/utils/customFunction.ts"],"names":[],"mappings":";;;;;;AAyBA,0CASC;AAED,8CASC;AAED,4DAuCC;AAtFD,gDAAwB;AAExB,yCAA0C;AAC1C,wDAA0B;AAO1B,+CAA8C;AAE9C,MAAM,WAAW,GAAG,IAAA,yBAAa,GAAE,CAAC;AAEvB,QAAA,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAC;AAW1F,SAAgB,eAAe,CAC7B,MAAkD;IAElD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;QAC1C,EAAE;QACF,EAAE,eAAe,EAAE,KAAK,KAAK,S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GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CACxE;YACD,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE;SACrB,CAAC;QACF,IAAI,CAAC;YACH,MAAM,IAAA,qBAAU,EACd,MAAM,EACN;gBACE,cAAI,CAAC,IAAI,CAAC,oBAAY,EAAE,uBAAuB,CAAC;gBAChD,wBAAwB;gBACxB,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC;aACpC,EACD;gBACE,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,GAAG,EAAE,GAAG,CAAC,gBAAgB;gBACzB,GAAG;gBACH,KAAK,EAAE,MAAM;aACd,CACF,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\n\nimport { createContext } from 'this-file';\nimport fs from 'fs-extra';\n\nimport { BuildStepFunction } from '../BuildStep.js';\nimport { BuildStepEnv } from '../BuildStepEnv.js';\nimport { SerializedBuildStepOutput } from '../BuildStepOutput.js';\nimport { SerializedBuildStepContext } from '../BuildStepContext.js';\n\nimport { spawnAsync } from './shell/spawn.js';\n\nconst thisFileCtx = createContext();\n\nexport const SCRIPTS_PATH = path.join(thisFileCtx.dirname, '../../dist_commonjs/scripts');\n\ntype SerializedBuildStepInput = { serializedValue: string | undefined };\n\nexport interface SerializedCustomBuildFunctionArguments {\n env: BuildStepEnv;\n inputs: Record<string, SerializedBuildStepInput>;\n outputs: Record<string, SerializedBuildStepOutput>;\n ctx: SerializedBuildStepContext;\n}\n\nexport function serializeInputs(\n inputs: Parameters<BuildStepFunction>[1]['inputs']\n): SerializedCustomBuildFunctionArguments['inputs'] {\n return Object.fromEntries(\n Object.entries(inputs).map(([id, input]) => [\n id,\n { serializedValue: input === undefined ? undefined : JSON.stringify(input.value) },\n ])\n );\n}\n\nexport function deserializeInputs(\n inputs: SerializedCustomBuildFunctionArguments['inputs']\n): Parameters<BuildStepFunction>[1]['inputs'] {\n return Object.fromEntries(\n Object.entries(inputs).map(([id, { serializedValue }]) => [\n id,\n { value: serializedValue === undefined ? undefined : JSON.parse(serializedValue) },\n ])\n );\n}\n\nexport function createCustomFunctionCall(rawCustomFunctionModulePath: string): BuildStepFunction {\n return async (ctx, { env, inputs, outputs }) => {\n let customFunctionModulePath = rawCustomFunctionModulePath;\n if (!(await fs.exists(ctx.global.projectSourceDirectory))) {\n const relative = path.relative(\n path.resolve(ctx.global.projectSourceDirectory),\n customFunctionModulePath\n );\n customFunctionModulePath = path.resolve(\n path.join(ctx.global.projectTargetDirectory, relative)\n );\n }\n const serializedArguments: SerializedCustomBuildFunctionArguments = {\n env,\n inputs: serializeInputs(inputs),\n outputs: Object.fromEntries(\n Object.entries(outputs).map(([id, output]) => [id, output.serialize()])\n ),\n ctx: ctx.serialize(),\n };\n try {\n await spawnAsync(\n 'node',\n [\n path.join(SCRIPTS_PATH, 'runCustomFunction.cjs'),\n customFunctionModulePath,\n JSON.stringify(serializedArguments),\n ],\n {\n logger: ctx.logger,\n cwd: ctx.workingDirectory,\n env,\n stdio: 'pipe',\n }\n );\n } catch {\n throw new Error(`Custom function exited with non-zero exit code.`);\n }\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"bin.js","sourceRoot":"","sources":["../../../src/utils/shell/bin.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,yCAA0C;AAE1C,MAAM,GAAG,GAAG,IAAA,yBAAa,GAAE,CAAC;AAEf,QAAA,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import path from 'path';\n\nimport { createContext } from 'this-file';\n\nconst ctx = createContext();\n\nexport const BIN_PATH = path.join(ctx.dirname, '../../../bin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AAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,wCAAwC,CAC/C,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI,CACf,CAAC;AACJ,CAAC;AAOD,SAAgB,eAAe,CAAC,cAAsB;IACpD,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,2CAAmC,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9F,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,eAAe,CAAC,wBAAgC;IAC9D,MAAM,MAAM,GAAG,wBAAwB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,4BAAgB,CACxB,gKAAgK,wBAAwB,GAAG,CAC5L,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC;IAClC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["import get from 'lodash.get';\nimport cloneDeep from 'lodash.clonedeep';\n\nimport { BuildStepInputValueTypeName } from '../BuildStepInput.js';\nimport { BuildConfigError, BuildStepRuntimeError } from '../errors.js';\n\nimport { nullthrows } from './nullthrows.js';\n\nexport const BUILD_STEP_INPUT_EXPRESSION_REGEXP = /\\${\\s*(inputs\\.[\\S]+)\\s*}/;\nexport const BUILD_STEP_OUTPUT_EXPRESSION_REGEXP = /\\${\\s*(steps\\.[\\S]+)\\s*}/;\nexport const BUILD_GLOBAL_CONTEXT_EXPRESSION_REGEXP = /\\${\\s*(eas\\.[\\S]+)\\s*}/;\nexport const BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX = /\\${\\s*((steps|eas)\\.[\\S]+)\\s*}/;\n\nexport function interpolateWithInputs(\n templateString: string,\n inputs: Record<string, string>\n): string {\n return interpolate(templateString, BUILD_STEP_INPUT_EXPRESSION_REGEXP, inputs);\n}\n\nexport function interpolateWithOutputs<InterpolableType extends string | object>(\n interpolableValue: InterpolableType,\n fn: (path: string) => string\n): InterpolableType {\n if (typeof interpolableValue === 'string') {\n return interpolateStringWithOutputs(interpolableValue, fn) as InterpolableType;\n } else {\n return interpolateObjectWithOutputs(interpolableValue, fn) as InterpolableType;\n }\n}\n\nexport function interpolateStringWithOutputs(\n templateString: string,\n fn: (path: string) => string\n): string {\n return interpolate(templateString, BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, fn);\n}\n\nexport function interpolateObjectWithOutputs(\n interpolableObject: object,\n fn: (path: string) => string\n): object {\n const interpolableObjectCopy = cloneDeep(interpolableObject);\n Object.keys(interpolableObject).forEach((property) => {\n const propertyValue = interpolableObject[property as keyof typeof interpolableObject];\n if (['string', 'object'].includes(typeof propertyValue)) {\n interpolableObjectCopy[property as keyof typeof interpolableObjectCopy] =\n interpolateWithOutputs(propertyValue, fn);\n }\n });\n return interpolableObjectCopy;\n}\n\nexport function getObjectValueForInterpolation(\n path: string,\n obj: Record<string, unknown>\n): string | number | boolean | null {\n const value = get(obj, path);\n\n if (value === undefined) {\n throw new BuildStepRuntimeError(\n `Object field \"${path}\" does not exist. Ensure you are using the correct field name.`\n );\n }\n\n if (!isAllowedValueTypeForObjectInterpolation(value)) {\n throw new BuildStepRuntimeError(\n `EAS context field \"${path}\" is not of type ${Object.values(BuildStepInputValueTypeName).join(\n ', '\n )}, or undefined. It is of type \"${typeof value}\". We currently only support accessing string or undefined values from the EAS context.`\n );\n }\n\n if (value !== null && typeof value === 'object') {\n return JSON.stringify(value);\n }\n\n return value;\n}\n\nexport function interpolateWithGlobalContext<InterpolableType extends string | object>(\n interpolableValue: InterpolableType,\n fn: (path: string) => string\n): InterpolableType {\n if (typeof interpolableValue === 'string') {\n return interpolateStringWithGlobalContext(interpolableValue, fn) as InterpolableType;\n } else {\n return interpolateObjectWithGlobalContext(interpolableValue, fn) as InterpolableType;\n }\n}\n\nexport function interpolateStringWithGlobalContext(\n templateString: string,\n fn: (path: string) => string\n): string {\n return interpolate(templateString, BUILD_GLOBAL_CONTEXT_EXPRESSION_REGEXP, fn);\n}\n\nexport function interpolateObjectWithGlobalContext(\n templateObject: object,\n fn: (path: string) => string\n): object {\n const templateObjectCopy = cloneDeep(templateObject);\n Object.keys(templateObject).forEach((property) => {\n const propertyValue = templateObject[property as keyof typeof templateObject];\n if (['string', 'object'].includes(typeof propertyValue)) {\n templateObjectCopy[property as keyof typeof templateObjectCopy] =\n interpolateWithGlobalContext(propertyValue, fn);\n }\n });\n return templateObjectCopy;\n}\n\nfunction interpolate(\n templateString: string,\n regex: RegExp,\n varsOrFn: Record<string, string> | ((key: string) => string)\n): string {\n const matched = templateString.match(new RegExp(regex, 'g'));\n if (!matched) {\n return templateString;\n }\n let result = templateString;\n for (const match of matched) {\n const [, path] = nullthrows(match.match(regex));\n const value = typeof varsOrFn === 'function' ? varsOrFn(path) : varsOrFn[path.split('.')[1]];\n result = result.replace(match, value);\n }\n return result;\n}\n\nfunction isAllowedValueTypeForObjectInterpolation(\n value: unknown\n): value is string | number | boolean | object | null {\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'object' ||\n value === null\n );\n}\n\ninterface BuildOutputPath {\n stepId: string;\n outputId: string;\n}\n\nexport function findOutputPaths(templateString: string): BuildOutputPath[] {\n const result: BuildOutputPath[] = [];\n const matches = templateString.matchAll(new RegExp(BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, 'g'));\n for (const match of matches) {\n result.push(parseOutputPath(match[1]));\n }\n return result;\n}\n\nexport function parseOutputPath(outputPathWithObjectName: string): BuildOutputPath {\n const splits = outputPathWithObjectName.split('.').slice(1);\n if (splits.length !== 2) {\n throw new BuildConfigError(\n `Step output path must consist of two components joined with a dot, where first is the step ID, and second is the output name, e.g. \"step3.output1\". Passed: \"${outputPathWithObjectName}\"`\n );\n }\n const [stepId, outputId] = splits;\n return { stepId, outputId };\n}\n"]}
@@ -1,23 +0,0 @@
1
- import { BuildFunction, BuildFunctionById } from './BuildFunction.js';
2
- import { BuildFunctionGroup } from './BuildFunctionGroup.js';
3
- import { BuildStep } from './BuildStep.js';
4
- import { BuildStepGlobalContext } from './BuildStepContext.js';
5
- import { BuildWorkflow } from './BuildWorkflow.js';
6
- export declare abstract class AbstractConfigParser {
7
- protected readonly ctx: BuildStepGlobalContext;
8
- protected readonly externalFunctions?: BuildFunction[];
9
- protected readonly externalFunctionGroups?: BuildFunctionGroup[];
10
- constructor(ctx: BuildStepGlobalContext, { externalFunctions, externalFunctionGroups, }: {
11
- externalFunctions?: BuildFunction[];
12
- externalFunctionGroups?: BuildFunctionGroup[];
13
- });
14
- parseAsync(): Promise<BuildWorkflow>;
15
- protected abstract parseConfigToBuildStepsAndBuildFunctionByIdMappingAsync(): Promise<{
16
- buildSteps: BuildStep[];
17
- buildFunctionById: BuildFunctionById;
18
- }>;
19
- private validateExternalFunctions;
20
- private validateExternalFunctionGroups;
21
- protected getExternalFunctionFullIds(): string[];
22
- protected getExternalFunctionGroupFullIds(): string[];
23
- }
@@ -1,61 +0,0 @@
1
- import { BuildWorkflow } from './BuildWorkflow.js';
2
- import { BuildWorkflowValidator } from './BuildWorkflowValidator.js';
3
- import { BuildConfigError } from './errors.js';
4
- import { duplicates } from './utils/expodash/duplicates.js';
5
- import { uniq } from './utils/expodash/uniq.js';
6
- export class AbstractConfigParser {
7
- constructor(ctx, { externalFunctions, externalFunctionGroups, }) {
8
- this.ctx = ctx;
9
- this.validateExternalFunctions(externalFunctions);
10
- this.validateExternalFunctionGroups(externalFunctionGroups);
11
- this.externalFunctions = externalFunctions;
12
- this.externalFunctionGroups = externalFunctionGroups;
13
- }
14
- async parseAsync() {
15
- const { buildSteps, buildFunctionById } = await this.parseConfigToBuildStepsAndBuildFunctionByIdMappingAsync();
16
- const workflow = new BuildWorkflow(this.ctx, { buildSteps, buildFunctions: buildFunctionById });
17
- await new BuildWorkflowValidator(workflow).validateAsync();
18
- return workflow;
19
- }
20
- validateExternalFunctions(externalFunctions) {
21
- if (externalFunctions === undefined) {
22
- return;
23
- }
24
- const externalFunctionIds = externalFunctions.map((f) => f.getFullId());
25
- const duplicatedExternalFunctionIds = duplicates(externalFunctionIds);
26
- if (duplicatedExternalFunctionIds.length === 0) {
27
- return;
28
- }
29
- throw new BuildConfigError(`Provided external functions with duplicated IDs: ${duplicatedExternalFunctionIds
30
- .map((id) => `"${id}"`)
31
- .join(', ')}`);
32
- }
33
- validateExternalFunctionGroups(externalFunctionGroups) {
34
- if (externalFunctionGroups === undefined) {
35
- return;
36
- }
37
- const externalFunctionGroupIds = externalFunctionGroups.map((f) => f.getFullId());
38
- const duplicatedExternalFunctionGroupIds = duplicates(externalFunctionGroupIds);
39
- if (duplicatedExternalFunctionGroupIds.length === 0) {
40
- return;
41
- }
42
- throw new BuildConfigError(`Provided external function groups with duplicated IDs: ${duplicatedExternalFunctionGroupIds
43
- .map((id) => `"${id}"`)
44
- .join(', ')}`);
45
- }
46
- getExternalFunctionFullIds() {
47
- if (this.externalFunctions === undefined) {
48
- return [];
49
- }
50
- const ids = this.externalFunctions.map((f) => f.getFullId());
51
- return uniq(ids);
52
- }
53
- getExternalFunctionGroupFullIds() {
54
- if (this.externalFunctionGroups === undefined) {
55
- return [];
56
- }
57
- const ids = this.externalFunctionGroups.map((f) => f.getFullId());
58
- return uniq(ids);
59
- }
60
- }
61
- //# sourceMappingURL=AbstractConfigParser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AbstractConfigParser.js","sourceRoot":"","sources":["../src/AbstractConfigParser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,MAAM,OAAgB,oBAAoB;IAIxC,YACqB,GAA2B,EAC9C,EACE,iBAAiB,EACjB,sBAAsB,GAIvB;QAPkB,QAAG,GAAH,GAAG,CAAwB;QAS9C,IAAI,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;QAClD,IAAI,CAAC,8BAA8B,CAAC,sBAAsB,CAAC,CAAC;QAE5D,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,GACrC,MAAM,IAAI,CAAC,uDAAuD,EAAE,CAAC;QACvE,MAAM,QAAQ,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC,CAAC;QAChG,MAAM,IAAI,sBAAsB,CAAC,QAAQ,CAAC,CAAC,aAAa,EAAE,CAAC;QAC3D,OAAO,QAAQ,CAAC;IAClB,CAAC;IAOO,yBAAyB,CAAC,iBAAmC;QACnE,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO;QACT,CAAC;Q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AG,CAAC,CAAC;IACnB,CAAC;IAES,+BAA+B;QACvC,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,EAAE,CAAC;YAC9C,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { BuildFunction, BuildFunctionById } from './BuildFunction.js';\nimport { BuildFunctionGroup } from './BuildFunctionGroup.js';\nimport { BuildStep } from './BuildStep.js';\nimport { BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildWorkflow } from './BuildWorkflow.js';\nimport { BuildWorkflowValidator } from './BuildWorkflowValidator.js';\nimport { BuildConfigError } from './errors.js';\nimport { duplicates } from './utils/expodash/duplicates.js';\nimport { uniq } from './utils/expodash/uniq.js';\n\nexport abstract class AbstractConfigParser {\n protected readonly externalFunctions?: BuildFunction[];\n protected readonly externalFunctionGroups?: BuildFunctionGroup[];\n\n constructor(\n protected readonly ctx: BuildStepGlobalContext,\n {\n externalFunctions,\n externalFunctionGroups,\n }: {\n externalFunctions?: BuildFunction[];\n externalFunctionGroups?: BuildFunctionGroup[];\n }\n ) {\n this.validateExternalFunctions(externalFunctions);\n this.validateExternalFunctionGroups(externalFunctionGroups);\n\n this.externalFunctions = externalFunctions;\n this.externalFunctionGroups = externalFunctionGroups;\n }\n\n public async parseAsync(): Promise<BuildWorkflow> {\n const { buildSteps, buildFunctionById } =\n await this.parseConfigToBuildStepsAndBuildFunctionByIdMappingAsync();\n const workflow = new BuildWorkflow(this.ctx, { buildSteps, buildFunctions: buildFunctionById });\n await new BuildWorkflowValidator(workflow).validateAsync();\n return workflow;\n }\n\n protected abstract parseConfigToBuildStepsAndBuildFunctionByIdMappingAsync(): Promise<{\n buildSteps: BuildStep[];\n buildFunctionById: BuildFunctionById;\n }>;\n\n private validateExternalFunctions(externalFunctions?: BuildFunction[]): void {\n if (externalFunctions === undefined) {\n return;\n }\n const externalFunctionIds = externalFunctions.map((f) => f.getFullId());\n const duplicatedExternalFunctionIds = duplicates(externalFunctionIds);\n if (duplicatedExternalFunctionIds.length === 0) {\n return;\n }\n throw new BuildConfigError(\n `Provided external functions with duplicated IDs: ${duplicatedExternalFunctionIds\n .map((id) => `\"${id}\"`)\n .join(', ')}`\n );\n }\n\n private validateExternalFunctionGroups(externalFunctionGroups?: BuildFunctionGroup[]): void {\n if (externalFunctionGroups === undefined) {\n return;\n }\n const externalFunctionGroupIds = externalFunctionGroups.map((f) => f.getFullId());\n const duplicatedExternalFunctionGroupIds = duplicates(externalFunctionGroupIds);\n if (duplicatedExternalFunctionGroupIds.length === 0) {\n return;\n }\n throw new BuildConfigError(\n `Provided external function groups with duplicated IDs: ${duplicatedExternalFunctionGroupIds\n .map((id) => `\"${id}\"`)\n .join(', ')}`\n );\n }\n\n protected getExternalFunctionFullIds(): string[] {\n if (this.externalFunctions === undefined) {\n return [];\n }\n const ids = this.externalFunctions.map((f) => f.getFullId());\n return uniq(ids);\n }\n\n protected getExternalFunctionGroupFullIds(): string[] {\n if (this.externalFunctionGroups === undefined) {\n return [];\n }\n const ids = this.externalFunctionGroups.map((f) => f.getFullId());\n return uniq(ids);\n }\n}\n"]}
@@ -1,80 +0,0 @@
1
- import Joi from 'joi';
2
- import { BuildRuntimePlatform } from './BuildRuntimePlatform.js';
3
- import { BuildStepInputValueTypeName, BuildStepInputValueType } from './BuildStepInput.js';
4
- import { BuildStepEnv } from './BuildStepEnv.js';
5
- export type BuildFunctions = Record<string, BuildFunctionConfig>;
6
- interface BuildFunctionsConfigFile {
7
- configFilesToImport?: string[];
8
- functions?: BuildFunctions;
9
- }
10
- export interface BuildConfig extends BuildFunctionsConfigFile {
11
- build: {
12
- name?: string;
13
- steps: BuildStepConfig[];
14
- };
15
- }
16
- export type BuildStepConfig = BuildStepCommandRun | BuildStepBareCommandRun | BuildStepFunctionCall | BuildStepBareFunctionOrFunctionGroupCall;
17
- export type BuildStepCommandRun = {
18
- run: BuildFunctionCallConfig & {
19
- outputs?: BuildStepOutputs;
20
- command: string;
21
- };
22
- };
23
- export type BuildStepBareCommandRun = {
24
- run: string;
25
- };
26
- export type BuildStepFunctionCall = {
27
- [functionId: string]: BuildFunctionCallConfig;
28
- };
29
- export type BuildStepBareFunctionOrFunctionGroupCall = string;
30
- export type BuildFunctionCallConfig = {
31
- id?: string;
32
- inputs?: BuildStepInputs;
33
- name?: string;
34
- workingDirectory?: string;
35
- shell?: string;
36
- env?: BuildStepEnv;
37
- if?: string;
38
- timeout_minutes?: number;
39
- __metrics_id?: string;
40
- };
41
- export type BuildStepInputs = Record<string, unknown>;
42
- export type BuildStepOutputs = (string | {
43
- name: string;
44
- required?: boolean;
45
- })[];
46
- export interface BuildFunctionConfig {
47
- inputs?: BuildFunctionInputs;
48
- outputs?: BuildFunctionOutputs;
49
- name?: string;
50
- supportedRuntimePlatforms?: BuildRuntimePlatform[];
51
- shell?: string;
52
- command?: string;
53
- path?: string;
54
- }
55
- export type BuildFunctionInputs = (string | {
56
- name: string;
57
- defaultValue?: BuildStepInputValueType;
58
- allowedValues?: BuildStepInputValueType[];
59
- required?: boolean;
60
- allowedValueType: BuildStepInputValueTypeName;
61
- })[];
62
- export type BuildFunctionOutputs = BuildStepOutputs;
63
- export declare const BuildFunctionsConfigFileSchema: Joi.ObjectSchema<BuildFunctionsConfigFile>;
64
- export declare const BuildConfigSchema: Joi.ObjectSchema<BuildConfig>;
65
- interface BuildConfigValidationParams {
66
- externalFunctionIds?: string[];
67
- externalFunctionGroupsIds?: string[];
68
- skipNamespacedFunctionsOrFunctionGroupsCheck?: boolean;
69
- }
70
- export declare function readAndValidateBuildConfigFromPathAsync(configPath: string, params?: BuildConfigValidationParams): Promise<BuildConfig>;
71
- export declare function readAndValidateBuildFunctionsConfigFileAsync(configPath: string): Promise<BuildFunctionsConfigFile>;
72
- export declare function readRawBuildConfigAsync(configPath: string): Promise<any>;
73
- export declare function validateConfig<T>(schema: Joi.ObjectSchema<T>, config: object, configFilePath?: string): T;
74
- export declare function mergeConfigWithImportedFunctions(config: BuildConfig, importedFunctions: BuildFunctions): void;
75
- export declare function isBuildStepCommandRun(step: BuildStepConfig): step is BuildStepCommandRun;
76
- export declare function isBuildStepBareCommandRun(step: BuildStepConfig): step is BuildStepBareCommandRun;
77
- export declare function isBuildStepFunctionCall(step: BuildStepConfig): step is BuildStepFunctionCall;
78
- export declare function isBuildStepBareFunctionOrFunctionGroupCall(step: BuildStepConfig): step is BuildStepBareFunctionOrFunctionGroupCall;
79
- export declare function validateAllFunctionsExist(config: BuildConfig, { externalFunctionIds, externalFunctionGroupsIds, skipNamespacedFunctionsOrFunctionGroupsCheck, }: BuildConfigValidationParams): void;
80
- export {};