@expo/build-tools 1.0.147 → 1.0.148

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.
@@ -48,6 +48,7 @@ class CustomBuildContext {
48
48
  var _a;
49
49
  return {
50
50
  ...this.job.workflowInterpolationContext,
51
+ expoApiServerURL: this.env.__API_SERVER_URL,
51
52
  job: this.job,
52
53
  metadata: (_a = this.metadata) !== null && _a !== void 0 ? _a : null,
53
54
  env: this.env,
@@ -1 +1 @@
1
- {"version":3,"file":"customBuildContext.js","sourceRoot":"","sources":["../src/customBuildContext.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,gDAAwB;AAExB,uDAS6B;AAE7B,uCAAiF;AAIjF,MAAM,8BAA8B,GAA2C;IAC7E,CAAC,wBAAQ,CAAC,OAAO,CAAC,EAAE,4BAAoB,CAAC,KAAK;IAC9C,CAAC,wBAAQ,CAAC,GAAG,CAAC,EAAE,4BAAoB,CAAC,MAAM;CAC5C,CAAC;AAMF,MAAa,kBAAkB;IA4B7B,YAAY,QAA4B;QACtC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAElC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,0BAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,sBAAsB,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC;QACvF,IAAI,CAAC,sBAAsB,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACtE,IAAI,CAAC,uBAAuB,GAAG,QAAQ,CAAC,8BAA8B,EAAE,CAAC;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AAkB;QACvD,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,4BAAY,CAAC,qBAAqB,EAAE,CAAC;YAChE,MAAM,IAAI,KAAK,CACb,+FAA+F,CAChG,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,GAAG;YACT,GAAG,GAAG;YACN,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW;YACjC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SACxE,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AA9FD,gDA8FC","sourcesContent":["import assert from 'assert';\nimport path from 'path';\n\nimport {\n BuildJob,\n BuildPhase,\n BuildTrigger,\n Env,\n Job,\n Metadata,\n Platform,\n StaticJobInterpolationContext,\n} from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport { ExternalBuildContextProvider, BuildRuntimePlatform } from '@expo/steps';\n\nimport { ArtifactToUpload, BuildContext } from './context';\n\nconst platformToBuildRuntimePlatform: Record<Platform, BuildRuntimePlatform> = {\n [Platform.ANDROID]: BuildRuntimePlatform.LINUX,\n [Platform.IOS]: BuildRuntimePlatform.DARWIN,\n};\n\nexport interface BuilderRuntimeApi {\n uploadArtifact: (spec: { artifact: ArtifactToUpload; logger: bunyan }) => Promise<void>;\n}\n\nexport class CustomBuildContext<TJob extends Job = Job> implements ExternalBuildContextProvider {\n /*\n * Directory that contains project sources before eas/checkout.\n */\n public readonly projectSourceDirectory: string;\n\n /*\n * Directory where build is executed. eas/checkout will copy sources here.\n */\n public readonly projectTargetDirectory: string;\n\n /*\n * Directory where all build steps will be executed unless configured otherwise.\n */\n public readonly defaultWorkingDirectory: string;\n\n /*\n * Directory where build logs will be stored unless configure otherwise.\n */\n public readonly buildLogsDirectory: string;\n\n public readonly logger: bunyan;\n public readonly runtimeApi: BuilderRuntimeApi;\n public job: TJob;\n public metadata?: Metadata;\n\n private _env: Env;\n\n constructor(buildCtx: BuildContext<TJob>) {\n this._env = buildCtx.env;\n this.job = buildCtx.job;\n this.metadata = buildCtx.metadata;\n\n this.logger = buildCtx.logger.child({ phase: BuildPhase.CUSTOM });\n this.projectSourceDirectory = path.join(buildCtx.workingdir, 'temporary-custom-build');\n this.projectTargetDirectory = path.join(buildCtx.workingdir, 'build');\n this.defaultWorkingDirectory = buildCtx.getReactNativeProjectDirectory();\n this.buildLogsDirectory = path.join(buildCtx.workingdir, 'logs');\n this.runtimeApi = {\n uploadArtifact: (...args) => buildCtx['uploadArtifact'](...args),\n };\n }\n\n public hasBuildJob(): this is CustomBuildContext<BuildJob> {\n return Boolean(this.job.platform);\n }\n\n public get runtimePlatform(): BuildRuntimePlatform {\n // Generic jobs are not per-platform.\n if (!this.job.platform) {\n assert(\n process.platform === 'linux' || process.platform === 'darwin',\n `Invalid platform, expected linux or darwin, got: ${process.platform}`\n );\n return {\n linux: BuildRuntimePlatform.LINUX,\n darwin: BuildRuntimePlatform.DARWIN,\n }[process.platform];\n }\n\n return platformToBuildRuntimePlatform[this.job.platform];\n }\n\n public get env(): Env {\n return this._env;\n }\n\n // We omit steps, because CustomBuildContext does not have steps.\n public staticContext(): Omit<StaticJobInterpolationContext, 'steps'> {\n return {\n ...this.job.workflowInterpolationContext,\n job: this.job,\n metadata: this.metadata ?? null,\n env: this.env,\n };\n }\n\n public updateEnv(env: Env): void {\n this._env = env;\n }\n\n public updateJobInformation(job: TJob, metadata: Metadata): void {\n if (this.job.triggeredBy !== BuildTrigger.GIT_BASED_INTEGRATION) {\n throw new Error(\n 'Updating job information is only allowed when build was triggered by a git-based integration.'\n );\n }\n this.job = {\n ...job,\n triggeredBy: this.job.triggeredBy,\n ...(this.job.platform ? { expoBuildUrl: this.job.expoBuildUrl } : null),\n };\n this.metadata = metadata;\n }\n}\n"]}
1
+ {"version":3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AAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SACxE,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AA/FD,gDA+FC","sourcesContent":["import assert from 'assert';\nimport path from 'path';\n\nimport {\n BuildJob,\n BuildPhase,\n BuildTrigger,\n Env,\n Job,\n Metadata,\n Platform,\n StaticJobInterpolationContext,\n} from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport { ExternalBuildContextProvider, BuildRuntimePlatform } from '@expo/steps';\n\nimport { ArtifactToUpload, BuildContext } from './context';\n\nconst platformToBuildRuntimePlatform: Record<Platform, BuildRuntimePlatform> = {\n [Platform.ANDROID]: BuildRuntimePlatform.LINUX,\n [Platform.IOS]: BuildRuntimePlatform.DARWIN,\n};\n\nexport interface BuilderRuntimeApi {\n uploadArtifact: (spec: { artifact: ArtifactToUpload; logger: bunyan }) => Promise<void>;\n}\n\nexport class CustomBuildContext<TJob extends Job = Job> implements ExternalBuildContextProvider {\n /*\n * Directory that contains project sources before eas/checkout.\n */\n public readonly projectSourceDirectory: string;\n\n /*\n * Directory where build is executed. eas/checkout will copy sources here.\n */\n public readonly projectTargetDirectory: string;\n\n /*\n * Directory where all build steps will be executed unless configured otherwise.\n */\n public readonly defaultWorkingDirectory: string;\n\n /*\n * Directory where build logs will be stored unless configure otherwise.\n */\n public readonly buildLogsDirectory: string;\n\n public readonly logger: bunyan;\n public readonly runtimeApi: BuilderRuntimeApi;\n public job: TJob;\n public metadata?: Metadata;\n\n private _env: Env;\n\n constructor(buildCtx: BuildContext<TJob>) {\n this._env = buildCtx.env;\n this.job = buildCtx.job;\n this.metadata = buildCtx.metadata;\n\n this.logger = buildCtx.logger.child({ phase: BuildPhase.CUSTOM });\n this.projectSourceDirectory = path.join(buildCtx.workingdir, 'temporary-custom-build');\n this.projectTargetDirectory = path.join(buildCtx.workingdir, 'build');\n this.defaultWorkingDirectory = buildCtx.getReactNativeProjectDirectory();\n this.buildLogsDirectory = path.join(buildCtx.workingdir, 'logs');\n this.runtimeApi = {\n uploadArtifact: (...args) => buildCtx['uploadArtifact'](...args),\n };\n }\n\n public hasBuildJob(): this is CustomBuildContext<BuildJob> {\n return Boolean(this.job.platform);\n }\n\n public get runtimePlatform(): BuildRuntimePlatform {\n // Generic jobs are not per-platform.\n if (!this.job.platform) {\n assert(\n process.platform === 'linux' || process.platform === 'darwin',\n `Invalid platform, expected linux or darwin, got: ${process.platform}`\n );\n return {\n linux: BuildRuntimePlatform.LINUX,\n darwin: BuildRuntimePlatform.DARWIN,\n }[process.platform];\n }\n\n return platformToBuildRuntimePlatform[this.job.platform];\n }\n\n public get env(): Env {\n return this._env;\n }\n\n // We omit steps, because CustomBuildContext does not have steps.\n public staticContext(): Omit<StaticJobInterpolationContext, 'steps'> {\n return {\n ...this.job.workflowInterpolationContext,\n expoApiServerURL: this.env.__API_SERVER_URL,\n job: this.job,\n metadata: this.metadata ?? null,\n env: this.env,\n };\n }\n\n public updateEnv(env: Env): void {\n this._env = env;\n }\n\n public updateJobInformation(job: TJob, metadata: Metadata): void {\n if (this.job.triggeredBy !== BuildTrigger.GIT_BASED_INTEGRATION) {\n throw new Error(\n 'Updating job information is only allowed when build was triggered by a git-based integration.'\n );\n }\n this.job = {\n ...job,\n triggeredBy: this.job.triggeredBy,\n ...(this.job.platform ? { expoBuildUrl: this.job.expoBuildUrl } : null),\n };\n this.metadata = metadata;\n }\n}\n"]}
@@ -26,6 +26,7 @@ const resolveBuildConfig_1 = require("./functions/resolveBuildConfig");
26
26
  const calculateEASUpdateRuntimeVersion_1 = require("./functions/calculateEASUpdateRuntimeVersion");
27
27
  const repack_1 = require("./functions/repack");
28
28
  const eagerBundle_1 = require("./functions/eagerBundle");
29
+ const createSubmissionEntity_1 = require("./functions/createSubmissionEntity");
29
30
  function getEasFunctions(ctx) {
30
31
  const functions = [
31
32
  (0, checkout_1.createCheckoutBuildFunction)(),
@@ -50,6 +51,7 @@ function getEasFunctions(ctx) {
50
51
  (0, sendSlackMessage_1.createSendSlackMessageFunction)(),
51
52
  (0, calculateEASUpdateRuntimeVersion_1.calculateEASUpdateRuntimeVersionFunction)(),
52
53
  (0, repack_1.createRepackBuildFunction)(),
54
+ (0, createSubmissionEntity_1.createSubmissionEntityFunction)(),
53
55
  ];
54
56
  if (ctx.hasBuildJob()) {
55
57
  functions.push(...[
@@ -1 +1 @@
1
- {"version":3,"file":"easFunctions.js","sourceRoot":"","sources":["../../src/steps/easFunctions.ts"],"names":[],"mappings":";;;AAIA,+DAA+E;AAC/E,mDAAmE;AACnE,yDAAwE;AACxE,uEAAuF;AACvF,mDAAmE;AACnE,yFAAyG;AACzG,6FAAkG;AAClG,mFAAwF;AACxF,iFAAsF;AACtF,qDAA0D;AAC1D,qGAA0G;AAC1G,iFAAsF;AACtF,yEAA8E;AAC9E,yFAA8F;AAC9F,yDAA8D;AAC9D,2EAA2F;AAC3F,qEAAqF;AACrF,+DAA+E;AAC/E,uIAA0I;AAC1I,yDAAyE;AACzE,mEAA8E;AAC9E,uEAAuF;AACvF,mGAAwG;AACxG,+CAA+D;AAC/D,yDAAmE;AAEnE,SAAgB,eAAe,CAAC,GAAuB;IACrD,MAAM,SAAS,GAAG;QAChB,IAAA,sCAA2B,GAAE;QAC7B,IAAA,kDAAiC,EAAC,GAAG,CAAC;QACtC,IAAA,2CAA6B,GAAE;QAC/B,IAAA,0DAAqC,GAAE;QACvC,IAAA,sCAA2B,GAAE;QAE7B,IAAA,qEAAqC,GAAE;QACvC,IAAA,2DAAgC,GAAE;QAClC,IAAA,yDAA+B,GAAE;QACjC,IAAA,sCAAwB,GAAE;QAC1B,IAAA,6BAAiB,GAAE;QACnB,IAAA,6EAAyC,GAAE;QAC3C,IAAA,yDAA+B,GAAE;QACjC,IAAA,iDAA2B,GAAE;QAC7B,IAAA,iEAAmC,GAAE;QACrC,IAAA,iCAAmB,GAAE;QACrB,IAAA,8DAAuC,GAAE;QACzC,IAAA,wDAAoC,GAAE;QACtC,IAAA,kDAAiC,GAAE;QAEnC,IAAA,4CAA8B,GAAE;QAChC,IAAA,iDAA8B,GAAE;QAEhC,IAAA,2EAAwC,GAAE;QAE1C,IAAA,kCAAyB,GAAE;KAC5B,CAAC;IAEF,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;QACtB,SAAS,CAAC,IAAI,CACZ,GAAG;YACD,IAAA,4EAA8C,EAAC,GAAG,CAAC;YACnD,IAAA,0DAAqC,EAAC,GAAG,CAAC;YAC1C,IAAA,6GAAwD,EAAC,GAAG,CAAC;SAC9D,CACF,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAzCD,0CAyCC","sourcesContent":["import { BuildFunction } from '@expo/steps';\n\nimport { CustomBuildContext } from '../customBuildContext';\n\nimport { createUploadArtifactBuildFunction } from './functions/uploadArtifact';\nimport { createCheckoutBuildFunction } from './functions/checkout';\nimport { createSetUpNpmrcBuildFunction } from './functions/useNpmToken';\nimport { createInstallNodeModulesBuildFunction } from './functions/installNodeModules';\nimport { createPrebuildBuildFunction } from './functions/prebuild';\nimport { createFindAndUploadBuildArtifactsBuildFunction } from './functions/findAndUploadBuildArtifacts';\nimport { configureEASUpdateIfInstalledFunction } from './functions/configureEASUpdateIfInstalled';\nimport { injectAndroidCredentialsFunction } from './functions/injectAndroidCredentials';\nimport { configureAndroidVersionFunction } from './functions/configureAndroidVersion';\nimport { runGradleFunction } from './functions/runGradle';\nimport { resolveAppleTeamIdFromCredentialsFunction } from './functions/resolveAppleTeamIdFromCredentials';\nimport { configureIosCredentialsFunction } from './functions/configureIosCredentials';\nimport { configureIosVersionFunction } from './functions/configureIosVersion';\nimport { generateGymfileFromTemplateFunction } from './functions/generateGymfileFromTemplate';\nimport { runFastlaneFunction } from './functions/runFastlane';\nimport { createStartAndroidEmulatorBuildFunction } from './functions/startAndroidEmulator';\nimport { createStartIosSimulatorBuildFunction } from './functions/startIosSimulator';\nimport { createInstallMaestroBuildFunction } from './functions/installMaestro';\nimport { createGetCredentialsForBuildTriggeredByGithubIntegration } from './functions/getCredentialsForBuildTriggeredByGitHubIntegration';\nimport { createInstallPodsBuildFunction } from './functions/installPods';\nimport { createSendSlackMessageFunction } from './functions/sendSlackMessage';\nimport { createResolveBuildConfigBuildFunction } from './functions/resolveBuildConfig';\nimport { calculateEASUpdateRuntimeVersionFunction } from './functions/calculateEASUpdateRuntimeVersion';\nimport { createRepackBuildFunction } from './functions/repack';\nimport { eagerBundleBuildFunction } from './functions/eagerBundle';\n\nexport function getEasFunctions(ctx: CustomBuildContext): BuildFunction[] {\n const functions = [\n createCheckoutBuildFunction(),\n createUploadArtifactBuildFunction(ctx),\n createSetUpNpmrcBuildFunction(),\n createInstallNodeModulesBuildFunction(),\n createPrebuildBuildFunction(),\n\n configureEASUpdateIfInstalledFunction(),\n injectAndroidCredentialsFunction(),\n configureAndroidVersionFunction(),\n eagerBundleBuildFunction(),\n runGradleFunction(),\n resolveAppleTeamIdFromCredentialsFunction(),\n configureIosCredentialsFunction(),\n configureIosVersionFunction(),\n generateGymfileFromTemplateFunction(),\n runFastlaneFunction(),\n createStartAndroidEmulatorBuildFunction(),\n createStartIosSimulatorBuildFunction(),\n createInstallMaestroBuildFunction(),\n\n createInstallPodsBuildFunction(),\n createSendSlackMessageFunction(),\n\n calculateEASUpdateRuntimeVersionFunction(),\n\n createRepackBuildFunction(),\n ];\n\n if (ctx.hasBuildJob()) {\n functions.push(\n ...[\n createFindAndUploadBuildArtifactsBuildFunction(ctx),\n createResolveBuildConfigBuildFunction(ctx),\n createGetCredentialsForBuildTriggeredByGithubIntegration(ctx),\n ]\n );\n }\n\n return functions;\n}\n"]}
1
+ {"version":3,"file":"easFunctions.js","sourceRoot":"","sources":["../../src/steps/easFunctions.ts"],"names":[],"mappings":";;;AAIA,+DAA+E;AAC/E,mDAAmE;AACnE,yDAAwE;A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,GAAG,CAAC;SAC9D,CACF,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AA3CD,0CA2CC","sourcesContent":["import { BuildFunction } from '@expo/steps';\n\nimport { CustomBuildContext } from '../customBuildContext';\n\nimport { createUploadArtifactBuildFunction } from './functions/uploadArtifact';\nimport { createCheckoutBuildFunction } from './functions/checkout';\nimport { createSetUpNpmrcBuildFunction } from './functions/useNpmToken';\nimport { createInstallNodeModulesBuildFunction } from './functions/installNodeModules';\nimport { createPrebuildBuildFunction } from './functions/prebuild';\nimport { createFindAndUploadBuildArtifactsBuildFunction } from './functions/findAndUploadBuildArtifacts';\nimport { configureEASUpdateIfInstalledFunction } from './functions/configureEASUpdateIfInstalled';\nimport { injectAndroidCredentialsFunction } from './functions/injectAndroidCredentials';\nimport { configureAndroidVersionFunction } from './functions/configureAndroidVersion';\nimport { runGradleFunction } from './functions/runGradle';\nimport { resolveAppleTeamIdFromCredentialsFunction } from './functions/resolveAppleTeamIdFromCredentials';\nimport { configureIosCredentialsFunction } from './functions/configureIosCredentials';\nimport { configureIosVersionFunction } from './functions/configureIosVersion';\nimport { generateGymfileFromTemplateFunction } from './functions/generateGymfileFromTemplate';\nimport { runFastlaneFunction } from './functions/runFastlane';\nimport { createStartAndroidEmulatorBuildFunction } from './functions/startAndroidEmulator';\nimport { createStartIosSimulatorBuildFunction } from './functions/startIosSimulator';\nimport { createInstallMaestroBuildFunction } from './functions/installMaestro';\nimport { createGetCredentialsForBuildTriggeredByGithubIntegration } from './functions/getCredentialsForBuildTriggeredByGitHubIntegration';\nimport { createInstallPodsBuildFunction } from './functions/installPods';\nimport { createSendSlackMessageFunction } from './functions/sendSlackMessage';\nimport { createResolveBuildConfigBuildFunction } from './functions/resolveBuildConfig';\nimport { calculateEASUpdateRuntimeVersionFunction } from './functions/calculateEASUpdateRuntimeVersion';\nimport { createRepackBuildFunction } from './functions/repack';\nimport { eagerBundleBuildFunction } from './functions/eagerBundle';\nimport { createSubmissionEntityFunction } from './functions/createSubmissionEntity';\n\nexport function getEasFunctions(ctx: CustomBuildContext): BuildFunction[] {\n const functions = [\n createCheckoutBuildFunction(),\n createUploadArtifactBuildFunction(ctx),\n createSetUpNpmrcBuildFunction(),\n createInstallNodeModulesBuildFunction(),\n createPrebuildBuildFunction(),\n\n configureEASUpdateIfInstalledFunction(),\n injectAndroidCredentialsFunction(),\n configureAndroidVersionFunction(),\n eagerBundleBuildFunction(),\n runGradleFunction(),\n resolveAppleTeamIdFromCredentialsFunction(),\n configureIosCredentialsFunction(),\n configureIosVersionFunction(),\n generateGymfileFromTemplateFunction(),\n runFastlaneFunction(),\n createStartAndroidEmulatorBuildFunction(),\n createStartIosSimulatorBuildFunction(),\n createInstallMaestroBuildFunction(),\n\n createInstallPodsBuildFunction(),\n createSendSlackMessageFunction(),\n\n calculateEASUpdateRuntimeVersionFunction(),\n\n createRepackBuildFunction(),\n\n createSubmissionEntityFunction(),\n ];\n\n if (ctx.hasBuildJob()) {\n functions.push(\n ...[\n createFindAndUploadBuildArtifactsBuildFunction(ctx),\n createResolveBuildConfigBuildFunction(ctx),\n createGetCredentialsForBuildTriggeredByGithubIntegration(ctx),\n ]\n );\n }\n\n return functions;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { BuildFunction } from '@expo/steps';
2
+ export declare function createSubmissionEntityFunction(): BuildFunction;
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSubmissionEntityFunction = void 0;
4
+ const steps_1 = require("@expo/steps");
5
+ const results_1 = require("@expo/results");
6
+ const retryOnDNSFailure_1 = require("../../utils/retryOnDNSFailure");
7
+ function createSubmissionEntityFunction() {
8
+ return new steps_1.BuildFunction({
9
+ namespace: 'eas',
10
+ id: 'create_submission_entity',
11
+ name: 'Create Submission Entity',
12
+ inputProviders: [
13
+ steps_1.BuildStepInput.createProvider({
14
+ id: 'build_id',
15
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
16
+ required: true,
17
+ }),
18
+ // AndroidSubmissionConfig
19
+ steps_1.BuildStepInput.createProvider({
20
+ id: 'track',
21
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
22
+ required: false,
23
+ }),
24
+ steps_1.BuildStepInput.createProvider({
25
+ id: 'release_status',
26
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
27
+ required: false,
28
+ }),
29
+ steps_1.BuildStepInput.createProvider({
30
+ id: 'rollout',
31
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.NUMBER,
32
+ required: false,
33
+ }),
34
+ steps_1.BuildStepInput.createProvider({
35
+ id: 'changes_not_sent_for_review',
36
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.BOOLEAN,
37
+ required: false,
38
+ }),
39
+ // IosSubmissionConfig
40
+ steps_1.BuildStepInput.createProvider({
41
+ id: 'apple_id_username',
42
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
43
+ required: false,
44
+ }),
45
+ steps_1.BuildStepInput.createProvider({
46
+ id: 'asc_app_identifier',
47
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
48
+ required: false,
49
+ }),
50
+ ],
51
+ fn: async (stepsCtx, { inputs }) => {
52
+ var _a;
53
+ const robotAccessToken = (_a = stepsCtx.global.staticContext.job.secrets) === null || _a === void 0 ? void 0 : _a.robotAccessToken;
54
+ if (!robotAccessToken) {
55
+ stepsCtx.logger.error('Failed to create submission entity: no robot access token found');
56
+ return;
57
+ }
58
+ const buildId = inputs.build_id.value;
59
+ if (!buildId) {
60
+ stepsCtx.logger.error('Failed to create submission entity: no build ID provided');
61
+ return;
62
+ }
63
+ const workflowJobId = stepsCtx.global.staticContext.env.__WORKFLOW_JOB_ID;
64
+ if (!workflowJobId) {
65
+ stepsCtx.logger.error('Failed to create submission entity: no workflow job ID found');
66
+ return;
67
+ }
68
+ // This is supposed to provide fallback for `''` -> `undefined`.
69
+ // We _not_ want to use nullish coalescing.
70
+ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
71
+ const track = inputs.track.value || undefined;
72
+ const releaseStatus = inputs.release_status.value || undefined;
73
+ const rollout = inputs.rollout.value || undefined;
74
+ const changesNotSentForReview = inputs.changes_not_sent_for_review.value || undefined;
75
+ const appleIdUsername = inputs.apple_id_username.value || undefined;
76
+ const ascAppIdentifier = inputs.asc_app_identifier.value || undefined;
77
+ /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */
78
+ try {
79
+ const response = await (0, retryOnDNSFailure_1.retryOnDNSFailure)(fetch)(new URL('/v2/app-store-submissions/', stepsCtx.global.staticContext.expoApiServerURL), {
80
+ method: 'POST',
81
+ headers: {
82
+ Authorization: `Bearer ${robotAccessToken}`,
83
+ 'Content-Type': 'application/json',
84
+ },
85
+ body: JSON.stringify({
86
+ workflowJobId,
87
+ turtleBuildId: buildId,
88
+ // We can pass mixed object here because the configs are disjoint.
89
+ config: {
90
+ // AndroidSubmissionConfig
91
+ track,
92
+ releaseStatus,
93
+ rollout,
94
+ changesNotSentForReview,
95
+ // IosSubmissionConfig
96
+ appleIdUsername,
97
+ ascAppIdentifier,
98
+ },
99
+ }),
100
+ });
101
+ if (!response.ok) {
102
+ const textResult = await (0, results_1.asyncResult)(response.text());
103
+ throw new Error(`Unexpected response from server (${response.status}): ${textResult.value}`);
104
+ }
105
+ const jsonResult = await (0, results_1.asyncResult)(response.json());
106
+ if (!jsonResult.ok) {
107
+ stepsCtx.logger.warn(`Submission created. Failed to parse response. ${jsonResult.reason}`);
108
+ return;
109
+ }
110
+ const data = jsonResult.value.data;
111
+ stepsCtx.logger.info(`Submission created:\n ID: ${data.id}\n URL: ${data.url}`);
112
+ }
113
+ catch (e) {
114
+ stepsCtx.logger.error(`Failed to create submission entity. ${e}`);
115
+ }
116
+ },
117
+ });
118
+ }
119
+ exports.createSubmissionEntityFunction = createSubmissionEntityFunction;
120
+ //# sourceMappingURL=createSubmissionEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSubmissionEntity.js","sourceRoot":"","sources":["../../../src/steps/functions/createSubmissionEntity.ts"],"names":[],"mappings":";;;AAAA,uCAAyF;AACzF,2CAA4C;AAE5C,qEAAkE;AAElE,SAAgB,8BAA8B;IAC5C,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,0BAA0B;QAC9B,IAAI,EAAE,0BAA0B;QAChC,cAAc,EAAE;YACd,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,UAAU;gBACd,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;gBACxD,QAAQ,EAAE,IAAI;aACf,CAAC;YAEF,0BAA0B;YAC1B,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,OAAO;gBACX,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;gBACxD,QAAQ,EAAE,KAAK;aAChB,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,gBAAgB;gBACpB,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;gBACxD,QAAQ,EAAE,KAAK;aAChB,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,SAAS;gBACb,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;gBACxD,QAAQ,EAAE,KAAK;aAChB,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,6BAA6B;gBACjC,oBAAoB,EAAE,mCAA2B,CAAC,OAAO;gBACzD,QAAQ,EAAE,KAAK;aAChB,CAAC;YAEF,sBAAsB;YACtB,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,mBAAmB;gBACvB,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;gBACxD,QAAQ,EAAE,KAAK;aAChB,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,oBAAoB;gBACxB,oBAAoB,EAAE,mCAA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,YAAY,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;YACpF,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC,EAAE,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AA/HD,wEA+HC","sourcesContent":["import { BuildFunction, BuildStepInput, BuildStepInputValueTypeName } from '@expo/steps';\nimport { asyncResult } from '@expo/results';\n\nimport { retryOnDNSFailure } from '../../utils/retryOnDNSFailure';\n\nexport function createSubmissionEntityFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'create_submission_entity',\n name: 'Create Submission Entity',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'build_id',\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n required: true,\n }),\n\n // AndroidSubmissionConfig\n BuildStepInput.createProvider({\n id: 'track',\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n required: false,\n }),\n BuildStepInput.createProvider({\n id: 'release_status',\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n required: false,\n }),\n BuildStepInput.createProvider({\n id: 'rollout',\n allowedValueTypeName: BuildStepInputValueTypeName.NUMBER,\n required: false,\n }),\n BuildStepInput.createProvider({\n id: 'changes_not_sent_for_review',\n allowedValueTypeName: BuildStepInputValueTypeName.BOOLEAN,\n required: false,\n }),\n\n // IosSubmissionConfig\n BuildStepInput.createProvider({\n id: 'apple_id_username',\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n required: false,\n }),\n BuildStepInput.createProvider({\n id: 'asc_app_identifier',\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n required: false,\n }),\n ],\n fn: async (stepsCtx, { inputs }) => {\n const robotAccessToken = stepsCtx.global.staticContext.job.secrets?.robotAccessToken;\n if (!robotAccessToken) {\n stepsCtx.logger.error('Failed to create submission entity: no robot access token found');\n return;\n }\n\n const buildId = inputs.build_id.value;\n if (!buildId) {\n stepsCtx.logger.error('Failed to create submission entity: no build ID provided');\n return;\n }\n\n const workflowJobId = stepsCtx.global.staticContext.env.__WORKFLOW_JOB_ID;\n if (!workflowJobId) {\n stepsCtx.logger.error('Failed to create submission entity: no workflow job ID found');\n return;\n }\n\n // This is supposed to provide fallback for `''` -> `undefined`.\n // We _not_ want to use nullish coalescing.\n /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\n const track = inputs.track.value || undefined;\n const releaseStatus = inputs.release_status.value || undefined;\n const rollout = inputs.rollout.value || undefined;\n const changesNotSentForReview = inputs.changes_not_sent_for_review.value || undefined;\n\n const appleIdUsername = inputs.apple_id_username.value || undefined;\n const ascAppIdentifier = inputs.asc_app_identifier.value || undefined;\n /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */\n\n try {\n const response = await retryOnDNSFailure(fetch)(\n new URL('/v2/app-store-submissions/', stepsCtx.global.staticContext.expoApiServerURL),\n {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${robotAccessToken}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n workflowJobId,\n turtleBuildId: buildId,\n // We can pass mixed object here because the configs are disjoint.\n config: {\n // AndroidSubmissionConfig\n track,\n releaseStatus,\n rollout,\n changesNotSentForReview,\n\n // IosSubmissionConfig\n appleIdUsername,\n ascAppIdentifier,\n },\n }),\n }\n );\n\n if (!response.ok) {\n const textResult = await asyncResult(response.text());\n throw new Error(\n `Unexpected response from server (${response.status}): ${textResult.value}`\n );\n }\n\n const jsonResult = await asyncResult(response.json());\n if (!jsonResult.ok) {\n stepsCtx.logger.warn(\n `Submission created. Failed to parse response. ${jsonResult.reason}`\n );\n return;\n }\n\n const data = jsonResult.value.data;\n stepsCtx.logger.info(`Submission created:\\n ID: ${data.id}\\n URL: ${data.url}`);\n } catch (e) {\n stepsCtx.logger.error(`Failed to create submission entity. ${e}`);\n }\n },\n });\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /// <reference types="bunyan" />
2
+ import { BuildStepEnv } from '@expo/steps';
3
+ import { bunyan } from '@expo/logger';
4
+ export declare function diffFingerprintsAsync(projectDir: string, fingerprint1File: string, fingerprint2File: string, { env, logger }: {
5
+ env: BuildStepEnv;
6
+ logger: bunyan;
7
+ }): Promise<string>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.diffFingerprintsAsync = void 0;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const expoFingerprintCli_1 = require("./expoFingerprintCli");
9
+ const fingerprint_1 = require("./fingerprint");
10
+ async function diffFingerprintsAsync(projectDir, fingerprint1File, fingerprint2File, { env, logger }) {
11
+ if (!(await (0, expoFingerprintCli_1.isModernExpoFingerprintCLISupportedAsync)(projectDir))) {
12
+ logger.debug('Falling back to local fingerprint diff');
13
+ return await diffFingerprintsFallbackAsync(fingerprint1File, fingerprint2File);
14
+ }
15
+ try {
16
+ return await diffFingerprintsCommandAsync(projectDir, fingerprint1File, fingerprint2File, {
17
+ env,
18
+ });
19
+ }
20
+ catch (e) {
21
+ if (e instanceof expoFingerprintCli_1.ExpoFingerprintCLIModuleNotFoundError ||
22
+ e instanceof expoFingerprintCli_1.ExpoFingerprintCLICommandFailedError ||
23
+ e instanceof expoFingerprintCli_1.ExpoFingerprintCLIInvalidCommandError) {
24
+ logger.debug('Falling back to local fingerprint diff');
25
+ return await diffFingerprintsFallbackAsync(fingerprint1File, fingerprint2File);
26
+ }
27
+ throw e;
28
+ }
29
+ }
30
+ exports.diffFingerprintsAsync = diffFingerprintsAsync;
31
+ async function diffFingerprintsCommandAsync(projectDir, fingerprint1File, fingerprint2File, { env }) {
32
+ return await (0, expoFingerprintCli_1.expoFingerprintCommandAsync)(projectDir, ['fingerprint:diff', fingerprint1File, fingerprint2File], {
33
+ env,
34
+ });
35
+ }
36
+ async function diffFingerprintsFallbackAsync(fingerprint1File, fingerprint2File) {
37
+ const [fingeprint1, fingerprint2] = await Promise.all([
38
+ fs_extra_1.default.readJSON(fingerprint1File),
39
+ fs_extra_1.default.readJSON(fingerprint2File),
40
+ ]);
41
+ return JSON.stringify((0, fingerprint_1.diffFingerprints)(fingeprint1, fingerprint2));
42
+ }
43
+ //# sourceMappingURL=diffFingerprintsAsync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diffFingerprintsAsync.js","sourceRoot":"","sources":["../../src/utils/diffFingerprintsAsync.ts"],"names":[],"mappings":";;;;;;AACA,wDAA0B;AAG1B,6DAM8B;AAC9B,+CAAiD;AAE1C,KAAK,UAAU,qBAAqB,CACzC,UAAkB,EAClB,gBAAwB,EACxB,gBAAwB,EACxB,EAAE,GAAG,EAAE,MAAM,EAAyC;IAEtD,IAAI,CAAC,CAAC,MAAM,IAAA,6DAAwC,EAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAClE,MAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;QACvD,OAAO,MAAM,6BAA6B,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;IACjF,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,4BAA4B,CAAC,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE;YACxF,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IACE,CAAC,YAAY,0DAAqC;YAClD,CAAC,YAAY,yDAAoC;YACjD,CAAC,YAAY,0DAAqC,EAClD,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;YACvD,OAAO,MAAM,6BAA6B,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;QACjF,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AA1BD,sDA0BC;AAED,KAAK,UAAU,4BAA4B,CACzC,UAAkB,EAClB,gBAAwB,EACxB,gBAAwB,EACxB,EAAE,GAAG,EAAyB;IAE9B,OAAO,MAAM,IAAA,gDAA2B,EACtC,UAAU,EACV,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,EACxD;QACE,GAAG;KACJ,CACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,6BAA6B,CAC1C,gBAAwB,EACxB,gBAAwB;IAExB,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACpD,kBAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAC7B,kBAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;KAC9B,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,SAAS,CAAC,IAAA,8BAAgB,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import { BuildStepEnv } from '@expo/steps';\nimport fs from 'fs-extra';\nimport { bunyan } from '@expo/logger';\n\nimport {\n ExpoFingerprintCLICommandFailedError,\n ExpoFingerprintCLIInvalidCommandError,\n ExpoFingerprintCLIModuleNotFoundError,\n expoFingerprintCommandAsync,\n isModernExpoFingerprintCLISupportedAsync,\n} from './expoFingerprintCli';\nimport { diffFingerprints } from './fingerprint';\n\nexport async function diffFingerprintsAsync(\n projectDir: string,\n fingerprint1File: string,\n fingerprint2File: string,\n { env, logger }: { env: BuildStepEnv; logger: bunyan }\n): Promise<string> {\n if (!(await isModernExpoFingerprintCLISupportedAsync(projectDir))) {\n logger.debug('Falling back to local fingerprint diff');\n return await diffFingerprintsFallbackAsync(fingerprint1File, fingerprint2File);\n }\n\n try {\n return await diffFingerprintsCommandAsync(projectDir, fingerprint1File, fingerprint2File, {\n env,\n });\n } catch (e) {\n if (\n e instanceof ExpoFingerprintCLIModuleNotFoundError ||\n e instanceof ExpoFingerprintCLICommandFailedError ||\n e instanceof ExpoFingerprintCLIInvalidCommandError\n ) {\n logger.debug('Falling back to local fingerprint diff');\n return await diffFingerprintsFallbackAsync(fingerprint1File, fingerprint2File);\n }\n throw e;\n }\n}\n\nasync function diffFingerprintsCommandAsync(\n projectDir: string,\n fingerprint1File: string,\n fingerprint2File: string,\n { env }: { env: BuildStepEnv }\n): Promise<string> {\n return await expoFingerprintCommandAsync(\n projectDir,\n ['fingerprint:diff', fingerprint1File, fingerprint2File],\n {\n env,\n }\n );\n}\n\nasync function diffFingerprintsFallbackAsync(\n fingerprint1File: string,\n fingerprint2File: string\n): Promise<string> {\n const [fingeprint1, fingerprint2] = await Promise.all([\n fs.readJSON(fingerprint1File),\n fs.readJSON(fingerprint2File),\n ]);\n return JSON.stringify(diffFingerprints(fingeprint1, fingerprint2));\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { BuildStepEnv } from '@expo/steps';
2
+ export declare class ExpoFingerprintCLIModuleNotFoundError extends Error {
3
+ }
4
+ export declare class ExpoFingerprintCLIInvalidCommandError extends Error {
5
+ }
6
+ export declare class ExpoFingerprintCLICommandFailedError extends Error {
7
+ }
8
+ export declare function expoFingerprintCommandAsync(projectDir: string, args: string[], { env }: {
9
+ env: BuildStepEnv;
10
+ }): Promise<string>;
11
+ export declare function isModernExpoFingerprintCLISupportedAsync(projectDir: string): Promise<boolean>;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isModernExpoFingerprintCLISupportedAsync = exports.expoFingerprintCommandAsync = exports.ExpoFingerprintCLICommandFailedError = exports.ExpoFingerprintCLIInvalidCommandError = exports.ExpoFingerprintCLIModuleNotFoundError = void 0;
7
+ const resolve_from_1 = __importDefault(require("resolve-from"));
8
+ const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
9
+ const fs_extra_1 = __importDefault(require("fs-extra"));
10
+ const semver_1 = __importDefault(require("semver"));
11
+ class ExpoFingerprintCLIModuleNotFoundError extends Error {
12
+ }
13
+ exports.ExpoFingerprintCLIModuleNotFoundError = ExpoFingerprintCLIModuleNotFoundError;
14
+ class ExpoFingerprintCLIInvalidCommandError extends Error {
15
+ }
16
+ exports.ExpoFingerprintCLIInvalidCommandError = ExpoFingerprintCLIInvalidCommandError;
17
+ class ExpoFingerprintCLICommandFailedError extends Error {
18
+ }
19
+ exports.ExpoFingerprintCLICommandFailedError = ExpoFingerprintCLICommandFailedError;
20
+ function resolveExpoFingerprintCLI(projectRoot) {
21
+ var _a;
22
+ const expoPackageRoot = resolve_from_1.default.silent(projectRoot, 'expo/package.json');
23
+ try {
24
+ return ((_a = resolve_from_1.default.silent(expoPackageRoot !== null && expoPackageRoot !== void 0 ? expoPackageRoot : projectRoot, '@expo/fingerprint/bin/cli')) !== null && _a !== void 0 ? _a : (0, resolve_from_1.default)(expoPackageRoot !== null && expoPackageRoot !== void 0 ? expoPackageRoot : projectRoot, '@expo/fingerprint/bin/cli.js'));
25
+ }
26
+ catch (e) {
27
+ if (e.code === 'MODULE_NOT_FOUND') {
28
+ throw new ExpoFingerprintCLIModuleNotFoundError(`The \`@expo/fingerprint\` package was not found.`);
29
+ }
30
+ throw e;
31
+ }
32
+ }
33
+ async function expoFingerprintCommandAsync(projectDir, args, { env }) {
34
+ const expoFingerprintCli = resolveExpoFingerprintCLI(projectDir);
35
+ try {
36
+ const spawnResult = await (0, turtle_spawn_1.default)(expoFingerprintCli, args, {
37
+ stdio: 'pipe',
38
+ cwd: projectDir,
39
+ env,
40
+ });
41
+ return spawnResult.stdout;
42
+ }
43
+ catch (e) {
44
+ if (e.stderr && typeof e.stderr === 'string') {
45
+ if (e.stderr.includes('Invalid command')) {
46
+ throw new ExpoFingerprintCLIInvalidCommandError(`The command specified by ${args} was not valid in the \`@expo/fingerprint\` CLI.`);
47
+ }
48
+ else {
49
+ throw new ExpoFingerprintCLICommandFailedError(e.stderr);
50
+ }
51
+ }
52
+ throw e;
53
+ }
54
+ }
55
+ exports.expoFingerprintCommandAsync = expoFingerprintCommandAsync;
56
+ async function getExpoFingerprintPackageVersionIfInstalledAsync(projectDir) {
57
+ const expoPackageRoot = resolve_from_1.default.silent(projectDir, 'expo/package.json');
58
+ const maybePackageJson = resolve_from_1.default.silent(expoPackageRoot !== null && expoPackageRoot !== void 0 ? expoPackageRoot : projectDir, '@expo/fingerprint/package.json');
59
+ if (!maybePackageJson) {
60
+ return null;
61
+ }
62
+ const { version } = await fs_extra_1.default.readJson(maybePackageJson);
63
+ return version !== null && version !== void 0 ? version : null;
64
+ }
65
+ async function isModernExpoFingerprintCLISupportedAsync(projectDir) {
66
+ const expoFingerprintPackageVersion = await getExpoFingerprintPackageVersionIfInstalledAsync(projectDir);
67
+ if (!expoFingerprintPackageVersion) {
68
+ return false;
69
+ }
70
+ if (expoFingerprintPackageVersion.includes('canary')) {
71
+ return true;
72
+ }
73
+ return semver_1.default.gte(expoFingerprintPackageVersion, '0.11.2');
74
+ }
75
+ exports.isModernExpoFingerprintCLISupportedAsync = isModernExpoFingerprintCLISupportedAsync;
76
+ //# sourceMappingURL=expoFingerprintCli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expoFingerprintCli.js","sourceRoot":"","sources":["../../src/utils/expoFingerprintCli.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AACvC,sEAA4C;AAE5C,wDAA0B;AAC1B,oDAA4B;AAE5B,MAAa,qCAAsC,SAAQ,KAAK;CAAG;AAAnE,sFAAmE;AACnE,MAAa,qCAAsC,SAAQ,KAAK;CAAG;AAAnE,sFAAmE;AACnE,MAAa,oCAAqC,SAAQ,KAAK;CAAG;AAAlE,oFAAkE;AAElE,SAAS,yBAAyB,CAAC,WAAmB;;IACpD,MAAM,eAAe,GAAG,sBAAW,CAAC,MAAM,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAC7E,IAAI,CAAC;QACH,OAAO,CACL,MAAA,sBAAW,CAAC,MAAM,CAAC,eAAe,aAAf,eAAe,cAAf,e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U,EAAE,mBAAmB,CAAC,CAAC;IAC5E,MAAM,gBAAgB,GAAG,sBAAW,CAAC,MAAM,CACzC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,UAAU,EAC7B,gCAAgC,CACjC,CAAC;IACF,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IACxD,OAAO,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAI,CAAC;AACzB,CAAC;AAEM,KAAK,UAAU,wCAAwC,CAC5D,UAAkB;IAElB,MAAM,6BAA6B,GACjC,MAAM,gDAAgD,CAAC,UAAU,CAAC,CAAC;IACrE,IAAI,CAAC,6BAA6B,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,6BAA6B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,gBAAM,CAAC,GAAG,CAAC,6BAA6B,EAAE,QAAQ,CAAC,CAAC;AAC7D,CAAC;AAdD,4FAcC","sourcesContent":["import resolveFrom from 'resolve-from';\nimport spawnAsync from '@expo/turtle-spawn';\nimport { BuildStepEnv } from '@expo/steps';\nimport fs from 'fs-extra';\nimport semver from 'semver';\n\nexport class ExpoFingerprintCLIModuleNotFoundError extends Error {}\nexport class ExpoFingerprintCLIInvalidCommandError extends Error {}\nexport class ExpoFingerprintCLICommandFailedError extends Error {}\n\nfunction resolveExpoFingerprintCLI(projectRoot: string): string {\n const expoPackageRoot = resolveFrom.silent(projectRoot, 'expo/package.json');\n try {\n return (\n resolveFrom.silent(expoPackageRoot ?? projectRoot, '@expo/fingerprint/bin/cli') ??\n resolveFrom(expoPackageRoot ?? projectRoot, '@expo/fingerprint/bin/cli.js')\n );\n } catch (e: any) {\n if (e.code === 'MODULE_NOT_FOUND') {\n throw new ExpoFingerprintCLIModuleNotFoundError(\n `The \\`@expo/fingerprint\\` package was not found.`\n );\n }\n throw e;\n }\n}\n\nexport async function expoFingerprintCommandAsync(\n projectDir: string,\n args: string[],\n { env }: { env: BuildStepEnv }\n): Promise<string> {\n const expoFingerprintCli = resolveExpoFingerprintCLI(projectDir);\n try {\n const spawnResult = await spawnAsync(expoFingerprintCli, args, {\n stdio: 'pipe',\n cwd: projectDir,\n env,\n });\n return spawnResult.stdout;\n } catch (e: any) {\n if (e.stderr && typeof e.stderr === 'string') {\n if (e.stderr.includes('Invalid command')) {\n throw new ExpoFingerprintCLIInvalidCommandError(\n `The command specified by ${args} was not valid in the \\`@expo/fingerprint\\` CLI.`\n );\n } else {\n throw new ExpoFingerprintCLICommandFailedError(e.stderr);\n }\n }\n throw e;\n }\n}\n\nasync function getExpoFingerprintPackageVersionIfInstalledAsync(\n projectDir: string\n): Promise<string | null> {\n const expoPackageRoot = resolveFrom.silent(projectDir, 'expo/package.json');\n const maybePackageJson = resolveFrom.silent(\n expoPackageRoot ?? projectDir,\n '@expo/fingerprint/package.json'\n );\n if (!maybePackageJson) {\n return null;\n }\n const { version } = await fs.readJson(maybePackageJson);\n return version ?? null;\n}\n\nexport async function isModernExpoFingerprintCLISupportedAsync(\n projectDir: string\n): Promise<boolean> {\n const expoFingerprintPackageVersion =\n await getExpoFingerprintPackageVersionIfInstalledAsync(projectDir);\n if (!expoFingerprintPackageVersion) {\n return false;\n }\n\n if (expoFingerprintPackageVersion.includes('canary')) {\n return true;\n }\n\n return semver.gte(expoFingerprintPackageVersion, '0.11.2');\n}\n"]}
@@ -4,7 +4,6 @@ import { ExpoConfig } from '@expo/config';
4
4
  import { bunyan } from '@expo/logger';
5
5
  import { BuildStepEnv } from '@expo/steps';
6
6
  import { BuildContext } from '../context';
7
- import { FingerprintSource } from './fingerprint';
8
7
  export declare function setRuntimeVersionNativelyAsync(ctx: BuildContext<Job>, runtimeVersion: string): Promise<void>;
9
8
  /**
10
9
  * Used for when Expo Updates is pointed at an EAS server.
@@ -13,7 +12,7 @@ export declare function setChannelNativelyAsync(ctx: BuildContext<BuildJob>): Pr
13
12
  export declare function configureEASExpoUpdatesAsync(ctx: BuildContext<BuildJob>): Promise<void>;
14
13
  type ResolvedRuntime = {
15
14
  resolvedRuntimeVersion: string | null;
16
- resolvedFingerprintSources?: FingerprintSource[] | null;
15
+ resolvedFingerprintSources?: object[] | null;
17
16
  };
18
17
  export declare function configureExpoUpdatesIfInstalledAsync(ctx: BuildContext<BuildJob>, resolvedRuntime: ResolvedRuntime): Promise<void>;
19
18
  export declare function resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync({ cwd, appConfig, platform, workflow, logger, env, }: {
@@ -25,7 +24,7 @@ export declare function resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync({ c
25
24
  env: BuildStepEnv;
26
25
  }): Promise<{
27
26
  runtimeVersion: string | null;
28
- fingerprintSources: FingerprintSource[] | null;
27
+ fingerprintSources: object[] | null;
29
28
  } | null>;
30
29
  export declare function getChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
31
30
  export declare function getRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null>;
@@ -5,6 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported = exports.isEASUpdateConfigured = exports.getRuntimeVersionAsync = exports.getChannelAsync = exports.resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync = exports.configureExpoUpdatesIfInstalledAsync = exports.configureEASExpoUpdatesAsync = exports.setChannelNativelyAsync = exports.setRuntimeVersionNativelyAsync = void 0;
7
7
  const assert_1 = __importDefault(require("assert"));
8
+ const os_1 = __importDefault(require("os"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const uuid_1 = require("uuid");
8
11
  const eas_build_job_1 = require("@expo/eas-build-job");
9
12
  const semver_1 = __importDefault(require("semver"));
10
13
  const node_fetch_1 = __importDefault(require("node-fetch"));
@@ -13,6 +16,7 @@ const expoUpdates_1 = require("../android/expoUpdates");
13
16
  const expoUpdates_2 = require("../ios/expoUpdates");
14
17
  const getExpoUpdatesPackageVersionIfInstalledAsync_1 = __importDefault(require("./getExpoUpdatesPackageVersionIfInstalledAsync"));
15
18
  const resolveRuntimeVersionAsync_1 = require("./resolveRuntimeVersionAsync");
19
+ const diffFingerprintsAsync_1 = require("./diffFingerprintsAsync");
16
20
  const fingerprint_1 = require("./fingerprint");
17
21
  async function setRuntimeVersionNativelyAsync(ctx, runtimeVersion) {
18
22
  switch (ctx.job.platform) {
@@ -185,23 +189,28 @@ async function logDiffFingerprints({ resolvedRuntime, ctx, }) {
185
189
  if (((_a = ctx.metadata) === null || _a === void 0 ? void 0 : _a.fingerprintSource) && resolvedFingerprintSources && resolvedRuntimeVersion) {
186
190
  try {
187
191
  const fingerprintSource = ctx.metadata.fingerprintSource;
188
- let localFingerprint = null;
192
+ let localFingerprintFile = null;
189
193
  if (fingerprintSource.type === eas_build_job_1.FingerprintSourceType.URL) {
190
194
  const result = await (0, node_fetch_1.default)(fingerprintSource.url);
191
- localFingerprint = await result.json();
195
+ const localFingerprintJSON = await result.json();
196
+ localFingerprintFile = path_1.default.join(os_1.default.tmpdir(), `eas-build-${(0, uuid_1.v4)()}-local-fingerprint`);
197
+ await fs_extra_1.default.writeFile(localFingerprintFile, JSON.stringify(localFingerprintJSON));
192
198
  }
193
199
  else if (fingerprintSource.type === eas_build_job_1.FingerprintSourceType.PATH) {
194
- localFingerprint = await fs_extra_1.default.readJson(fingerprintSource.path);
200
+ localFingerprintFile = fingerprintSource.path;
195
201
  }
196
202
  else {
197
203
  ctx.logger.warn(`Invalid fingerprint source type: ${fingerprintSource.type}`);
198
204
  }
199
- if (localFingerprint) {
205
+ if (localFingerprintFile) {
200
206
  const easFingerprint = {
201
207
  hash: resolvedRuntimeVersion,
202
208
  sources: resolvedFingerprintSources,
203
209
  };
204
- const changes = (0, fingerprint_1.diffFingerprints)(localFingerprint, easFingerprint);
210
+ const easFingerprintFile = path_1.default.join(os_1.default.tmpdir(), `eas-build-${(0, uuid_1.v4)()}-eas-fingerprint`);
211
+ await fs_extra_1.default.writeFile(easFingerprintFile, JSON.stringify(easFingerprint));
212
+ const changesJSONString = await (0, diffFingerprintsAsync_1.diffFingerprintsAsync)(ctx.getReactNativeProjectDirectory(), localFingerprintFile, easFingerprintFile, { env: ctx.env, logger: ctx.logger });
213
+ const changes = JSON.parse(changesJSONString);
205
214
  if (changes.length) {
206
215
  ctx.logger.warn('Difference between local and EAS fingerprints:');
207
216
  ctx.logger.warn((0, fingerprint_1.stringifyFingerprintDiff)(changes));
@@ -1 +1 @@
1
- {"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/utils/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAA+F;AAC/F,oDAA4B;AAI5B,4DAA+B;AAC/B,wDAA0B;AAE1B,wDAKgC;AAChC,oDAK4B;AAG5B,kIAA0G;AAC1G,6EAA0E;AAC1E,+CAKuB;AAEhB,KAAK,UAAU,8BAA8B,CAClD,GAAsB,EACtB,cAAsB;IAEtB,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QACzB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACtB,MAAM,IAAA,mDAAqC,EAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAClB,MAAM,IAAA,+CAAiC,EAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YAC7D,OAAO;QACT,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAhBD,wEAgBC;AAED;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAAC,GAA2B;;IACvE,IAAA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EAAE,CAAC;gBACjE,gBAAgB,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAC/D,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,oCAAoC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC;YAChF,CAAC;YAED,IAAI,gBAAgB,EAAE,CAAC;gBACrB,MAAM,cAAc,GAAG;oBACrB,IAAI,EAAE,sBAAsB;oBAC5B,OAAO,EAAE,0BAA0B;iBACpC,CAAC;gBACF,MAAM,OAAO,GAAG,IAAA,8BAAgB,EAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;gBACnE,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;oBACnB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;oBAClE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAC,CAAC;gBACrD,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import assert from 'assert';\n\nimport { Platform, Job, BuildJob, Workflow, FingerprintSourceType } from '@expo/eas-build-job';\nimport semver from 'semver';\nimport { ExpoConfig } from '@expo/config';\nimport { bunyan } from '@expo/logger';\nimport { BuildStepEnv } from '@expo/steps';\nimport fetch from 'node-fetch';\nimport fs from 'fs-extra';\n\nimport {\n androidSetRuntimeVersionNativelyAsync,\n androidSetChannelNativelyAsync,\n androidGetNativelyDefinedRuntimeVersionAsync,\n androidGetNativelyDefinedChannelAsync,\n} from '../android/expoUpdates';\nimport {\n iosSetRuntimeVersionNativelyAsync,\n iosSetChannelNativelyAsync,\n iosGetNativelyDefinedRuntimeVersionAsync,\n iosGetNativelyDefinedChannelAsync,\n} from '../ios/expoUpdates';\nimport { BuildContext } from '../context';\n\nimport getExpoUpdatesPackageVersionIfInstalledAsync from './getExpoUpdatesPackageVersionIfInstalledAsync';\nimport { resolveRuntimeVersionAsync } from './resolveRuntimeVersionAsync';\nimport {\n Fingerprint,\n FingerprintSource,\n diffFingerprints,\n stringifyFingerprintDiff,\n} from './fingerprint';\n\nexport async function setRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n case Platform.IOS: {\n await iosSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for when Expo Updates is pointed at an EAS server.\n */\nexport async function setChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n const newUpdateRequestHeaders: Record<string, string> = {\n 'expo-channel-name': ctx.job.updates.channel,\n };\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(\n `Setting the update request headers in '${configFile}' to '${JSON.stringify(\n newUpdateRequestHeaders\n )}'`\n );\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function configureEASExpoUpdatesAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n await setChannelNativelyAsync(ctx);\n}\n\ntype ResolvedRuntime = {\n resolvedRuntimeVersion: string | null;\n resolvedFingerprintSources?: FingerprintSource[] | null;\n};\n\nexport async function configureExpoUpdatesIfInstalledAsync(\n ctx: BuildContext<BuildJob>,\n resolvedRuntime: ResolvedRuntime\n): Promise<void> {\n const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(\n ctx.getReactNativeProjectDirectory(),\n ctx.logger\n );\n if (expoUpdatesPackageVersion === null) {\n return;\n }\n\n const appConfigRuntimeVersion =\n ctx.job.version?.runtimeVersion ?? resolvedRuntime.resolvedRuntimeVersion;\n\n if (ctx.metadata?.runtimeVersion && ctx.metadata.runtimeVersion !== appConfigRuntimeVersion) {\n ctx.logger.warn(\n `\nRuntime version mismatch:\n- Runtime version calculated on local machine: ${ctx.metadata.runtimeVersion}\n- Runtime version calculated on EAS: ${appConfigRuntimeVersion}\n\nThis may be due to one or more factors:\n- Differing result of conditional app config (app.config.js) evaluation for runtime version resolution.\n- Differing fingerprint when using fingerprint runtime version policy. If applicable, see fingerprint diff below.\n\nThis would cause any updates published on the local machine to not be compatible with this build.\n`\n );\n await logDiffFingerprints({ resolvedRuntime, ctx });\n throw new Error(\n 'Runtime version calculated on local machine not equal to runtime version calculated during build.'\n );\n }\n\n if (isEASUpdateConfigured(ctx)) {\n if (ctx.job.updates?.channel !== undefined) {\n await configureEASExpoUpdatesAsync(ctx);\n } else {\n const channel = await getChannelAsync(ctx);\n const isDevelopmentClient = ctx.job.developmentClient ?? false;\n\n if (channel !== null) {\n const configFile =\n ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(`The channel name for EAS Update in ${configFile} is set to \"${channel}\"`);\n } else if (isDevelopmentClient) {\n // NO-OP: Development clients don't need to have a channel set\n } else {\n const easUpdateUrl = ctx.appConfig.updates?.url ?? null;\n const jobProfile = ctx.job.buildProfile ?? null;\n ctx.logger.warn(\n `This build has an invalid EAS Update configuration: update.url is set to \"${easUpdateUrl}\" in app config, but a channel is not specified${\n jobProfile ? '' : ` for the current build profile \"${jobProfile}\" in eas.json`\n }.`\n );\n ctx.logger.warn(`- No channel will be set and EAS Update will be disabled for the build.`);\n ctx.logger.warn(\n `- Run \\`eas update:configure\\` to set your channel in eas.json. For more details, see https://docs.expo.dev/eas-update/getting-started/#configure-your-project`\n );\n\n ctx.markBuildPhaseHasWarnings();\n }\n }\n }\n\n if (ctx.job.version?.runtimeVersion) {\n ctx.logger.info('Updating runtimeVersion in Expo.plist');\n await setRuntimeVersionNativelyAsync(ctx, ctx.job.version.runtimeVersion);\n }\n}\n\nexport async function resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync({\n cwd,\n appConfig,\n platform,\n workflow,\n logger,\n env,\n}: {\n cwd: string;\n appConfig: ExpoConfig;\n platform: Platform;\n workflow: Workflow;\n logger: bunyan;\n env: BuildStepEnv;\n}): Promise<{\n runtimeVersion: string | null;\n fingerprintSources: FingerprintSource[] | null;\n} | null> {\n const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(cwd, logger);\n if (expoUpdatesPackageVersion === null) {\n return null;\n }\n\n const resolvedRuntimeVersion = await resolveRuntimeVersionAsync({\n projectDir: cwd,\n exp: appConfig,\n platform,\n workflow,\n logger,\n expoUpdatesPackageVersion,\n env,\n });\n\n logger.info(`Resolved runtime version: ${resolvedRuntimeVersion?.runtimeVersion}`);\n return resolvedRuntimeVersion;\n}\n\nexport async function getChannelAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedChannelAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedChannelAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function getRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport function isEASUpdateConfigured(ctx: BuildContext<Job>): boolean {\n const rawUrl = ctx.appConfig.updates?.url;\n if (!rawUrl) {\n return false;\n }\n try {\n const url = new URL(rawUrl);\n return ['u.expo.dev', 'staging-u.expo.dev'].includes(url.hostname);\n } catch (err) {\n ctx.logger.error({ err }, `Cannot parse expo.updates.url = ${rawUrl} as URL`);\n ctx.logger.error(`Assuming EAS Update is not configured`);\n return false;\n }\n}\n\nexport function isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported(\n expoUpdatesPackageVersion: string\n): boolean {\n if (expoUpdatesPackageVersion.includes('canary')) {\n return true;\n }\n\n // Anything SDK 51 or greater uses the expo-updates CLI\n return semver.gte(expoUpdatesPackageVersion, '0.25.4');\n}\n\nasync function logDiffFingerprints({\n resolvedRuntime,\n ctx,\n}: {\n resolvedRuntime: ResolvedRuntime;\n ctx: BuildContext<BuildJob>;\n}): Promise<void> {\n const { resolvedRuntimeVersion, resolvedFingerprintSources } = resolvedRuntime;\n if (ctx.metadata?.fingerprintSource && resolvedFingerprintSources && resolvedRuntimeVersion) {\n try {\n const fingerprintSource = ctx.metadata.fingerprintSource;\n\n let localFingerprint: Fingerprint | null = null;\n\n if (fingerprintSource.type === FingerprintSourceType.URL) {\n const result = await fetch(fingerprintSource.url);\n localFingerprint = await result.json();\n } else if (fingerprintSource.type === FingerprintSourceType.PATH) {\n localFingerprint = await fs.readJson(fingerprintSource.path);\n } else {\n ctx.logger.warn(`Invalid fingerprint source type: ${fingerprintSource.type}`);\n }\n\n if (localFingerprint) {\n const easFingerprint = {\n hash: resolvedRuntimeVersion,\n sources: resolvedFingerprintSources,\n };\n const changes = diffFingerprints(localFingerprint, easFingerprint);\n if (changes.length) {\n ctx.logger.warn('Difference between local and EAS fingerprints:');\n ctx.logger.warn(stringifyFingerprintDiff(changes));\n }\n }\n } catch (error) {\n ctx.logger.warn('Failed to compare fingerprints', error);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/utils/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,4CAAoB;AACpB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AE,0BAA0B;iBACpC,CAAC;gBACF,MAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,MAAM,EAAE,EAAE,aAAa,IAAA,SAAM,GAAE,kBAAkB,CAAC,CAAC;gBAC3F,MAAM,kBAAE,CAAC,SAAS,CAAC,kBAAkB,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;gBAEvE,MAAM,iBAAiB,GAAG,MAAM,IAAA,6CAAqB,EACnD,GAAG,CAAC,8BAA8B,EAAE,EACpC,oBAAoB,EACpB,kBAAkB,EAClB,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CACrC,CAAC;gBACF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBAC9C,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;oBACnB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;oBAClE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAC,CAAC;gBACrD,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import assert from 'assert';\nimport os from 'os';\nimport path from 'path';\n\nimport { v4 as uuidv4 } from 'uuid';\nimport { Platform, Job, BuildJob, Workflow, FingerprintSourceType } from '@expo/eas-build-job';\nimport semver from 'semver';\nimport { ExpoConfig } from '@expo/config';\nimport { bunyan } from '@expo/logger';\nimport { BuildStepEnv } from '@expo/steps';\nimport fetch from 'node-fetch';\nimport fs from 'fs-extra';\n\nimport {\n androidSetRuntimeVersionNativelyAsync,\n androidSetChannelNativelyAsync,\n androidGetNativelyDefinedRuntimeVersionAsync,\n androidGetNativelyDefinedChannelAsync,\n} from '../android/expoUpdates';\nimport {\n iosSetRuntimeVersionNativelyAsync,\n iosSetChannelNativelyAsync,\n iosGetNativelyDefinedRuntimeVersionAsync,\n iosGetNativelyDefinedChannelAsync,\n} from '../ios/expoUpdates';\nimport { BuildContext } from '../context';\n\nimport getExpoUpdatesPackageVersionIfInstalledAsync from './getExpoUpdatesPackageVersionIfInstalledAsync';\nimport { resolveRuntimeVersionAsync } from './resolveRuntimeVersionAsync';\nimport { diffFingerprintsAsync } from './diffFingerprintsAsync';\nimport { stringifyFingerprintDiff } from './fingerprint';\n\nexport async function setRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n case Platform.IOS: {\n await iosSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for when Expo Updates is pointed at an EAS server.\n */\nexport async function setChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n const newUpdateRequestHeaders: Record<string, string> = {\n 'expo-channel-name': ctx.job.updates.channel,\n };\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(\n `Setting the update request headers in '${configFile}' to '${JSON.stringify(\n newUpdateRequestHeaders\n )}'`\n );\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function configureEASExpoUpdatesAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n await setChannelNativelyAsync(ctx);\n}\n\ntype ResolvedRuntime = {\n resolvedRuntimeVersion: string | null;\n resolvedFingerprintSources?: object[] | null;\n};\n\nexport async function configureExpoUpdatesIfInstalledAsync(\n ctx: BuildContext<BuildJob>,\n resolvedRuntime: ResolvedRuntime\n): Promise<void> {\n const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(\n ctx.getReactNativeProjectDirectory(),\n ctx.logger\n );\n if (expoUpdatesPackageVersion === null) {\n return;\n }\n\n const appConfigRuntimeVersion =\n ctx.job.version?.runtimeVersion ?? resolvedRuntime.resolvedRuntimeVersion;\n\n if (ctx.metadata?.runtimeVersion && ctx.metadata.runtimeVersion !== appConfigRuntimeVersion) {\n ctx.logger.warn(\n `\nRuntime version mismatch:\n- Runtime version calculated on local machine: ${ctx.metadata.runtimeVersion}\n- Runtime version calculated on EAS: ${appConfigRuntimeVersion}\n\nThis may be due to one or more factors:\n- Differing result of conditional app config (app.config.js) evaluation for runtime version resolution.\n- Differing fingerprint when using fingerprint runtime version policy. If applicable, see fingerprint diff below.\n\nThis would cause any updates published on the local machine to not be compatible with this build.\n`\n );\n await logDiffFingerprints({ resolvedRuntime, ctx });\n throw new Error(\n 'Runtime version calculated on local machine not equal to runtime version calculated during build.'\n );\n }\n\n if (isEASUpdateConfigured(ctx)) {\n if (ctx.job.updates?.channel !== undefined) {\n await configureEASExpoUpdatesAsync(ctx);\n } else {\n const channel = await getChannelAsync(ctx);\n const isDevelopmentClient = ctx.job.developmentClient ?? false;\n\n if (channel !== null) {\n const configFile =\n ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(`The channel name for EAS Update in ${configFile} is set to \"${channel}\"`);\n } else if (isDevelopmentClient) {\n // NO-OP: Development clients don't need to have a channel set\n } else {\n const easUpdateUrl = ctx.appConfig.updates?.url ?? null;\n const jobProfile = ctx.job.buildProfile ?? null;\n ctx.logger.warn(\n `This build has an invalid EAS Update configuration: update.url is set to \"${easUpdateUrl}\" in app config, but a channel is not specified${\n jobProfile ? '' : ` for the current build profile \"${jobProfile}\" in eas.json`\n }.`\n );\n ctx.logger.warn(`- No channel will be set and EAS Update will be disabled for the build.`);\n ctx.logger.warn(\n `- Run \\`eas update:configure\\` to set your channel in eas.json. For more details, see https://docs.expo.dev/eas-update/getting-started/#configure-your-project`\n );\n\n ctx.markBuildPhaseHasWarnings();\n }\n }\n }\n\n if (ctx.job.version?.runtimeVersion) {\n ctx.logger.info('Updating runtimeVersion in Expo.plist');\n await setRuntimeVersionNativelyAsync(ctx, ctx.job.version.runtimeVersion);\n }\n}\n\nexport async function resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync({\n cwd,\n appConfig,\n platform,\n workflow,\n logger,\n env,\n}: {\n cwd: string;\n appConfig: ExpoConfig;\n platform: Platform;\n workflow: Workflow;\n logger: bunyan;\n env: BuildStepEnv;\n}): Promise<{\n runtimeVersion: string | null;\n fingerprintSources: object[] | null;\n} | null> {\n const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(cwd, logger);\n if (expoUpdatesPackageVersion === null) {\n return null;\n }\n\n const resolvedRuntimeVersion = await resolveRuntimeVersionAsync({\n projectDir: cwd,\n exp: appConfig,\n platform,\n workflow,\n logger,\n expoUpdatesPackageVersion,\n env,\n });\n\n logger.info(`Resolved runtime version: ${resolvedRuntimeVersion?.runtimeVersion}`);\n return resolvedRuntimeVersion;\n}\n\nexport async function getChannelAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedChannelAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedChannelAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function getRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport function isEASUpdateConfigured(ctx: BuildContext<Job>): boolean {\n const rawUrl = ctx.appConfig.updates?.url;\n if (!rawUrl) {\n return false;\n }\n try {\n const url = new URL(rawUrl);\n return ['u.expo.dev', 'staging-u.expo.dev'].includes(url.hostname);\n } catch (err) {\n ctx.logger.error({ err }, `Cannot parse expo.updates.url = ${rawUrl} as URL`);\n ctx.logger.error(`Assuming EAS Update is not configured`);\n return false;\n }\n}\n\nexport function isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported(\n expoUpdatesPackageVersion: string\n): boolean {\n if (expoUpdatesPackageVersion.includes('canary')) {\n return true;\n }\n\n // Anything SDK 51 or greater uses the expo-updates CLI\n return semver.gte(expoUpdatesPackageVersion, '0.25.4');\n}\n\nasync function logDiffFingerprints({\n resolvedRuntime,\n ctx,\n}: {\n resolvedRuntime: ResolvedRuntime;\n ctx: BuildContext<BuildJob>;\n}): Promise<void> {\n const { resolvedRuntimeVersion, resolvedFingerprintSources } = resolvedRuntime;\n if (ctx.metadata?.fingerprintSource && resolvedFingerprintSources && resolvedRuntimeVersion) {\n try {\n const fingerprintSource = ctx.metadata.fingerprintSource;\n\n let localFingerprintFile: string | null = null;\n\n if (fingerprintSource.type === FingerprintSourceType.URL) {\n const result = await fetch(fingerprintSource.url);\n const localFingerprintJSON = await result.json();\n localFingerprintFile = path.join(os.tmpdir(), `eas-build-${uuidv4()}-local-fingerprint`);\n await fs.writeFile(localFingerprintFile, JSON.stringify(localFingerprintJSON));\n } else if (fingerprintSource.type === FingerprintSourceType.PATH) {\n localFingerprintFile = fingerprintSource.path;\n } else {\n ctx.logger.warn(`Invalid fingerprint source type: ${fingerprintSource.type}`);\n }\n\n if (localFingerprintFile) {\n const easFingerprint = {\n hash: resolvedRuntimeVersion,\n sources: resolvedFingerprintSources,\n };\n const easFingerprintFile = path.join(os.tmpdir(), `eas-build-${uuidv4()}-eas-fingerprint`);\n await fs.writeFile(easFingerprintFile, JSON.stringify(easFingerprint));\n\n const changesJSONString = await diffFingerprintsAsync(\n ctx.getReactNativeProjectDirectory(),\n localFingerprintFile,\n easFingerprintFile,\n { env: ctx.env, logger: ctx.logger }\n );\n const changes = JSON.parse(changesJSONString);\n if (changes.length) {\n ctx.logger.warn('Difference between local and EAS fingerprints:');\n ctx.logger.warn(stringifyFingerprintDiff(changes));\n }\n }\n } catch (error) {\n ctx.logger.warn('Failed to compare fingerprints', error);\n }\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { OperationOptions } from 'retry';
2
+ export declare function promiseRetryWithCondition<TFn extends (...args: any[]) => Promise<any>>(fn: TFn, retryConditionFn: (error: any) => boolean, options?: OperationOptions): (...funcArgs: Parameters<TFn>) => Promise<ReturnType<TFn>>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.promiseRetryWithCondition = void 0;
7
+ const promise_retry_1 = __importDefault(require("promise-retry"));
8
+ function promiseRetryWithCondition(fn, retryConditionFn, options = { retries: 3, factor: 2 }) {
9
+ return (...funcArgs) => (0, promise_retry_1.default)(async (retry) => {
10
+ try {
11
+ return await fn(...funcArgs);
12
+ }
13
+ catch (e) {
14
+ if (retryConditionFn(e)) {
15
+ retry(e);
16
+ }
17
+ throw e;
18
+ }
19
+ }, options);
20
+ }
21
+ exports.promiseRetryWithCondition = promiseRetryWithCondition;
22
+ //# sourceMappingURL=promiseRetryWithCondition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promiseRetryWithCondition.js","sourceRoot":"","sources":["../../src/utils/promiseRetryWithCondition.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAyC;AAGzC,SAAgB,yBAAyB,CACvC,EAAO,EACP,gBAAyC,EACzC,UAA4B,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;IAErD,OAAO,CAAC,GAAG,QAAQ,EAAE,EAAE,CACrB,IAAA,uBAAY,EAAkB,KAAK,EAAE,KAAK,EAAE,EAAE;QAC5C,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxB,KAAK,CAAC,CAAC,CAAC,CAAC;YACX,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC,EAAE,OAAO,CAAC,CAAC;AAChB,CAAC;AAhBD,8DAgBC","sourcesContent":["import promiseRetry from 'promise-retry';\nimport { OperationOptions } from 'retry';\n\nexport function promiseRetryWithCondition<TFn extends (...args: any[]) => Promise<any>>(\n fn: TFn,\n retryConditionFn: (error: any) => boolean,\n options: OperationOptions = { retries: 3, factor: 2 }\n): (...funcArgs: Parameters<TFn>) => Promise<ReturnType<TFn>> {\n return (...funcArgs) =>\n promiseRetry<ReturnType<TFn>>(async (retry) => {\n try {\n return await fn(...funcArgs);\n } catch (e) {\n if (retryConditionFn(e)) {\n retry(e);\n }\n throw e;\n }\n }, options);\n}\n"]}
@@ -3,7 +3,6 @@ import { ExpoConfig } from '@expo/config';
3
3
  import { bunyan } from '@expo/logger';
4
4
  import { Workflow } from '@expo/eas-build-job';
5
5
  import { BuildStepEnv } from '@expo/steps';
6
- import { FingerprintSource } from './fingerprint';
7
6
  export declare function resolveRuntimeVersionAsync({ exp, platform, workflow, projectDir, logger, expoUpdatesPackageVersion, env, }: {
8
7
  exp: ExpoConfig;
9
8
  platform: 'ios' | 'android';
@@ -14,5 +13,5 @@ export declare function resolveRuntimeVersionAsync({ exp, platform, workflow, pr
14
13
  env: BuildStepEnv;
15
14
  }): Promise<{
16
15
  runtimeVersion: string | null;
17
- fingerprintSources: FingerprintSource[] | null;
16
+ fingerprintSources: object[] | null;
18
17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AoB,CAAC,kBAAkB,mCAAI,IAAI;SACpE,CAAC;IACJ,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,uFAAuF;QACvF,IAAI,CAAC,YAAY,kDAAiC,EAAE,CAAC;YACnD,MAAM,CAAC,KAAK,CACV,uFAAuF,CAAC,CAAC,OAAO,EAAE,CACnG,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AA7DD,gEA6DC","sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { Updates } from '@expo/config-plugins';\nimport { bunyan } from '@expo/logger';\nimport { Workflow } from '@expo/eas-build-job';\nimport { BuildStepEnv } from '@expo/steps';\n\nimport { ExpoUpdatesCLIModuleNotFoundError, expoUpdatesCommandAsync } from './expoUpdatesCli';\nimport { isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported } from './expoUpdates';\nimport { FingerprintSource } from './fingerprint';\n\nexport async function resolveRuntimeVersionAsync({\n exp,\n platform,\n workflow,\n projectDir,\n logger,\n expoUpdatesPackageVersion,\n env,\n}: {\n exp: ExpoConfig;\n platform: 'ios' | 'android';\n workflow: Workflow;\n projectDir: string;\n logger: bunyan;\n expoUpdatesPackageVersion: string;\n env: BuildStepEnv;\n}): Promise<{\n runtimeVersion: string | null;\n fingerprintSources: FingerprintSource[] | null;\n} | null> {\n if (!isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported(expoUpdatesPackageVersion)) {\n logger.debug('Using expo-updates config plugin for runtime version resolution');\n // fall back to the previous behavior (using the @expo/config-plugins eas-cli dependency rather\n // than the versioned @expo/config-plugins dependency in the project)\n return {\n runtimeVersion: await Updates.getRuntimeVersionNullableAsync(projectDir, exp, platform),\n fingerprintSources: null,\n };\n }\n\n try {\n logger.debug('Using expo-updates runtimeversion:resolve CLI for runtime version resolution');\n\n const extraArgs = logger.debug() ? ['--debug'] : [];\n\n const resolvedRuntimeVersionJSONResult = await expoUpdatesCommandAsync(\n projectDir,\n ['runtimeversion:resolve', '--platform', platform, '--workflow', workflow, ...extraArgs],\n {\n env,\n }\n );\n const runtimeVersionResult = JSON.parse(resolvedRuntimeVersionJSONResult);\n\n logger.debug('runtimeversion:resolve output:');\n logger.debug(resolvedRuntimeVersionJSONResult);\n\n return {\n runtimeVersion: runtimeVersionResult.runtimeVersion ?? null,\n fingerprintSources: runtimeVersionResult.fingerprintSources ?? null,\n };\n } catch (e: any) {\n // if expo-updates is not installed, there's no need for a runtime version in the build\n if (e instanceof ExpoUpdatesCLIModuleNotFoundError) {\n logger.error(\n `Error when resolving runtime version using expo-updates runtimeversion:resolve CLI: ${e.message}`\n );\n return null;\n }\n throw e;\n }\n}\n"]}
1
+ {"version":3,"file":"resolveRuntimeVersionAsync.js","sourceRoot":"","sources":["../../src/utils/resolveRuntimeVersionAsync.ts"],"names":[],"mappings":";;;AACA,yDAA+C;AAK/C,qDAA8F;AAC9F,+CAAyF;AAElF,KAAK,UAAU,0BAA0B,CAAC,EAC/C,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,MAAM,EACN,yBAAyB,EACzB,GAAG,GASJ;;IAIC,IAAI,CAAC,IAAA,sEAAwD,EAAC,yBAAyB,CAAC,EAAE,CAAC;QACzF,MAAM,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;QAChF,+FAA+F;QAC/F,qEAAqE;QACrE,OAAO;YACL,cAAc,EAAE,MAAM,wBAAO,CAAC,8BAA8B,CAAC,UAAU,EAAE,GAAG,EAAE,QAAQ,CAAC;YACvF,kBAAkB,EAAE,IAAI;SACzB,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;QAE7F,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEpD,MAAM,gCAAgC,GAAG,MAAM,IAAA,wCAAuB,EACpE,UAAU,EACV,CAAC,wBAAwB,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,EACxF;YACE,GAAG;SACJ,CACF,CAAC;QACF,MAAM,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAE1E,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAC/C,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAE/C,OAAO;YACL,cAAc,EAAE,MAAA,oBAAoB,CAAC,cAAc,mCAAI,IAAI;YAC3D,kBAAkB,EAAE,MAAA,oBAAoB,CAAC,kBAAkB,mCAAI,IAAI;SACpE,CAAC;IACJ,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,uFAAuF;QACvF,IAAI,CAAC,YAAY,kDAAiC,EAAE,CAAC;YACnD,MAAM,CAAC,KAAK,CACV,uFAAuF,CAAC,CAAC,OAAO,EAAE,CACnG,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AA7DD,gEA6DC","sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { Updates } from '@expo/config-plugins';\nimport { bunyan } from '@expo/logger';\nimport { Workflow } from '@expo/eas-build-job';\nimport { BuildStepEnv } from '@expo/steps';\n\nimport { ExpoUpdatesCLIModuleNotFoundError, expoUpdatesCommandAsync } from './expoUpdatesCli';\nimport { isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported } from './expoUpdates';\n\nexport async function resolveRuntimeVersionAsync({\n exp,\n platform,\n workflow,\n projectDir,\n logger,\n expoUpdatesPackageVersion,\n env,\n}: {\n exp: ExpoConfig;\n platform: 'ios' | 'android';\n workflow: Workflow;\n projectDir: string;\n logger: bunyan;\n expoUpdatesPackageVersion: string;\n env: BuildStepEnv;\n}): Promise<{\n runtimeVersion: string | null;\n fingerprintSources: object[] | null;\n} | null> {\n if (!isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported(expoUpdatesPackageVersion)) {\n logger.debug('Using expo-updates config plugin for runtime version resolution');\n // fall back to the previous behavior (using the @expo/config-plugins eas-cli dependency rather\n // than the versioned @expo/config-plugins dependency in the project)\n return {\n runtimeVersion: await Updates.getRuntimeVersionNullableAsync(projectDir, exp, platform),\n fingerprintSources: null,\n };\n }\n\n try {\n logger.debug('Using expo-updates runtimeversion:resolve CLI for runtime version resolution');\n\n const extraArgs = logger.debug() ? ['--debug'] : [];\n\n const resolvedRuntimeVersionJSONResult = await expoUpdatesCommandAsync(\n projectDir,\n ['runtimeversion:resolve', '--platform', platform, '--workflow', workflow, ...extraArgs],\n {\n env,\n }\n );\n const runtimeVersionResult = JSON.parse(resolvedRuntimeVersionJSONResult);\n\n logger.debug('runtimeversion:resolve output:');\n logger.debug(resolvedRuntimeVersionJSONResult);\n\n return {\n runtimeVersion: runtimeVersionResult.runtimeVersion ?? null,\n fingerprintSources: runtimeVersionResult.fingerprintSources ?? null,\n };\n } catch (e: any) {\n // if expo-updates is not installed, there's no need for a runtime version in the build\n if (e instanceof ExpoUpdatesCLIModuleNotFoundError) {\n logger.error(\n `Error when resolving runtime version using expo-updates runtimeversion:resolve CLI: ${e.message}`\n );\n return null;\n }\n throw e;\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { OperationOptions } from 'retry';
2
+ export declare function isDNSError(e: Error & {
3
+ code: any;
4
+ }): boolean;
5
+ export declare function retryOnDNSFailure<TFn extends (...args: any[]) => Promise<any>>(fn: TFn, options?: OperationOptions): (...funcArgs: Parameters<TFn>) => Promise<ReturnType<TFn>>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.retryOnDNSFailure = exports.isDNSError = void 0;
4
+ const promiseRetryWithCondition_1 = require("./promiseRetryWithCondition");
5
+ function isDNSError(e) {
6
+ return e.code === 'ENOTFOUND' || e.code === 'EAI_AGAIN';
7
+ }
8
+ exports.isDNSError = isDNSError;
9
+ function retryOnDNSFailure(fn, options) {
10
+ return (0, promiseRetryWithCondition_1.promiseRetryWithCondition)(fn, isDNSError, {
11
+ retries: 3,
12
+ factor: 2,
13
+ minTimeout: 100,
14
+ ...options,
15
+ });
16
+ }
17
+ exports.retryOnDNSFailure = retryOnDNSFailure;
18
+ //# sourceMappingURL=retryOnDNSFailure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retryOnDNSFailure.js","sourceRoot":"","sources":["../../src/utils/retryOnDNSFailure.ts"],"names":[],"mappings":";;;AAEA,2EAAwE;AAExE,SAAgB,UAAU,CAAC,CAAwB;IACjD,OAAO,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC;AAC1D,CAAC;AAFD,gCAEC;AAED,SAAgB,iBAAiB,CAC/B,EAAO,EACP,OAA0B;IAE1B,OAAO,IAAA,qDAAyB,EAAC,EAAE,EAAE,UAAU,EAAE;QAC/C,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,CAAC;QACT,UAAU,EAAE,GAAG;QACf,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAVD,8CAUC","sourcesContent":["import { OperationOptions } from 'retry';\n\nimport { promiseRetryWithCondition } from './promiseRetryWithCondition';\n\nexport function isDNSError(e: Error & { code: any }): boolean {\n return e.code === 'ENOTFOUND' || e.code === 'EAI_AGAIN';\n}\n\nexport function retryOnDNSFailure<TFn extends (...args: any[]) => Promise<any>>(\n fn: TFn,\n options?: OperationOptions\n): (...funcArgs: Parameters<TFn>) => Promise<ReturnType<TFn>> {\n return promiseRetryWithCondition(fn, isDNSError, {\n retries: 3,\n factor: 2,\n minTimeout: 100,\n ...options,\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/build-tools",
3
- "version": "1.0.147",
3
+ "version": "1.0.148",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -25,14 +25,14 @@
25
25
  "@expo/config": "9.0.3",
26
26
  "@expo/config-plugins": "8.0.8",
27
27
  "@expo/downloader": "1.0.118",
28
- "@expo/eas-build-job": "1.0.144",
28
+ "@expo/eas-build-job": "1.0.148",
29
29
  "@expo/env": "^0.3.0",
30
30
  "@expo/logger": "1.0.117",
31
31
  "@expo/package-manager": "1.5.2",
32
32
  "@expo/plist": "^0.1.3",
33
33
  "@expo/repack-app": "0.0.6",
34
34
  "@expo/results": "^1.0.0",
35
- "@expo/steps": "1.0.144",
35
+ "@expo/steps": "1.0.148",
36
36
  "@expo/template-file": "1.0.117",
37
37
  "@expo/turtle-spawn": "1.0.117",
38
38
  "@expo/xcpretty": "^4.3.1",
@@ -45,7 +45,9 @@
45
45
  "nullthrows": "^1.1.1",
46
46
  "plist": "^3.1.0",
47
47
  "promise-limit": "^2.7.0",
48
+ "promise-retry": "^2.0.1",
48
49
  "resolve-from": "^5.0.0",
50
+ "retry": "^0.13.1",
49
51
  "semver": "^7.6.2"
50
52
  },
51
53
  "devDependencies": {
@@ -56,6 +58,8 @@
56
58
  "@types/node-fetch": "^2.6.11",
57
59
  "@types/node-forge": "^1.3.11",
58
60
  "@types/plist": "^3.0.5",
61
+ "@types/promise-retry": "^1.1.6",
62
+ "@types/retry": "^0.12.5",
59
63
  "@types/semver": "^7.5.8",
60
64
  "@types/uuid": "^9.0.8",
61
65
  "jest": "^29.7.0",
@@ -70,5 +74,5 @@
70
74
  "node": "20.14.0",
71
75
  "yarn": "1.22.21"
72
76
  },
73
- "gitHead": "9b3bdfa79de2b7219944d782c2147ad6328a1bd3"
77
+ "gitHead": "bf607e6b982ca1ae8dff449eee998de7d4ad8bfd"
74
78
  }