@expo/steps 1.0.90 → 1.0.92

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.
@@ -117,7 +117,7 @@ class BuildStep extends BuildStepOutputAccessor {
117
117
  buildStepDisplayName: this.displayName,
118
118
  });
119
119
  this.ctx = ctx.stepCtx({ logger, relativeWorkingDirectory: maybeWorkingDirectory });
120
- this.env = env !== null && env !== void 0 ? env : {};
120
+ this.stepEnvOverrides = env !== null && env !== void 0 ? env : {};
121
121
  ctx.registerStep(this);
122
122
  }
123
123
  async executeAsync() {
@@ -173,7 +173,7 @@ class BuildStep extends BuildStepOutputAccessor {
173
173
  failure: () => hasAnyPreviousStepsFailed,
174
174
  always: () => true,
175
175
  never: () => false,
176
- env: this.env,
176
+ env: this.effectiveEnv,
177
177
  inputs: (_b = (_a = this.inputs) === null || _a === void 0 ? void 0 : _a.reduce((acc, input) => {
178
178
  acc[input.id] = input.value;
179
179
  return acc;
@@ -303,9 +303,12 @@ class BuildStep extends BuildStepOutputAccessor {
303
303
  ...Object.fromEntries(entries),
304
304
  });
305
305
  }
306
+ get effectiveEnv() {
307
+ return { ...this.ctx.global.env, ...this.stepEnvOverrides };
308
+ }
306
309
  getScriptEnv({ envsDir, outputsDir, }) {
307
310
  var _a;
308
- const env = { ...this.ctx.global.env, ...this.env };
311
+ const env = this.effectiveEnv;
309
312
  const currentPath = (_a = env.PATH) !== null && _a !== void 0 ? _a : process.env.PATH;
310
313
  const newPath = currentPath ? `${bin_js_1.BIN_PATH}:${currentPath}` : bin_js_1.BIN_PATH;
311
314
  return {
@@ -48,7 +48,7 @@ export declare class BuildStep extends BuildStepOutputAccessor {
48
48
  readonly fn?: BuildStepFunction;
49
49
  readonly shell: string;
50
50
  readonly ctx: BuildStepContext;
51
- readonly env: BuildStepEnv;
51
+ readonly stepEnvOverrides: BuildStepEnv;
52
52
  readonly ifCondition?: string;
53
53
  status: BuildStepStatus;
54
54
  private readonly internalId;
@@ -86,5 +86,6 @@ export declare class BuildStep extends BuildStepOutputAccessor {
86
86
  private interpolateInputsAndGlobalContextInTemplate;
87
87
  private collectAndValidateOutputsAsync;
88
88
  private collectAndUpdateEnvsAsync;
89
+ private get effectiveEnv();
89
90
  private getScriptEnv;
90
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BuildStep.js","sourceRoot":"","sources":["../src/BuildStep.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,2DAA6B;AAC7B,gDAAwB;AAExB,+BAAoC;AAGpC,2DAAoG;AACpG,6DAK8B;AAC9B,iDAAgD;AAChD,yDAAmF;AACnF,qEAKkC;AAClC,qDAAoD;AACpD,qDAA4D;AAC5D,2CAAoD;AAGpD,qDAA+C;AAE/C,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,8CAA2B,CAAA;IAC3B,sCAAmB,CAAA;IACnB,gCAAa,CAAA;IACb,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;AACrB,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;AACvB,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAWD,0CAA0C;AAC1C,MAAM,UAAU,GACd,uFAAuF,CAAC;AAS1F,MAAa,uBAAuB;IAClC,YACkB,EAAU,EACV,WAAmB,EAChB,QAAiB,EACjB,UAA+B;QAHlC,OAAE,GAAF,EAAE,CAAQ;QACV,gBAAW,GAAX,WAAW,CAAQ;QAChB,aAAQ,GAAR,QAAQ,CAAS;QACjB,eAAU,GAAV,UAAU,CAAqB;IACjD,CAAC;IAEG,oBAAoB,CAAC,IAAY;QACtC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,IAAI,iCAAqB,CAC7B,0BAA0B,IAAI,gBAAgB,IAAI,CAAC,WAAW,wCAAwC,CACvG,CAA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IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACpD,MAAM,WAAW,GAAG,MAAA,GAAG,CAAC,IAAI,mCAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACjD,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,iBAAQ,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,iBAAQ,CAAC;QACtE,OAAO;YACL,GAAG,GAAG;YACN,wBAAwB,EAAE,UAAU;YACpC,qBAAqB,EAAE,OAAO;YAC9B,8BAA8B,EAAE,IAAI,CAAC,GAAG,CAAC,gBAAgB;YACzD,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;CACF;AAtXD,8BAsXC","sourcesContent":["import assert from 'assert';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { BuildStepContext, BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStepInput, BuildStepInputById, makeBuildStepInputByIdMap } from './BuildStepInput.js';\nimport {\n BuildStepOutput,\n BuildStepOutputById,\n SerializedBuildStepOutput,\n makeBuildStepOutputByIdMap,\n} from './BuildStepOutput.js';\nimport { BIN_PATH } from './utils/shell/bin.js';\nimport { getDefaultShell, getShellCommandAndArgs } from './utils/shell/command.js';\nimport {\n cleanUpStepTemporaryDirectoriesAsync,\n createTemporaryEnvsDirectoryAsync,\n createTemporaryOutputsDirectoryAsync,\n saveScriptToTemporaryFileAsync,\n} from './BuildTemporaryFiles.js';\nimport { spawnAsync } from './utils/shell/spawn.js';\nimport { interpolateWithInputs } from './utils/template.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport { BuildStepEnv } from './BuildStepEnv.js';\nimport { BuildRuntimePlatform } from './BuildRuntimePlatform.js';\nimport { jsepEval } from './utils/jsepEval.js';\n\nexport enum BuildStepStatus {\n NEW = 'new',\n IN_PROGRESS = 'in-progress',\n SKIPPED = 'skipped',\n FAIL = 'fail',\n WARNING = 'warning',\n SUCCESS = 'success',\n}\n\nexport enum BuildStepLogMarker {\n START_STEP = 'start-step',\n END_STEP = 'end-step',\n}\n\nexport type BuildStepFunction = (\n ctx: BuildStepContext,\n {\n inputs,\n outputs,\n env,\n }: { inputs: BuildStepInputById; outputs: BuildStepOutputById; env: BuildStepEnv }\n) => unknown;\n\n// TODO: move to a place common with tests\nconst UUID_REGEX =\n /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/;\n\nexport interface SerializedBuildStepOutputAccessor {\n id: string;\n executed: boolean;\n outputById: Record<string, SerializedBuildStepOutput>;\n displayName: string;\n}\n\nexport class BuildStepOutputAccessor {\n constructor(\n public readonly id: string,\n public readonly displayName: string,\n protected readonly executed: boolean,\n protected readonly outputById: BuildStepOutputById\n ) {}\n\n public getOutputValueByName(name: string): string | undefined {\n if (!this.executed) {\n throw new BuildStepRuntimeError(\n `Failed getting output \"${name}\" from step \"${this.displayName}\". The step has not been executed yet.`\n );\n }\n if (!this.hasOutputParameter(name)) {\n throw new BuildStepRuntimeError(`Step \"${this.displayName}\" does not have output \"${name}\".`);\n }\n return this.outputById[name].value;\n }\n\n public hasOutputParameter(name: string): boolean {\n return name in this.outputById;\n }\n\n public serialize(): SerializedBuildStepOutputAccessor {\n return {\n id: this.id,\n executed: this.executed,\n outputById: Object.fromEntries(\n Object.entries(this.outputById).map(([key, value]) => [key, value.serialize()])\n ),\n displayName: this.displayName,\n };\n }\n\n public static deserialize(\n serialized: SerializedBuildStepOutputAccessor\n ): BuildStepOutputAccessor {\n const outputById = Object.fromEntries(\n Object.entries(serialized.outputById).map(([key, value]) => [\n key,\n BuildStepOutput.deserialize(value),\n ])\n );\n return new BuildStepOutputAccessor(\n serialized.id,\n serialized.displayName,\n serialized.executed,\n outputById\n );\n }\n}\n\nexport class BuildStep extends BuildStepOutputAccessor {\n public readonly id: string;\n public readonly name?: string;\n public readonly displayName: string;\n public readonly supportedRuntimePlatforms?: BuildRuntimePlatform[];\n public readonly inputs?: BuildStepInput[];\n public readonly outputs?: BuildStepOutput[];\n public readonly command?: string;\n public readonly fn?: BuildStepFunction;\n public readonly shell: string;\n public readonly ctx: BuildStepContext;\n public readonly env: BuildStepEnv;\n public readonly ifCondition?: string;\n public status: BuildStepStatus;\n\n private readonly internalId: string;\n private readonly inputById: BuildStepInputById;\n protected readonly outputById: BuildStepOutputById;\n protected executed = false;\n\n public static getNewId(userDefinedId?: string): string {\n return userDefinedId ?? uuidv4();\n }\n\n public static getDisplayName({\n id,\n name,\n command,\n }: {\n id: string;\n name?: string;\n command?: string;\n }): string {\n if (name) {\n return name;\n }\n if (!id.match(UUID_REGEX)) {\n return id;\n }\n if (command) {\n const splits = command.trim().split('\\n');\n for (const split of splits) {\n const trimmed = split.trim();\n if (trimmed && !trimmed.startsWith('#')) {\n return trimmed;\n }\n }\n }\n return id;\n }\n\n constructor(\n ctx: BuildStepGlobalContext,\n {\n id,\n name,\n displayName,\n inputs,\n outputs,\n command,\n fn,\n workingDirectory: maybeWorkingDirectory,\n shell,\n supportedRuntimePlatforms: maybeSupportedRuntimePlatforms,\n env,\n ifCondition,\n }: {\n id: string;\n name?: string;\n displayName: string;\n inputs?: BuildStepInput[];\n outputs?: BuildStepOutput[];\n command?: string;\n fn?: BuildStepFunction;\n workingDirectory?: string;\n shell?: string;\n supportedRuntimePlatforms?: BuildRuntimePlatform[];\n env?: BuildStepEnv;\n ifCondition?: string;\n }\n ) {\n assert(command !== undefined || fn !== undefined, 'Either command or fn must be defined.');\n assert(!(command !== undefined && fn !== undefined), 'Command and fn cannot be both set.');\n const outputById = makeBuildStepOutputByIdMap(outputs);\n super(id, displayName, false, outputById);\n\n this.id = id;\n this.name = name;\n this.displayName = displayName;\n this.supportedRuntimePlatforms = maybeSupportedRuntimePlatforms;\n this.inputs = inputs;\n this.outputs = outputs;\n this.inputById = makeBuildStepInputByIdMap(inputs);\n this.outputById = outputById;\n this.fn = fn;\n this.command = command;\n this.shell = shell ?? getDefaultShell();\n this.ifCondition = ifCondition;\n this.status = BuildStepStatus.NEW;\n\n this.internalId = uuidv4();\n\n const logger = ctx.baseLogger.child({\n buildStepInternalId: this.internalId,\n buildStepId: this.id,\n buildStepDisplayName: this.displayName,\n });\n this.ctx = ctx.stepCtx({ logger, relativeWorkingDirectory: maybeWorkingDirectory });\n this.env = env ?? {};\n\n ctx.registerStep(this);\n }\n\n public async executeAsync(): Promise<void> {\n try {\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.START_STEP },\n `Executing build step \"${this.displayName}\"`\n );\n this.status = BuildStepStatus.IN_PROGRESS;\n\n if (this.command !== undefined) {\n await this.executeCommandAsync();\n } else {\n await this.exectuteFnAsync();\n }\n\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.SUCCESS },\n `Finished build step \"${this.displayName}\" successfully`\n );\n this.status = BuildStepStatus.SUCCESS;\n } catch (err) {\n this.ctx.logger.error({ err });\n this.ctx.logger.error(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.FAIL },\n `Build step \"${this.displayName}\" failed`\n );\n this.status = BuildStepStatus.FAIL;\n throw err;\n } finally {\n this.executed = true;\n }\n }\n\n public hasOutputParameter(name: string): boolean {\n return name in this.outputById;\n }\n\n public getOutputValueByName(name: string): string | undefined {\n if (!this.executed) {\n throw new BuildStepRuntimeError(\n `Failed getting output \"${name}\" from step \"${this.displayName}\". The step has not been executed yet.`\n );\n }\n if (!this.hasOutputParameter(name)) {\n throw new BuildStepRuntimeError(`Step \"${this.displayName}\" does not have output \"${name}\".`);\n }\n return this.outputById[name].value;\n }\n\n public canBeRunOnRuntimePlatform(): boolean {\n return (\n !this.supportedRuntimePlatforms ||\n this.supportedRuntimePlatforms.includes(this.ctx.global.runtimePlatform)\n );\n }\n\n public shouldExecuteStep(hasAnyPreviousStepsFailed: boolean): boolean {\n if (!this.ifCondition) {\n return !hasAnyPreviousStepsFailed;\n }\n\n let ifCondition = this.ifCondition;\n\n if (ifCondition.startsWith('${') && ifCondition.endsWith('}')) {\n ifCondition = ifCondition.slice(2, -1);\n }\n\n return Boolean(\n jsepEval(ifCondition, {\n success: () => !hasAnyPreviousStepsFailed,\n failure: () => hasAnyPreviousStepsFailed,\n always: () => true,\n never: () => false,\n env: this.env,\n inputs:\n this.inputs?.reduce(\n (acc, input) => {\n acc[input.id] = input.value;\n return acc;\n },\n {} as Record<string, unknown>\n ) ?? {},\n eas: {\n runtimePlatform: this.ctx.global.runtimePlatform,\n ...this.ctx.global.staticContext,\n },\n })\n );\n }\n\n public skip(): void {\n this.status = BuildStepStatus.SKIPPED;\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.START_STEP },\n 'Executing build step \"${this.displayName}\"'\n );\n this.ctx.logger.info(`Skipped build step \"${this.displayName}\"`);\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.SKIPPED },\n `Skipped build step \"${this.displayName}\"`\n );\n }\n\n private async executeCommandAsync(): Promise<void> {\n assert(this.command, 'Command must be defined.');\n\n try {\n const command = this.interpolateInputsAndGlobalContextInTemplate(this.command, this.inputs);\n this.ctx.logger.debug(`Interpolated inputs in the command template`);\n\n const outputsDir = await createTemporaryOutputsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(`Created temporary directory for step outputs: ${outputsDir}`);\n\n const envsDir = await createTemporaryEnvsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(\n `Created temporary directory for step environment variables: ${outputsDir}`\n );\n\n const scriptPath = await saveScriptToTemporaryFileAsync(this.ctx.global, this.id, command);\n this.ctx.logger.debug(`Saved script to ${scriptPath}`);\n\n const { command: shellCommand, args } = getShellCommandAndArgs(this.shell, scriptPath);\n this.ctx.logger.debug(\n `Executing script: ${shellCommand}${args !== undefined ? ` ${args.join(' ')}` : ''}`\n );\n await spawnAsync(shellCommand, args ?? [], {\n cwd: this.ctx.workingDirectory,\n logger: this.ctx.logger,\n env: this.getScriptEnv({ outputsDir, envsDir }),\n // stdin is /dev/null, std{out,err} are piped into logger.\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n this.ctx.logger.debug(`Script completed successfully`);\n\n await this.collectAndValidateOutputsAsync(outputsDir);\n await this.collectAndUpdateEnvsAsync(envsDir);\n this.ctx.logger.debug('Finished collecting output paramters');\n } finally {\n await cleanUpStepTemporaryDirectoriesAsync(this.ctx.global, this.id);\n }\n }\n\n private async exectuteFnAsync(): Promise<void> {\n assert(this.fn, 'Function (fn) must be defined');\n\n try {\n const outputsDir = await createTemporaryOutputsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(`Created temporary directory for step outputs: ${outputsDir}`);\n\n const envsDir = await createTemporaryEnvsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(\n `Created temporary directory for step environment variables: ${outputsDir}`\n );\n\n await this.fn(this.ctx, {\n inputs: this.inputById,\n outputs: this.outputById,\n env: this.getScriptEnv({ outputsDir, envsDir }),\n });\n\n this.ctx.logger.debug(`Script completed successfully`);\n\n await this.collectAndValidateOutputsAsync(outputsDir);\n await this.collectAndUpdateEnvsAsync(envsDir);\n this.ctx.logger.debug('Finished collecting output paramters');\n } finally {\n await cleanUpStepTemporaryDirectoriesAsync(this.ctx.global, this.id);\n }\n }\n\n private interpolateInputsAndGlobalContextInTemplate(\n template: string,\n inputs?: BuildStepInput[]\n ): string {\n if (!inputs) {\n return this.ctx.global.interpolate(template);\n }\n const vars = inputs.reduce(\n (acc, input) => {\n acc[input.id] =\n typeof input.value === 'object'\n ? JSON.stringify(input.value)\n : input.value?.toString() ?? '';\n return acc;\n },\n {} as Record<string, string>\n );\n const valueInterpolatedWithGlobalContext = this.ctx.global.interpolate(template);\n return interpolateWithInputs(valueInterpolatedWithGlobalContext, vars);\n }\n\n private async collectAndValidateOutputsAsync(outputsDir: string): Promise<void> {\n const files = await fs.readdir(outputsDir);\n\n const nonDefinedOutputIds: string[] = [];\n for (const outputId of files) {\n if (!(outputId in this.outputById)) {\n nonDefinedOutputIds.push(outputId);\n } else {\n const file = path.join(outputsDir, outputId);\n const rawContents = await fs.readFile(file, 'utf-8');\n const value = rawContents.trim();\n this.outputById[outputId].set(value);\n }\n }\n\n if (nonDefinedOutputIds.length > 0) {\n const idsString = nonDefinedOutputIds.map((i) => `\"${i}\"`).join(', ');\n this.ctx.logger.warn(`Some outputs are not defined in step config: ${idsString}`);\n }\n\n const nonSetRequiredOutputIds: string[] = [];\n for (const output of this.outputs ?? []) {\n try {\n const value = output.value;\n this.ctx.logger.debug(`Output parameter \"${output.id}\" is set to \"${value}\"`);\n } catch (err) {\n this.ctx.logger.debug({ err }, `Getting value for output parameter \"${output.id}\" failed.`);\n nonSetRequiredOutputIds.push(output.id);\n }\n }\n if (nonSetRequiredOutputIds.length > 0) {\n const idsString = nonSetRequiredOutputIds.map((i) => `\"${i}\"`).join(', ');\n throw new BuildStepRuntimeError(`Some required outputs have not been set: ${idsString}`, {\n metadata: { ids: nonSetRequiredOutputIds },\n });\n }\n }\n\n private async collectAndUpdateEnvsAsync(envsDir: string): Promise<void> {\n const filenames = await fs.readdir(envsDir);\n\n const entries = await Promise.all(\n filenames.map(async (basename) => {\n const rawContents = await fs.readFile(path.join(envsDir, basename), 'utf-8');\n return [basename, rawContents];\n })\n );\n this.ctx.global.updateEnv({\n ...this.ctx.global.env,\n ...Object.fromEntries(entries),\n });\n }\n\n private getScriptEnv({\n envsDir,\n outputsDir,\n }: {\n envsDir: string;\n outputsDir: string;\n }): Record<string, string> {\n const env = { ...this.ctx.global.env, ...this.env };\n const currentPath = env.PATH ?? process.env.PATH;\n const newPath = currentPath ? `${BIN_PATH}:${currentPath}` : BIN_PATH;\n return {\n ...env,\n __EXPO_STEPS_OUTPUTS_DIR: outputsDir,\n __EXPO_STEPS_ENVS_DIR: envsDir,\n __EXPO_STEPS_WORKING_DIRECTORY: this.ctx.workingD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C;QAC9B,MAAM,WAAW,GAAG,MAAA,GAAG,CAAC,IAAI,mCAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACjD,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,iBAAQ,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,iBAAQ,CAAC;QACtE,OAAO;YACL,GAAG,GAAG;YACN,wBAAwB,EAAE,UAAU;YACpC,qBAAqB,EAAE,OAAO;YAC9B,8BAA8B,EAAE,IAAI,CAAC,GAAG,CAAC,gBAAgB;YACzD,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;CACF;AA1XD,8BA0XC","sourcesContent":["import assert from 'assert';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { BuildStepContext, BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStepInput, BuildStepInputById, makeBuildStepInputByIdMap } from './BuildStepInput.js';\nimport {\n BuildStepOutput,\n BuildStepOutputById,\n SerializedBuildStepOutput,\n makeBuildStepOutputByIdMap,\n} from './BuildStepOutput.js';\nimport { BIN_PATH } from './utils/shell/bin.js';\nimport { getDefaultShell, getShellCommandAndArgs } from './utils/shell/command.js';\nimport {\n cleanUpStepTemporaryDirectoriesAsync,\n createTemporaryEnvsDirectoryAsync,\n createTemporaryOutputsDirectoryAsync,\n saveScriptToTemporaryFileAsync,\n} from './BuildTemporaryFiles.js';\nimport { spawnAsync } from './utils/shell/spawn.js';\nimport { interpolateWithInputs } from './utils/template.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport { BuildStepEnv } from './BuildStepEnv.js';\nimport { BuildRuntimePlatform } from './BuildRuntimePlatform.js';\nimport { jsepEval } from './utils/jsepEval.js';\n\nexport enum BuildStepStatus {\n NEW = 'new',\n IN_PROGRESS = 'in-progress',\n SKIPPED = 'skipped',\n FAIL = 'fail',\n WARNING = 'warning',\n SUCCESS = 'success',\n}\n\nexport enum BuildStepLogMarker {\n START_STEP = 'start-step',\n END_STEP = 'end-step',\n}\n\nexport type BuildStepFunction = (\n ctx: BuildStepContext,\n {\n inputs,\n outputs,\n env,\n }: { inputs: BuildStepInputById; outputs: BuildStepOutputById; env: BuildStepEnv }\n) => unknown;\n\n// TODO: move to a place common with tests\nconst UUID_REGEX =\n /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/;\n\nexport interface SerializedBuildStepOutputAccessor {\n id: string;\n executed: boolean;\n outputById: Record<string, SerializedBuildStepOutput>;\n displayName: string;\n}\n\nexport class BuildStepOutputAccessor {\n constructor(\n public readonly id: string,\n public readonly displayName: string,\n protected readonly executed: boolean,\n protected readonly outputById: BuildStepOutputById\n ) {}\n\n public getOutputValueByName(name: string): string | undefined {\n if (!this.executed) {\n throw new BuildStepRuntimeError(\n `Failed getting output \"${name}\" from step \"${this.displayName}\". The step has not been executed yet.`\n );\n }\n if (!this.hasOutputParameter(name)) {\n throw new BuildStepRuntimeError(`Step \"${this.displayName}\" does not have output \"${name}\".`);\n }\n return this.outputById[name].value;\n }\n\n public hasOutputParameter(name: string): boolean {\n return name in this.outputById;\n }\n\n public serialize(): SerializedBuildStepOutputAccessor {\n return {\n id: this.id,\n executed: this.executed,\n outputById: Object.fromEntries(\n Object.entries(this.outputById).map(([key, value]) => [key, value.serialize()])\n ),\n displayName: this.displayName,\n };\n }\n\n public static deserialize(\n serialized: SerializedBuildStepOutputAccessor\n ): BuildStepOutputAccessor {\n const outputById = Object.fromEntries(\n Object.entries(serialized.outputById).map(([key, value]) => [\n key,\n BuildStepOutput.deserialize(value),\n ])\n );\n return new BuildStepOutputAccessor(\n serialized.id,\n serialized.displayName,\n serialized.executed,\n outputById\n );\n }\n}\n\nexport class BuildStep extends BuildStepOutputAccessor {\n public readonly id: string;\n public readonly name?: string;\n public readonly displayName: string;\n public readonly supportedRuntimePlatforms?: BuildRuntimePlatform[];\n public readonly inputs?: BuildStepInput[];\n public readonly outputs?: BuildStepOutput[];\n public readonly command?: string;\n public readonly fn?: BuildStepFunction;\n public readonly shell: string;\n public readonly ctx: BuildStepContext;\n public readonly stepEnvOverrides: BuildStepEnv;\n public readonly ifCondition?: string;\n public status: BuildStepStatus;\n\n private readonly internalId: string;\n private readonly inputById: BuildStepInputById;\n protected readonly outputById: BuildStepOutputById;\n protected executed = false;\n\n public static getNewId(userDefinedId?: string): string {\n return userDefinedId ?? uuidv4();\n }\n\n public static getDisplayName({\n id,\n name,\n command,\n }: {\n id: string;\n name?: string;\n command?: string;\n }): string {\n if (name) {\n return name;\n }\n if (!id.match(UUID_REGEX)) {\n return id;\n }\n if (command) {\n const splits = command.trim().split('\\n');\n for (const split of splits) {\n const trimmed = split.trim();\n if (trimmed && !trimmed.startsWith('#')) {\n return trimmed;\n }\n }\n }\n return id;\n }\n\n constructor(\n ctx: BuildStepGlobalContext,\n {\n id,\n name,\n displayName,\n inputs,\n outputs,\n command,\n fn,\n workingDirectory: maybeWorkingDirectory,\n shell,\n supportedRuntimePlatforms: maybeSupportedRuntimePlatforms,\n env,\n ifCondition,\n }: {\n id: string;\n name?: string;\n displayName: string;\n inputs?: BuildStepInput[];\n outputs?: BuildStepOutput[];\n command?: string;\n fn?: BuildStepFunction;\n workingDirectory?: string;\n shell?: string;\n supportedRuntimePlatforms?: BuildRuntimePlatform[];\n env?: BuildStepEnv;\n ifCondition?: string;\n }\n ) {\n assert(command !== undefined || fn !== undefined, 'Either command or fn must be defined.');\n assert(!(command !== undefined && fn !== undefined), 'Command and fn cannot be both set.');\n const outputById = makeBuildStepOutputByIdMap(outputs);\n super(id, displayName, false, outputById);\n\n this.id = id;\n this.name = name;\n this.displayName = displayName;\n this.supportedRuntimePlatforms = maybeSupportedRuntimePlatforms;\n this.inputs = inputs;\n this.outputs = outputs;\n this.inputById = makeBuildStepInputByIdMap(inputs);\n this.outputById = outputById;\n this.fn = fn;\n this.command = command;\n this.shell = shell ?? getDefaultShell();\n this.ifCondition = ifCondition;\n this.status = BuildStepStatus.NEW;\n\n this.internalId = uuidv4();\n\n const logger = ctx.baseLogger.child({\n buildStepInternalId: this.internalId,\n buildStepId: this.id,\n buildStepDisplayName: this.displayName,\n });\n this.ctx = ctx.stepCtx({ logger, relativeWorkingDirectory: maybeWorkingDirectory });\n this.stepEnvOverrides = env ?? {};\n\n ctx.registerStep(this);\n }\n\n public async executeAsync(): Promise<void> {\n try {\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.START_STEP },\n `Executing build step \"${this.displayName}\"`\n );\n this.status = BuildStepStatus.IN_PROGRESS;\n\n if (this.command !== undefined) {\n await this.executeCommandAsync();\n } else {\n await this.exectuteFnAsync();\n }\n\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.SUCCESS },\n `Finished build step \"${this.displayName}\" successfully`\n );\n this.status = BuildStepStatus.SUCCESS;\n } catch (err) {\n this.ctx.logger.error({ err });\n this.ctx.logger.error(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.FAIL },\n `Build step \"${this.displayName}\" failed`\n );\n this.status = BuildStepStatus.FAIL;\n throw err;\n } finally {\n this.executed = true;\n }\n }\n\n public hasOutputParameter(name: string): boolean {\n return name in this.outputById;\n }\n\n public getOutputValueByName(name: string): string | undefined {\n if (!this.executed) {\n throw new BuildStepRuntimeError(\n `Failed getting output \"${name}\" from step \"${this.displayName}\". The step has not been executed yet.`\n );\n }\n if (!this.hasOutputParameter(name)) {\n throw new BuildStepRuntimeError(`Step \"${this.displayName}\" does not have output \"${name}\".`);\n }\n return this.outputById[name].value;\n }\n\n public canBeRunOnRuntimePlatform(): boolean {\n return (\n !this.supportedRuntimePlatforms ||\n this.supportedRuntimePlatforms.includes(this.ctx.global.runtimePlatform)\n );\n }\n\n public shouldExecuteStep(hasAnyPreviousStepsFailed: boolean): boolean {\n if (!this.ifCondition) {\n return !hasAnyPreviousStepsFailed;\n }\n\n let ifCondition = this.ifCondition;\n\n if (ifCondition.startsWith('${') && ifCondition.endsWith('}')) {\n ifCondition = ifCondition.slice(2, -1);\n }\n\n return Boolean(\n jsepEval(ifCondition, {\n success: () => !hasAnyPreviousStepsFailed,\n failure: () => hasAnyPreviousStepsFailed,\n always: () => true,\n never: () => false,\n env: this.effectiveEnv,\n inputs:\n this.inputs?.reduce(\n (acc, input) => {\n acc[input.id] = input.value;\n return acc;\n },\n {} as Record<string, unknown>\n ) ?? {},\n eas: {\n runtimePlatform: this.ctx.global.runtimePlatform,\n ...this.ctx.global.staticContext,\n },\n })\n );\n }\n\n public skip(): void {\n this.status = BuildStepStatus.SKIPPED;\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.START_STEP },\n 'Executing build step \"${this.displayName}\"'\n );\n this.ctx.logger.info(`Skipped build step \"${this.displayName}\"`);\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.SKIPPED },\n `Skipped build step \"${this.displayName}\"`\n );\n }\n\n private async executeCommandAsync(): Promise<void> {\n assert(this.command, 'Command must be defined.');\n\n try {\n const command = this.interpolateInputsAndGlobalContextInTemplate(this.command, this.inputs);\n this.ctx.logger.debug(`Interpolated inputs in the command template`);\n\n const outputsDir = await createTemporaryOutputsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(`Created temporary directory for step outputs: ${outputsDir}`);\n\n const envsDir = await createTemporaryEnvsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(\n `Created temporary directory for step environment variables: ${outputsDir}`\n );\n\n const scriptPath = await saveScriptToTemporaryFileAsync(this.ctx.global, this.id, command);\n this.ctx.logger.debug(`Saved script to ${scriptPath}`);\n\n const { command: shellCommand, args } = getShellCommandAndArgs(this.shell, scriptPath);\n this.ctx.logger.debug(\n `Executing script: ${shellCommand}${args !== undefined ? ` ${args.join(' ')}` : ''}`\n );\n await spawnAsync(shellCommand, args ?? [], {\n cwd: this.ctx.workingDirectory,\n logger: this.ctx.logger,\n env: this.getScriptEnv({ outputsDir, envsDir }),\n // stdin is /dev/null, std{out,err} are piped into logger.\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n this.ctx.logger.debug(`Script completed successfully`);\n\n await this.collectAndValidateOutputsAsync(outputsDir);\n await this.collectAndUpdateEnvsAsync(envsDir);\n this.ctx.logger.debug('Finished collecting output paramters');\n } finally {\n await cleanUpStepTemporaryDirectoriesAsync(this.ctx.global, this.id);\n }\n }\n\n private async exectuteFnAsync(): Promise<void> {\n assert(this.fn, 'Function (fn) must be defined');\n\n try {\n const outputsDir = await createTemporaryOutputsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(`Created temporary directory for step outputs: ${outputsDir}`);\n\n const envsDir = await createTemporaryEnvsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(\n `Created temporary directory for step environment variables: ${outputsDir}`\n );\n\n await this.fn(this.ctx, {\n inputs: this.inputById,\n outputs: this.outputById,\n env: this.getScriptEnv({ outputsDir, envsDir }),\n });\n\n this.ctx.logger.debug(`Script completed successfully`);\n\n await this.collectAndValidateOutputsAsync(outputsDir);\n await this.collectAndUpdateEnvsAsync(envsDir);\n this.ctx.logger.debug('Finished collecting output paramters');\n } finally {\n await cleanUpStepTemporaryDirectoriesAsync(this.ctx.global, this.id);\n }\n }\n\n private interpolateInputsAndGlobalContextInTemplate(\n template: string,\n inputs?: BuildStepInput[]\n ): string {\n if (!inputs) {\n return this.ctx.global.interpolate(template);\n }\n const vars = inputs.reduce(\n (acc, input) => {\n acc[input.id] =\n typeof input.value === 'object'\n ? JSON.stringify(input.value)\n : input.value?.toString() ?? '';\n return acc;\n },\n {} as Record<string, string>\n );\n const valueInterpolatedWithGlobalContext = this.ctx.global.interpolate(template);\n return interpolateWithInputs(valueInterpolatedWithGlobalContext, vars);\n }\n\n private async collectAndValidateOutputsAsync(outputsDir: string): Promise<void> {\n const files = await fs.readdir(outputsDir);\n\n const nonDefinedOutputIds: string[] = [];\n for (const outputId of files) {\n if (!(outputId in this.outputById)) {\n nonDefinedOutputIds.push(outputId);\n } else {\n const file = path.join(outputsDir, outputId);\n const rawContents = await fs.readFile(file, 'utf-8');\n const value = rawContents.trim();\n this.outputById[outputId].set(value);\n }\n }\n\n if (nonDefinedOutputIds.length > 0) {\n const idsString = nonDefinedOutputIds.map((i) => `\"${i}\"`).join(', ');\n this.ctx.logger.warn(`Some outputs are not defined in step config: ${idsString}`);\n }\n\n const nonSetRequiredOutputIds: string[] = [];\n for (const output of this.outputs ?? []) {\n try {\n const value = output.value;\n this.ctx.logger.debug(`Output parameter \"${output.id}\" is set to \"${value}\"`);\n } catch (err) {\n this.ctx.logger.debug({ err }, `Getting value for output parameter \"${output.id}\" failed.`);\n nonSetRequiredOutputIds.push(output.id);\n }\n }\n if (nonSetRequiredOutputIds.length > 0) {\n const idsString = nonSetRequiredOutputIds.map((i) => `\"${i}\"`).join(', ');\n throw new BuildStepRuntimeError(`Some required outputs have not been set: ${idsString}`, {\n metadata: { ids: nonSetRequiredOutputIds },\n });\n }\n }\n\n private async collectAndUpdateEnvsAsync(envsDir: string): Promise<void> {\n const filenames = await fs.readdir(envsDir);\n\n const entries = await Promise.all(\n filenames.map(async (basename) => {\n const rawContents = await fs.readFile(path.join(envsDir, basename), 'utf-8');\n return [basename, rawContents];\n })\n );\n this.ctx.global.updateEnv({\n ...this.ctx.global.env,\n ...Object.fromEntries(entries),\n });\n }\n\n private get effectiveEnv(): Record<string, unknown> {\n return { ...this.ctx.global.env, ...this.stepEnvOverrides };\n }\n\n private getScriptEnv({\n envsDir,\n outputsDir,\n }: {\n envsDir: string;\n outputsDir: string;\n }): Record<string, string> {\n const env = this.effectiveEnv;\n const currentPath = env.PATH ?? process.env.PATH;\n const newPath = currentPath ? `${BIN_PATH}:${currentPath}` : BIN_PATH;\n return {\n ...env,\n __EXPO_STEPS_OUTPUTS_DIR: outputsDir,\n __EXPO_STEPS_ENVS_DIR: envsDir,\n __EXPO_STEPS_WORKING_DIRECTORY: this.ctx.workingDirectory,\n PATH: newPath,\n };\n }\n}\n"]}
@@ -48,7 +48,7 @@ export declare class BuildStep extends BuildStepOutputAccessor {
48
48
  readonly fn?: BuildStepFunction;
49
49
  readonly shell: string;
50
50
  readonly ctx: BuildStepContext;
51
- readonly env: BuildStepEnv;
51
+ readonly stepEnvOverrides: BuildStepEnv;
52
52
  readonly ifCondition?: string;
53
53
  status: BuildStepStatus;
54
54
  private readonly internalId;
@@ -86,5 +86,6 @@ export declare class BuildStep extends BuildStepOutputAccessor {
86
86
  private interpolateInputsAndGlobalContextInTemplate;
87
87
  private collectAndValidateOutputsAsync;
88
88
  private collectAndUpdateEnvsAsync;
89
+ private get effectiveEnv();
89
90
  private getScriptEnv;
90
91
  }
@@ -110,7 +110,7 @@ export class BuildStep extends BuildStepOutputAccessor {
110
110
  buildStepDisplayName: this.displayName,
111
111
  });
112
112
  this.ctx = ctx.stepCtx({ logger, relativeWorkingDirectory: maybeWorkingDirectory });
113
- this.env = env !== null && env !== void 0 ? env : {};
113
+ this.stepEnvOverrides = env !== null && env !== void 0 ? env : {};
114
114
  ctx.registerStep(this);
115
115
  }
116
116
  async executeAsync() {
@@ -166,7 +166,7 @@ export class BuildStep extends BuildStepOutputAccessor {
166
166
  failure: () => hasAnyPreviousStepsFailed,
167
167
  always: () => true,
168
168
  never: () => false,
169
- env: this.env,
169
+ env: this.effectiveEnv,
170
170
  inputs: (_b = (_a = this.inputs) === null || _a === void 0 ? void 0 : _a.reduce((acc, input) => {
171
171
  acc[input.id] = input.value;
172
172
  return acc;
@@ -296,9 +296,12 @@ export class BuildStep extends BuildStepOutputAccessor {
296
296
  ...Object.fromEntries(entries),
297
297
  });
298
298
  }
299
+ get effectiveEnv() {
300
+ return { ...this.ctx.global.env, ...this.stepEnvOverrides };
301
+ }
299
302
  getScriptEnv({ envsDir, outputsDir, }) {
300
303
  var _a;
301
- const env = { ...this.ctx.global.env, ...this.env };
304
+ const env = this.effectiveEnv;
302
305
  const currentPath = (_a = env.PATH) !== null && _a !== void 0 ? _a : process.env.PATH;
303
306
  const newPath = currentPath ? `${BIN_PATH}:${currentPath}` : BIN_PATH;
304
307
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"BuildStep.js","sourceRoot":"","sources":["../src/BuildStep.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,EAAsC,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EACL,eAAe,EAGf,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EACL,oCAAoC,EACpC,iCAAiC,EACjC,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,8CAA2B,CAAA;IAC3B,sCAAmB,CAAA;IACnB,gCAAa,CAAA;IACb,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;AACrB,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B;AAED,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;AACvB,CAAC,EAHW,kBAAkB,KAAlB,k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WAAW,CAAC,CAAC;QACjC,CAAC,CAAC,CACH,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;YACxB,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG;YACtB,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;IAEO,YAAY,CAAC,EACnB,OAAO,EACP,UAAU,GAIX;;QACC,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACpD,MAAM,WAAW,GAAG,MAAA,GAAG,CAAC,IAAI,mCAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACjD,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;QACtE,OAAO;YACL,GAAG,GAAG;YACN,wBAAwB,EAAE,UAAU;YACpC,qBAAqB,EAAE,OAAO;YAC9B,8BAA8B,EAAE,IAAI,CAAC,GAAG,CAAC,gBAAgB;YACzD,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;CACF","sourcesContent":["import assert from 'assert';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { BuildStepContext, BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStepInput, BuildStepInputById, makeBuildStepInputByIdMap } from './BuildStepInput.js';\nimport {\n BuildStepOutput,\n BuildStepOutputById,\n SerializedBuildStepOutput,\n makeBuildStepOutputByIdMap,\n} from './BuildStepOutput.js';\nimport { BIN_PATH } from './utils/shell/bin.js';\nimport { getDefaultShell, getShellCommandAndArgs } from './utils/shell/command.js';\nimport {\n cleanUpStepTemporaryDirectoriesAsync,\n createTemporaryEnvsDirectoryAsync,\n createTemporaryOutputsDirectoryAsync,\n saveScriptToTemporaryFileAsync,\n} from './BuildTemporaryFiles.js';\nimport { spawnAsync } from './utils/shell/spawn.js';\nimport { interpolateWithInputs } from './utils/template.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport { BuildStepEnv } from './BuildStepEnv.js';\nimport { BuildRuntimePlatform } from './BuildRuntimePlatform.js';\nimport { jsepEval } from './utils/jsepEval.js';\n\nexport enum BuildStepStatus {\n NEW = 'new',\n IN_PROGRESS = 'in-progress',\n SKIPPED = 'skipped',\n FAIL = 'fail',\n WARNING = 'warning',\n SUCCESS = 'success',\n}\n\nexport enum BuildStepLogMarker {\n START_STEP = 'start-step',\n END_STEP = 'end-step',\n}\n\nexport type BuildStepFunction = (\n ctx: BuildStepContext,\n {\n inputs,\n outputs,\n env,\n }: { inputs: BuildStepInputById; outputs: BuildStepOutputById; env: BuildStepEnv }\n) => unknown;\n\n// TODO: move to a place common with tests\nconst UUID_REGEX =\n /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/;\n\nexport interface SerializedBuildStepOutputAccessor {\n id: string;\n executed: boolean;\n outputById: Record<string, SerializedBuildStepOutput>;\n displayName: string;\n}\n\nexport class BuildStepOutputAccessor {\n constructor(\n public readonly id: string,\n public readonly displayName: string,\n protected readonly executed: boolean,\n protected readonly outputById: BuildStepOutputById\n ) {}\n\n public getOutputValueByName(name: string): string | undefined {\n if (!this.executed) {\n throw new BuildStepRuntimeError(\n `Failed getting output \"${name}\" from step \"${this.displayName}\". The step has not been executed yet.`\n );\n }\n if (!this.hasOutputParameter(name)) {\n throw new BuildStepRuntimeError(`Step \"${this.displayName}\" does not have output \"${name}\".`);\n }\n return this.outputById[name].value;\n }\n\n public hasOutputParameter(name: string): boolean {\n return name in this.outputById;\n }\n\n public serialize(): SerializedBuildStepOutputAccessor {\n return {\n id: this.id,\n executed: this.executed,\n outputById: Object.fromEntries(\n Object.entries(this.outputById).map(([key, value]) => [key, value.serialize()])\n ),\n displayName: this.displayName,\n };\n }\n\n public static deserialize(\n serialized: SerializedBuildStepOutputAccessor\n ): BuildStepOutputAccessor {\n const outputById = Object.fromEntries(\n Object.entries(serialized.outputById).map(([key, value]) => [\n key,\n BuildStepOutput.deserialize(value),\n ])\n );\n return new BuildStepOutputAccessor(\n serialized.id,\n serialized.displayName,\n serialized.executed,\n outputById\n );\n }\n}\n\nexport class BuildStep extends BuildStepOutputAccessor {\n public readonly id: string;\n public readonly name?: string;\n public readonly displayName: string;\n public readonly supportedRuntimePlatforms?: BuildRuntimePlatform[];\n public readonly inputs?: BuildStepInput[];\n public readonly outputs?: BuildStepOutput[];\n public readonly command?: string;\n public readonly fn?: BuildStepFunction;\n public readonly shell: string;\n public readonly ctx: BuildStepContext;\n public readonly env: BuildStepEnv;\n public readonly ifCondition?: string;\n public status: BuildStepStatus;\n\n private readonly internalId: string;\n private readonly inputById: BuildStepInputById;\n protected readonly outputById: BuildStepOutputById;\n protected executed = false;\n\n public static getNewId(userDefinedId?: string): string {\n return userDefinedId ?? uuidv4();\n }\n\n public static getDisplayName({\n id,\n name,\n command,\n }: {\n id: string;\n name?: string;\n command?: string;\n }): string {\n if (name) {\n return name;\n }\n if (!id.match(UUID_REGEX)) {\n return id;\n }\n if (command) {\n const splits = command.trim().split('\\n');\n for (const split of splits) {\n const trimmed = split.trim();\n if (trimmed && !trimmed.startsWith('#')) {\n return trimmed;\n }\n }\n }\n return id;\n }\n\n constructor(\n ctx: BuildStepGlobalContext,\n {\n id,\n name,\n displayName,\n inputs,\n outputs,\n command,\n fn,\n workingDirectory: maybeWorkingDirectory,\n shell,\n supportedRuntimePlatforms: maybeSupportedRuntimePlatforms,\n env,\n ifCondition,\n }: {\n id: string;\n name?: string;\n displayName: string;\n inputs?: BuildStepInput[];\n outputs?: BuildStepOutput[];\n command?: string;\n fn?: BuildStepFunction;\n workingDirectory?: string;\n shell?: string;\n supportedRuntimePlatforms?: BuildRuntimePlatform[];\n env?: BuildStepEnv;\n ifCondition?: string;\n }\n ) {\n assert(command !== undefined || fn !== undefined, 'Either command or fn must be defined.');\n assert(!(command !== undefined && fn !== undefined), 'Command and fn cannot be both set.');\n const outputById = makeBuildStepOutputByIdMap(outputs);\n super(id, displayName, false, outputById);\n\n this.id = id;\n this.name = name;\n this.displayName = displayName;\n this.supportedRuntimePlatforms = maybeSupportedRuntimePlatforms;\n this.inputs = inputs;\n this.outputs = outputs;\n this.inputById = makeBuildStepInputByIdMap(inputs);\n this.outputById = outputById;\n this.fn = fn;\n this.command = command;\n this.shell = shell ?? getDefaultShell();\n this.ifCondition = ifCondition;\n this.status = BuildStepStatus.NEW;\n\n this.internalId = uuidv4();\n\n const logger = ctx.baseLogger.child({\n buildStepInternalId: this.internalId,\n buildStepId: this.id,\n buildStepDisplayName: this.displayName,\n });\n this.ctx = ctx.stepCtx({ logger, relativeWorkingDirectory: maybeWorkingDirectory });\n this.env = env ?? {};\n\n ctx.registerStep(this);\n }\n\n public async executeAsync(): Promise<void> {\n try {\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.START_STEP },\n `Executing build step \"${this.displayName}\"`\n );\n this.status = BuildStepStatus.IN_PROGRESS;\n\n if (this.command !== undefined) {\n await this.executeCommandAsync();\n } else {\n await this.exectuteFnAsync();\n }\n\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.SUCCESS },\n `Finished build step \"${this.displayName}\" successfully`\n );\n this.status = BuildStepStatus.SUCCESS;\n } catch (err) {\n this.ctx.logger.error({ err });\n this.ctx.logger.error(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.FAIL },\n `Build step \"${this.displayName}\" failed`\n );\n this.status = BuildStepStatus.FAIL;\n throw err;\n } finally {\n this.executed = true;\n }\n }\n\n public hasOutputParameter(name: string): boolean {\n return name in this.outputById;\n }\n\n public getOutputValueByName(name: string): string | undefined {\n if (!this.executed) {\n throw new BuildStepRuntimeError(\n `Failed getting output \"${name}\" from step \"${this.displayName}\". The step has not been executed yet.`\n );\n }\n if (!this.hasOutputParameter(name)) {\n throw new BuildStepRuntimeError(`Step \"${this.displayName}\" does not have output \"${name}\".`);\n }\n return this.outputById[name].value;\n }\n\n public canBeRunOnRuntimePlatform(): boolean {\n return (\n !this.supportedRuntimePlatforms ||\n this.supportedRuntimePlatforms.includes(this.ctx.global.runtimePlatform)\n );\n }\n\n public shouldExecuteStep(hasAnyPreviousStepsFailed: boolean): boolean {\n if (!this.ifCondition) {\n return !hasAnyPreviousStepsFailed;\n }\n\n let ifCondition = this.ifCondition;\n\n if (ifCondition.startsWith('${') && ifCondition.endsWith('}')) {\n ifCondition = ifCondition.slice(2, -1);\n }\n\n return Boolean(\n jsepEval(ifCondition, {\n success: () => !hasAnyPreviousStepsFailed,\n failure: () => hasAnyPreviousStepsFailed,\n always: () => true,\n never: () => false,\n env: this.env,\n inputs:\n this.inputs?.reduce(\n (acc, input) => {\n acc[input.id] = input.value;\n return acc;\n },\n {} as Record<string, unknown>\n ) ?? {},\n eas: {\n runtimePlatform: this.ctx.global.runtimePlatform,\n ...this.ctx.global.staticContext,\n },\n })\n );\n }\n\n public skip(): void {\n this.status = BuildStepStatus.SKIPPED;\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.START_STEP },\n 'Executing build step \"${this.displayName}\"'\n );\n this.ctx.logger.info(`Skipped build step \"${this.displayName}\"`);\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.SKIPPED },\n `Skipped build step \"${this.displayName}\"`\n );\n }\n\n private async executeCommandAsync(): Promise<void> {\n assert(this.command, 'Command must be defined.');\n\n try {\n const command = this.interpolateInputsAndGlobalContextInTemplate(this.command, this.inputs);\n this.ctx.logger.debug(`Interpolated inputs in the command template`);\n\n const outputsDir = await createTemporaryOutputsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(`Created temporary directory for step outputs: ${outputsDir}`);\n\n const envsDir = await createTemporaryEnvsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(\n `Created temporary directory for step environment variables: ${outputsDir}`\n );\n\n const scriptPath = await saveScriptToTemporaryFileAsync(this.ctx.global, this.id, command);\n this.ctx.logger.debug(`Saved script to ${scriptPath}`);\n\n const { command: shellCommand, args } = getShellCommandAndArgs(this.shell, scriptPath);\n this.ctx.logger.debug(\n `Executing script: ${shellCommand}${args !== undefined ? ` ${args.join(' ')}` : ''}`\n );\n await spawnAsync(shellCommand, args ?? [], {\n cwd: this.ctx.workingDirectory,\n logger: this.ctx.logger,\n env: this.getScriptEnv({ outputsDir, envsDir }),\n // stdin is /dev/null, std{out,err} are piped into logger.\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n this.ctx.logger.debug(`Script completed successfully`);\n\n await this.collectAndValidateOutputsAsync(outputsDir);\n await this.collectAndUpdateEnvsAsync(envsDir);\n this.ctx.logger.debug('Finished collecting output paramters');\n } finally {\n await cleanUpStepTemporaryDirectoriesAsync(this.ctx.global, this.id);\n }\n }\n\n private async exectuteFnAsync(): Promise<void> {\n assert(this.fn, 'Function (fn) must be defined');\n\n try {\n const outputsDir = await createTemporaryOutputsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(`Created temporary directory for step outputs: ${outputsDir}`);\n\n const envsDir = await createTemporaryEnvsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(\n `Created temporary directory for step environment variables: ${outputsDir}`\n );\n\n await this.fn(this.ctx, {\n inputs: this.inputById,\n outputs: this.outputById,\n env: this.getScriptEnv({ outputsDir, envsDir }),\n });\n\n this.ctx.logger.debug(`Script completed successfully`);\n\n await this.collectAndValidateOutputsAsync(outputsDir);\n await this.collectAndUpdateEnvsAsync(envsDir);\n this.ctx.logger.debug('Finished collecting output paramters');\n } finally {\n await cleanUpStepTemporaryDirectoriesAsync(this.ctx.global, this.id);\n }\n }\n\n private interpolateInputsAndGlobalContextInTemplate(\n template: string,\n inputs?: BuildStepInput[]\n ): string {\n if (!inputs) {\n return this.ctx.global.interpolate(template);\n }\n const vars = inputs.reduce(\n (acc, input) => {\n acc[input.id] =\n typeof input.value === 'object'\n ? JSON.stringify(input.value)\n : input.value?.toString() ?? '';\n return acc;\n },\n {} as Record<string, string>\n );\n const valueInterpolatedWithGlobalContext = this.ctx.global.interpolate(template);\n return interpolateWithInputs(valueInterpolatedWithGlobalContext, vars);\n }\n\n private async collectAndValidateOutputsAsync(outputsDir: string): Promise<void> {\n const files = await fs.readdir(outputsDir);\n\n const nonDefinedOutputIds: string[] = [];\n for (const outputId of files) {\n if (!(outputId in this.outputById)) {\n nonDefinedOutputIds.push(outputId);\n } else {\n const file = path.join(outputsDir, outputId);\n const rawContents = await fs.readFile(file, 'utf-8');\n const value = rawContents.trim();\n this.outputById[outputId].set(value);\n }\n }\n\n if (nonDefinedOutputIds.length > 0) {\n const idsString = nonDefinedOutputIds.map((i) => `\"${i}\"`).join(', ');\n this.ctx.logger.warn(`Some outputs are not defined in step config: ${idsString}`);\n }\n\n const nonSetRequiredOutputIds: string[] = [];\n for (const output of this.outputs ?? []) {\n try {\n const value = output.value;\n this.ctx.logger.debug(`Output parameter \"${output.id}\" is set to \"${value}\"`);\n } catch (err) {\n this.ctx.logger.debug({ err }, `Getting value for output parameter \"${output.id}\" failed.`);\n nonSetRequiredOutputIds.push(output.id);\n }\n }\n if (nonSetRequiredOutputIds.length > 0) {\n const idsString = nonSetRequiredOutputIds.map((i) => `\"${i}\"`).join(', ');\n throw new BuildStepRuntimeError(`Some required outputs have not been set: ${idsString}`, {\n metadata: { ids: nonSetRequiredOutputIds },\n });\n }\n }\n\n private async collectAndUpdateEnvsAsync(envsDir: string): Promise<void> {\n const filenames = await fs.readdir(envsDir);\n\n const entries = await Promise.all(\n filenames.map(async (basename) => {\n const rawContents = await fs.readFile(path.join(envsDir, basename), 'utf-8');\n return [basename, rawContents];\n })\n );\n this.ctx.global.updateEnv({\n ...this.ctx.global.env,\n ...Object.fromEntries(entries),\n });\n }\n\n private getScriptEnv({\n envsDir,\n outputsDir,\n }: {\n envsDir: string;\n outputsDir: string;\n }): Record<string, string> {\n const env = { ...this.ctx.global.env, ...this.env };\n const currentPath = env.PATH ?? process.env.PATH;\n const newPath = currentPath ? `${BIN_PATH}:${currentPath}` : BIN_PATH;\n return {\n ...env,\n __EXPO_STEPS_OUTPUTS_DIR: outputsDir,\n __EXPO_STEPS_ENVS_DIR: envsDir,\n __EXPO_STEPS_WORKING_DIRECTORY: this.ctx.workingDirectory,\n PATH: newPath,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"BuildStep.js","sourceRoot":"","sources":["../src/BuildStep.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,EAAsC,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EACL,eAAe,EAGf,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EACL,oCAAoC,EACpC,iCAAiC,EACjC,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,8CAA2B,CAAA;IAC3B,sCAAmB,CAAA;IACnB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AG,CAC/B,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YAC/B,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;YAC7E,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACjC,CAAC,CAAC,CACH,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;YACxB,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG;YACtB,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;IAED,IAAY,YAAY;QACtB,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC9D,CAAC;IAEO,YAAY,CAAC,EACnB,OAAO,EACP,UAAU,GAIX;;QACC,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC;QAC9B,MAAM,WAAW,GAAG,MAAA,GAAG,CAAC,IAAI,mCAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACjD,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;QACtE,OAAO;YACL,GAAG,GAAG;YACN,wBAAwB,EAAE,UAAU;YACpC,qBAAqB,EAAE,OAAO;YAC9B,8BAA8B,EAAE,IAAI,CAAC,GAAG,CAAC,gBAAgB;YACzD,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;CACF","sourcesContent":["import assert from 'assert';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { BuildStepContext, BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStepInput, BuildStepInputById, makeBuildStepInputByIdMap } from './BuildStepInput.js';\nimport {\n BuildStepOutput,\n BuildStepOutputById,\n SerializedBuildStepOutput,\n makeBuildStepOutputByIdMap,\n} from './BuildStepOutput.js';\nimport { BIN_PATH } from './utils/shell/bin.js';\nimport { getDefaultShell, getShellCommandAndArgs } from './utils/shell/command.js';\nimport {\n cleanUpStepTemporaryDirectoriesAsync,\n createTemporaryEnvsDirectoryAsync,\n createTemporaryOutputsDirectoryAsync,\n saveScriptToTemporaryFileAsync,\n} from './BuildTemporaryFiles.js';\nimport { spawnAsync } from './utils/shell/spawn.js';\nimport { interpolateWithInputs } from './utils/template.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport { BuildStepEnv } from './BuildStepEnv.js';\nimport { BuildRuntimePlatform } from './BuildRuntimePlatform.js';\nimport { jsepEval } from './utils/jsepEval.js';\n\nexport enum BuildStepStatus {\n NEW = 'new',\n IN_PROGRESS = 'in-progress',\n SKIPPED = 'skipped',\n FAIL = 'fail',\n WARNING = 'warning',\n SUCCESS = 'success',\n}\n\nexport enum BuildStepLogMarker {\n START_STEP = 'start-step',\n END_STEP = 'end-step',\n}\n\nexport type BuildStepFunction = (\n ctx: BuildStepContext,\n {\n inputs,\n outputs,\n env,\n }: { inputs: BuildStepInputById; outputs: BuildStepOutputById; env: BuildStepEnv }\n) => unknown;\n\n// TODO: move to a place common with tests\nconst UUID_REGEX =\n /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/;\n\nexport interface SerializedBuildStepOutputAccessor {\n id: string;\n executed: boolean;\n outputById: Record<string, SerializedBuildStepOutput>;\n displayName: string;\n}\n\nexport class BuildStepOutputAccessor {\n constructor(\n public readonly id: string,\n public readonly displayName: string,\n protected readonly executed: boolean,\n protected readonly outputById: BuildStepOutputById\n ) {}\n\n public getOutputValueByName(name: string): string | undefined {\n if (!this.executed) {\n throw new BuildStepRuntimeError(\n `Failed getting output \"${name}\" from step \"${this.displayName}\". The step has not been executed yet.`\n );\n }\n if (!this.hasOutputParameter(name)) {\n throw new BuildStepRuntimeError(`Step \"${this.displayName}\" does not have output \"${name}\".`);\n }\n return this.outputById[name].value;\n }\n\n public hasOutputParameter(name: string): boolean {\n return name in this.outputById;\n }\n\n public serialize(): SerializedBuildStepOutputAccessor {\n return {\n id: this.id,\n executed: this.executed,\n outputById: Object.fromEntries(\n Object.entries(this.outputById).map(([key, value]) => [key, value.serialize()])\n ),\n displayName: this.displayName,\n };\n }\n\n public static deserialize(\n serialized: SerializedBuildStepOutputAccessor\n ): BuildStepOutputAccessor {\n const outputById = Object.fromEntries(\n Object.entries(serialized.outputById).map(([key, value]) => [\n key,\n BuildStepOutput.deserialize(value),\n ])\n );\n return new BuildStepOutputAccessor(\n serialized.id,\n serialized.displayName,\n serialized.executed,\n outputById\n );\n }\n}\n\nexport class BuildStep extends BuildStepOutputAccessor {\n public readonly id: string;\n public readonly name?: string;\n public readonly displayName: string;\n public readonly supportedRuntimePlatforms?: BuildRuntimePlatform[];\n public readonly inputs?: BuildStepInput[];\n public readonly outputs?: BuildStepOutput[];\n public readonly command?: string;\n public readonly fn?: BuildStepFunction;\n public readonly shell: string;\n public readonly ctx: BuildStepContext;\n public readonly stepEnvOverrides: BuildStepEnv;\n public readonly ifCondition?: string;\n public status: BuildStepStatus;\n\n private readonly internalId: string;\n private readonly inputById: BuildStepInputById;\n protected readonly outputById: BuildStepOutputById;\n protected executed = false;\n\n public static getNewId(userDefinedId?: string): string {\n return userDefinedId ?? uuidv4();\n }\n\n public static getDisplayName({\n id,\n name,\n command,\n }: {\n id: string;\n name?: string;\n command?: string;\n }): string {\n if (name) {\n return name;\n }\n if (!id.match(UUID_REGEX)) {\n return id;\n }\n if (command) {\n const splits = command.trim().split('\\n');\n for (const split of splits) {\n const trimmed = split.trim();\n if (trimmed && !trimmed.startsWith('#')) {\n return trimmed;\n }\n }\n }\n return id;\n }\n\n constructor(\n ctx: BuildStepGlobalContext,\n {\n id,\n name,\n displayName,\n inputs,\n outputs,\n command,\n fn,\n workingDirectory: maybeWorkingDirectory,\n shell,\n supportedRuntimePlatforms: maybeSupportedRuntimePlatforms,\n env,\n ifCondition,\n }: {\n id: string;\n name?: string;\n displayName: string;\n inputs?: BuildStepInput[];\n outputs?: BuildStepOutput[];\n command?: string;\n fn?: BuildStepFunction;\n workingDirectory?: string;\n shell?: string;\n supportedRuntimePlatforms?: BuildRuntimePlatform[];\n env?: BuildStepEnv;\n ifCondition?: string;\n }\n ) {\n assert(command !== undefined || fn !== undefined, 'Either command or fn must be defined.');\n assert(!(command !== undefined && fn !== undefined), 'Command and fn cannot be both set.');\n const outputById = makeBuildStepOutputByIdMap(outputs);\n super(id, displayName, false, outputById);\n\n this.id = id;\n this.name = name;\n this.displayName = displayName;\n this.supportedRuntimePlatforms = maybeSupportedRuntimePlatforms;\n this.inputs = inputs;\n this.outputs = outputs;\n this.inputById = makeBuildStepInputByIdMap(inputs);\n this.outputById = outputById;\n this.fn = fn;\n this.command = command;\n this.shell = shell ?? getDefaultShell();\n this.ifCondition = ifCondition;\n this.status = BuildStepStatus.NEW;\n\n this.internalId = uuidv4();\n\n const logger = ctx.baseLogger.child({\n buildStepInternalId: this.internalId,\n buildStepId: this.id,\n buildStepDisplayName: this.displayName,\n });\n this.ctx = ctx.stepCtx({ logger, relativeWorkingDirectory: maybeWorkingDirectory });\n this.stepEnvOverrides = env ?? {};\n\n ctx.registerStep(this);\n }\n\n public async executeAsync(): Promise<void> {\n try {\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.START_STEP },\n `Executing build step \"${this.displayName}\"`\n );\n this.status = BuildStepStatus.IN_PROGRESS;\n\n if (this.command !== undefined) {\n await this.executeCommandAsync();\n } else {\n await this.exectuteFnAsync();\n }\n\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.SUCCESS },\n `Finished build step \"${this.displayName}\" successfully`\n );\n this.status = BuildStepStatus.SUCCESS;\n } catch (err) {\n this.ctx.logger.error({ err });\n this.ctx.logger.error(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.FAIL },\n `Build step \"${this.displayName}\" failed`\n );\n this.status = BuildStepStatus.FAIL;\n throw err;\n } finally {\n this.executed = true;\n }\n }\n\n public hasOutputParameter(name: string): boolean {\n return name in this.outputById;\n }\n\n public getOutputValueByName(name: string): string | undefined {\n if (!this.executed) {\n throw new BuildStepRuntimeError(\n `Failed getting output \"${name}\" from step \"${this.displayName}\". The step has not been executed yet.`\n );\n }\n if (!this.hasOutputParameter(name)) {\n throw new BuildStepRuntimeError(`Step \"${this.displayName}\" does not have output \"${name}\".`);\n }\n return this.outputById[name].value;\n }\n\n public canBeRunOnRuntimePlatform(): boolean {\n return (\n !this.supportedRuntimePlatforms ||\n this.supportedRuntimePlatforms.includes(this.ctx.global.runtimePlatform)\n );\n }\n\n public shouldExecuteStep(hasAnyPreviousStepsFailed: boolean): boolean {\n if (!this.ifCondition) {\n return !hasAnyPreviousStepsFailed;\n }\n\n let ifCondition = this.ifCondition;\n\n if (ifCondition.startsWith('${') && ifCondition.endsWith('}')) {\n ifCondition = ifCondition.slice(2, -1);\n }\n\n return Boolean(\n jsepEval(ifCondition, {\n success: () => !hasAnyPreviousStepsFailed,\n failure: () => hasAnyPreviousStepsFailed,\n always: () => true,\n never: () => false,\n env: this.effectiveEnv,\n inputs:\n this.inputs?.reduce(\n (acc, input) => {\n acc[input.id] = input.value;\n return acc;\n },\n {} as Record<string, unknown>\n ) ?? {},\n eas: {\n runtimePlatform: this.ctx.global.runtimePlatform,\n ...this.ctx.global.staticContext,\n },\n })\n );\n }\n\n public skip(): void {\n this.status = BuildStepStatus.SKIPPED;\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.START_STEP },\n 'Executing build step \"${this.displayName}\"'\n );\n this.ctx.logger.info(`Skipped build step \"${this.displayName}\"`);\n this.ctx.logger.info(\n { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.SKIPPED },\n `Skipped build step \"${this.displayName}\"`\n );\n }\n\n private async executeCommandAsync(): Promise<void> {\n assert(this.command, 'Command must be defined.');\n\n try {\n const command = this.interpolateInputsAndGlobalContextInTemplate(this.command, this.inputs);\n this.ctx.logger.debug(`Interpolated inputs in the command template`);\n\n const outputsDir = await createTemporaryOutputsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(`Created temporary directory for step outputs: ${outputsDir}`);\n\n const envsDir = await createTemporaryEnvsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(\n `Created temporary directory for step environment variables: ${outputsDir}`\n );\n\n const scriptPath = await saveScriptToTemporaryFileAsync(this.ctx.global, this.id, command);\n this.ctx.logger.debug(`Saved script to ${scriptPath}`);\n\n const { command: shellCommand, args } = getShellCommandAndArgs(this.shell, scriptPath);\n this.ctx.logger.debug(\n `Executing script: ${shellCommand}${args !== undefined ? ` ${args.join(' ')}` : ''}`\n );\n await spawnAsync(shellCommand, args ?? [], {\n cwd: this.ctx.workingDirectory,\n logger: this.ctx.logger,\n env: this.getScriptEnv({ outputsDir, envsDir }),\n // stdin is /dev/null, std{out,err} are piped into logger.\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n this.ctx.logger.debug(`Script completed successfully`);\n\n await this.collectAndValidateOutputsAsync(outputsDir);\n await this.collectAndUpdateEnvsAsync(envsDir);\n this.ctx.logger.debug('Finished collecting output paramters');\n } finally {\n await cleanUpStepTemporaryDirectoriesAsync(this.ctx.global, this.id);\n }\n }\n\n private async exectuteFnAsync(): Promise<void> {\n assert(this.fn, 'Function (fn) must be defined');\n\n try {\n const outputsDir = await createTemporaryOutputsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(`Created temporary directory for step outputs: ${outputsDir}`);\n\n const envsDir = await createTemporaryEnvsDirectoryAsync(this.ctx.global, this.id);\n this.ctx.logger.debug(\n `Created temporary directory for step environment variables: ${outputsDir}`\n );\n\n await this.fn(this.ctx, {\n inputs: this.inputById,\n outputs: this.outputById,\n env: this.getScriptEnv({ outputsDir, envsDir }),\n });\n\n this.ctx.logger.debug(`Script completed successfully`);\n\n await this.collectAndValidateOutputsAsync(outputsDir);\n await this.collectAndUpdateEnvsAsync(envsDir);\n this.ctx.logger.debug('Finished collecting output paramters');\n } finally {\n await cleanUpStepTemporaryDirectoriesAsync(this.ctx.global, this.id);\n }\n }\n\n private interpolateInputsAndGlobalContextInTemplate(\n template: string,\n inputs?: BuildStepInput[]\n ): string {\n if (!inputs) {\n return this.ctx.global.interpolate(template);\n }\n const vars = inputs.reduce(\n (acc, input) => {\n acc[input.id] =\n typeof input.value === 'object'\n ? JSON.stringify(input.value)\n : input.value?.toString() ?? '';\n return acc;\n },\n {} as Record<string, string>\n );\n const valueInterpolatedWithGlobalContext = this.ctx.global.interpolate(template);\n return interpolateWithInputs(valueInterpolatedWithGlobalContext, vars);\n }\n\n private async collectAndValidateOutputsAsync(outputsDir: string): Promise<void> {\n const files = await fs.readdir(outputsDir);\n\n const nonDefinedOutputIds: string[] = [];\n for (const outputId of files) {\n if (!(outputId in this.outputById)) {\n nonDefinedOutputIds.push(outputId);\n } else {\n const file = path.join(outputsDir, outputId);\n const rawContents = await fs.readFile(file, 'utf-8');\n const value = rawContents.trim();\n this.outputById[outputId].set(value);\n }\n }\n\n if (nonDefinedOutputIds.length > 0) {\n const idsString = nonDefinedOutputIds.map((i) => `\"${i}\"`).join(', ');\n this.ctx.logger.warn(`Some outputs are not defined in step config: ${idsString}`);\n }\n\n const nonSetRequiredOutputIds: string[] = [];\n for (const output of this.outputs ?? []) {\n try {\n const value = output.value;\n this.ctx.logger.debug(`Output parameter \"${output.id}\" is set to \"${value}\"`);\n } catch (err) {\n this.ctx.logger.debug({ err }, `Getting value for output parameter \"${output.id}\" failed.`);\n nonSetRequiredOutputIds.push(output.id);\n }\n }\n if (nonSetRequiredOutputIds.length > 0) {\n const idsString = nonSetRequiredOutputIds.map((i) => `\"${i}\"`).join(', ');\n throw new BuildStepRuntimeError(`Some required outputs have not been set: ${idsString}`, {\n metadata: { ids: nonSetRequiredOutputIds },\n });\n }\n }\n\n private async collectAndUpdateEnvsAsync(envsDir: string): Promise<void> {\n const filenames = await fs.readdir(envsDir);\n\n const entries = await Promise.all(\n filenames.map(async (basename) => {\n const rawContents = await fs.readFile(path.join(envsDir, basename), 'utf-8');\n return [basename, rawContents];\n })\n );\n this.ctx.global.updateEnv({\n ...this.ctx.global.env,\n ...Object.fromEntries(entries),\n });\n }\n\n private get effectiveEnv(): Record<string, unknown> {\n return { ...this.ctx.global.env, ...this.stepEnvOverrides };\n }\n\n private getScriptEnv({\n envsDir,\n outputsDir,\n }: {\n envsDir: string;\n outputsDir: string;\n }): Record<string, string> {\n const env = this.effectiveEnv;\n const currentPath = env.PATH ?? process.env.PATH;\n const newPath = currentPath ? `${BIN_PATH}:${currentPath}` : BIN_PATH;\n return {\n ...env,\n __EXPO_STEPS_OUTPUTS_DIR: outputsDir,\n __EXPO_STEPS_ENVS_DIR: envsDir,\n __EXPO_STEPS_WORKING_DIRECTORY: this.ctx.workingDirectory,\n PATH: newPath,\n };\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@expo/steps",
3
3
  "type": "module",
4
- "version": "1.0.90",
4
+ "version": "1.0.92",
5
5
  "main": "./dist_commonjs/index.cjs",
6
6
  "types": "./dist_esm/index.d.ts",
7
7
  "exports": {
@@ -48,7 +48,7 @@
48
48
  "node": ">=16.0.0"
49
49
  },
50
50
  "dependencies": {
51
- "@expo/eas-build-job": "1.0.88",
51
+ "@expo/eas-build-job": "1.0.92",
52
52
  "@expo/logger": "1.0.57",
53
53
  "@expo/spawn-async": "^1.7.2",
54
54
  "arg": "^5.0.2",
@@ -65,5 +65,5 @@
65
65
  "node": "20.11.0",
66
66
  "yarn": "1.22.21"
67
67
  },
68
- "gitHead": "a8c2f0d7b24defc7016987a3d7f400f7808f4a29"
68
+ "gitHead": "ae2e8a0040b71319694191ed77b757a04238e307"
69
69
  }