@expo/build-tools 0.1.126 → 0.1.129

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.
@@ -105,6 +105,7 @@ async function readEntitlementsAsync(ctx, { scheme, buildConfiguration }) {
105
105
  }
106
106
  catch (err) {
107
107
  ctx.logger.warn({ err }, 'Failed to read entitlements');
108
+ ctx.markBuildPhaseHasWarnings();
108
109
  return null;
109
110
  }
110
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/builders/ios.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,wDAAgC;AAChC,yDAAiD;AACjD,uDAAgE;AAChE,wDAA0B;AAG1B,sDAA4E;AAC5E,8CAAyC;AACzC,4DAA6D;AAC7D,0CAAwD;AACxD,gDAAyD;AACzD,yEAA4D;AAC5D,8CAAiD;AACjD,oCAAyC;AACzC,gDAAkD;AAEnC,KAAK,UAAU,UAAU,CAAC,GAA0B;IACjE,MAAM,IAAA,eAAK,EAAC,GAAG,CAAC,CAAC;IACjB,MAAM,aAAa,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,wBAAQ,CAAC,OAAO,CAAC;IAExD,MAAM,kBAAkB,GAAG,IAAI,iBAAkB,CAAC,GAAG,CAAC,CAAC;IACvD,IAAI;QACF,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;YACrF,OAAO,MAAM,kBAAkB,CAAC,OAAO,EAAE,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,aAAa,EAAE;YAClB,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;gBACtD,MAAM,SAAS,GAA2B,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM;oBAC3D,CAAC,CAAC,EAAE,aAAa,EAAE,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AC7B;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE;QAC5B,OAAO,kDAAkD,CAAC;KAC3D;SAAM;QACL,OAAO,iBAAiB,CAAC;KAC1B;AACH,CAAC;AAED,SAAS,yBAAyB,CAAC,GAA0B;IAC3D,IAAI,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE;QAC9B,OAAO,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC;KACnC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,iBAAiB,EAAE;QACpC,OAAO,OAAO,CAAC;KAChB;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC","sourcesContent":["import assert from 'assert';\n\nimport plist from '@expo/plist';\nimport { IOSConfig } from '@expo/config-plugins';\nimport { BuildPhase, Ios, Workflow } from '@expo/eas-build-job';\nimport fs from 'fs-extra';\n\nimport { BuildContext } from '../context';\nimport { configureExpoUpdatesIfInstalledAsync } from '../utils/expoUpdates';\nimport { setup } from '../utils/project';\nimport { findBuildArtifacts } from '../utils/buildArtifacts';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { configureXcodeProject } from '../ios/configure';\nimport CredentialsManager from '../ios/credentials/manager';\nimport { runFastlaneGym } from '../ios/fastlane';\nimport { installPods } from '../ios/pod';\nimport { prebuildAsync } from '../utils/prebuild';\n\nexport default async function iosBuilder(ctx: BuildContext<Ios.Job>): Promise<string[]> {\n await setup(ctx);\n const hasNativeCode = ctx.job.type === Workflow.GENERIC;\n\n const credentialsManager = new CredentialsManager(ctx);\n try {\n const credentials = await ctx.runBuildPhase(BuildPhase.PREPARE_CREDENTIALS, async () => {\n return await credentialsManager.prepare();\n });\n\n if (!hasNativeCode) {\n await ctx.runBuildPhase(BuildPhase.PREBUILD, async () => {\n const extraEnvs: Record<string, string> = credentials?.teamId\n ? { APPLE_TEAM_ID: credentials.teamId }\n : {};\n await prebuildAsync(ctx, { extraEnvs });\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.RESTORE_CACHE, async () => {\n await ctx.cacheManager?.restoreCache(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_PODS, async () => {\n await installPods(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.POST_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.POST_INSTALL);\n });\n\n const buildConfiguration = resolveBuildConfiguration(ctx);\n if (credentials) {\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_XCODE_PROJECT, async () => {\n await configureXcodeProject(ctx, { credentials, buildConfiguration });\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_EXPO_UPDATES, async () => {\n await configureExpoUpdatesIfInstalledAsync(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.RUN_FASTLANE, async () => {\n const scheme = resolveScheme(ctx);\n const entitlements = await readEntitlementsAsync(ctx, { scheme, buildConfiguration });\n await runFastlaneGym(ctx, {\n credentials,\n scheme,\n buildConfiguration,\n entitlements,\n });\n });\n } finally {\n await ctx.runBuildPhase(BuildPhase.CLEAN_UP_CREDENTIALS, async () => {\n await credentialsManager.cleanUp();\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.PRE_UPLOAD_ARTIFACTS_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_UPLOAD_ARTIFACTS);\n });\n\n await ctx.runBuildPhase(BuildPhase.SAVE_CACHE, async () => {\n await ctx.cacheManager?.saveCache(ctx);\n });\n\n return await ctx.runBuildPhase(\n BuildPhase.UPLOAD_ARTIFACTS,\n async () => {\n const buildArtifacts = await findBuildArtifacts(\n ctx.reactNativeProjectDirectory,\n resolveArtifactPath(ctx),\n ctx.logger\n );\n ctx.logger.info(`Build artifacts: ${buildArtifacts.join(', ')}`);\n return buildArtifacts;\n },\n { doNotMarkEnd: true }\n );\n}\n\nfunction resolveScheme(ctx: BuildContext<Ios.Job>): string {\n if (ctx.job.scheme) {\n return ctx.job.scheme;\n }\n const schemes = IOSConfig.BuildScheme.getSchemesFromXcodeproj(ctx.reactNativeProjectDirectory);\n assert(schemes.length === 1, 'Ejected project should have exactly one scheme');\n return schemes[0];\n}\n\nasync function readEntitlementsAsync(\n ctx: BuildContext<Ios.Job>,\n { scheme, buildConfiguration }: { scheme: string; buildConfiguration: string }\n): Promise<object | null> {\n try {\n const applicationTargetName = await IOSConfig.BuildScheme.getApplicationTargetNameForSchemeAsync(\n ctx.reactNativeProjectDirectory,\n scheme\n );\n const entitlementsPath = IOSConfig.Entitlements.getEntitlementsPath(\n ctx.reactNativeProjectDirectory,\n {\n buildConfiguration,\n targetName: applicationTargetName,\n }\n );\n if (!entitlementsPath) {\n return null;\n }\n const entitlementsRaw = await fs.readFile(entitlementsPath, 'utf8');\n return plist.parse(entitlementsRaw);\n } catch (err) {\n ctx.logger.warn({ err }, 'Failed to read entitlements');\n return null;\n }\n}\n\nfunction resolveArtifactPath(ctx: BuildContext<Ios.Job>): string {\n if (ctx.job.artifactPath) {\n return ctx.job.artifactPath;\n } else if (ctx.job.simulator) {\n return 'ios/build/Build/Products/*-iphonesimulator/*.app';\n } else {\n return 'ios/build/*.ipa';\n }\n}\n\nfunction resolveBuildConfiguration(ctx: BuildContext<Ios.Job>): string {\n if (ctx.job.buildConfiguration) {\n return ctx.job.buildConfiguration;\n } else if (ctx.job.developmentClient) {\n return 'Debug';\n } else {\n return 'Release';\n }\n}\n"]}
1
+ {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/builders/ios.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,wDAAgC;AAChC,yDAAiD;AACjD,uDAAgE;AAChE,wDAA0B;AAG1B,sDAA4E;AAC5E,8CAAyC;AACzC,4DAA6D;AAC7D,0CAAwD;AACxD,gDAAyD;AACzD,yEAA4D;AAC5D,8CAAiD;AACjD,oCAAyC;AACzC,gDAAkD;AAEnC,KAAK,UAAU,UAAU,CAAC,GAA0B;IACjE,MAAM,IAAA,eAAK,EAAC,GAAG,CAAC,CAAC;IACjB,MAAM,aAAa,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YACE,kBAAkB;YAClB,UAAU,EAAE,qBAAqB;SAClC,CACF,CAAC;QACF,IAAI,CAAC,gBAAgB,EAAE;YACrB,OAAO,IAAI,CAAC;SACb;QACD,MAAM,eAAe,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QACpE,OAAO,eAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;KACrC;IAAC,OAAO,GAAG,EAAE;QACZ,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,6BAA6B,CAAC,CAAC;QACxD,GAAG,CAAC,yBAAyB,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,GAA0B;IACrD,IAAI,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE;QACxB,OAAO,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC;KAC7B;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE;QAC5B,OAAO,kDAAkD,CAAC;KAC3D;SAAM;QACL,OAAO,iBAAiB,CAAC;KAC1B;AACH,CAAC;AAED,SAAS,yBAAyB,CAAC,GAA0B;IAC3D,IAAI,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE;QAC9B,OAAO,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC;KACnC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,iBAAiB,EAAE;QACpC,OAAO,OAAO,CAAC;KAChB;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC","sourcesContent":["import assert from 'assert';\n\nimport plist from '@expo/plist';\nimport { IOSConfig } from '@expo/config-plugins';\nimport { BuildPhase, Ios, Workflow } from '@expo/eas-build-job';\nimport fs from 'fs-extra';\n\nimport { BuildContext } from '../context';\nimport { configureExpoUpdatesIfInstalledAsync } from '../utils/expoUpdates';\nimport { setup } from '../utils/project';\nimport { findBuildArtifacts } from '../utils/buildArtifacts';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { configureXcodeProject } from '../ios/configure';\nimport CredentialsManager from '../ios/credentials/manager';\nimport { runFastlaneGym } from '../ios/fastlane';\nimport { installPods } from '../ios/pod';\nimport { prebuildAsync } from '../utils/prebuild';\n\nexport default async function iosBuilder(ctx: BuildContext<Ios.Job>): Promise<string[]> {\n await setup(ctx);\n const hasNativeCode = ctx.job.type === Workflow.GENERIC;\n\n const credentialsManager = new CredentialsManager(ctx);\n try {\n const credentials = await ctx.runBuildPhase(BuildPhase.PREPARE_CREDENTIALS, async () => {\n return await credentialsManager.prepare();\n });\n\n if (!hasNativeCode) {\n await ctx.runBuildPhase(BuildPhase.PREBUILD, async () => {\n const extraEnvs: Record<string, string> = credentials?.teamId\n ? { APPLE_TEAM_ID: credentials.teamId }\n : {};\n await prebuildAsync(ctx, { extraEnvs });\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.RESTORE_CACHE, async () => {\n await ctx.cacheManager?.restoreCache(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_PODS, async () => {\n await installPods(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.POST_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.POST_INSTALL);\n });\n\n const buildConfiguration = resolveBuildConfiguration(ctx);\n if (credentials) {\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_XCODE_PROJECT, async () => {\n await configureXcodeProject(ctx, { credentials, buildConfiguration });\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_EXPO_UPDATES, async () => {\n await configureExpoUpdatesIfInstalledAsync(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.RUN_FASTLANE, async () => {\n const scheme = resolveScheme(ctx);\n const entitlements = await readEntitlementsAsync(ctx, { scheme, buildConfiguration });\n await runFastlaneGym(ctx, {\n credentials,\n scheme,\n buildConfiguration,\n entitlements,\n });\n });\n } finally {\n await ctx.runBuildPhase(BuildPhase.CLEAN_UP_CREDENTIALS, async () => {\n await credentialsManager.cleanUp();\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.PRE_UPLOAD_ARTIFACTS_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_UPLOAD_ARTIFACTS);\n });\n\n await ctx.runBuildPhase(BuildPhase.SAVE_CACHE, async () => {\n await ctx.cacheManager?.saveCache(ctx);\n });\n\n return await ctx.runBuildPhase(\n BuildPhase.UPLOAD_ARTIFACTS,\n async () => {\n const buildArtifacts = await findBuildArtifacts(\n ctx.reactNativeProjectDirectory,\n resolveArtifactPath(ctx),\n ctx.logger\n );\n ctx.logger.info(`Build artifacts: ${buildArtifacts.join(', ')}`);\n return buildArtifacts;\n },\n { doNotMarkEnd: true }\n );\n}\n\nfunction resolveScheme(ctx: BuildContext<Ios.Job>): string {\n if (ctx.job.scheme) {\n return ctx.job.scheme;\n }\n const schemes = IOSConfig.BuildScheme.getSchemesFromXcodeproj(ctx.reactNativeProjectDirectory);\n assert(schemes.length === 1, 'Ejected project should have exactly one scheme');\n return schemes[0];\n}\n\nasync function readEntitlementsAsync(\n ctx: BuildContext<Ios.Job>,\n { scheme, buildConfiguration }: { scheme: string; buildConfiguration: string }\n): Promise<object | null> {\n try {\n const applicationTargetName = await IOSConfig.BuildScheme.getApplicationTargetNameForSchemeAsync(\n ctx.reactNativeProjectDirectory,\n scheme\n );\n const entitlementsPath = IOSConfig.Entitlements.getEntitlementsPath(\n ctx.reactNativeProjectDirectory,\n {\n buildConfiguration,\n targetName: applicationTargetName,\n }\n );\n if (!entitlementsPath) {\n return null;\n }\n const entitlementsRaw = await fs.readFile(entitlementsPath, 'utf8');\n return plist.parse(entitlementsRaw);\n } catch (err) {\n ctx.logger.warn({ err }, 'Failed to read entitlements');\n ctx.markBuildPhaseHasWarnings();\n return null;\n }\n}\n\nfunction resolveArtifactPath(ctx: BuildContext<Ios.Job>): string {\n if (ctx.job.artifactPath) {\n return ctx.job.artifactPath;\n } else if (ctx.job.simulator) {\n return 'ios/build/Build/Products/*-iphonesimulator/*.app';\n } else {\n return 'ios/build/*.ipa';\n }\n}\n\nfunction resolveBuildConfiguration(ctx: BuildContext<Ios.Job>): string {\n if (ctx.job.buildConfiguration) {\n return ctx.job.buildConfiguration;\n } else if (ctx.job.developmentClient) {\n return 'Debug';\n } else {\n return 'Release';\n }\n}\n"]}
package/dist/context.d.ts CHANGED
@@ -44,9 +44,10 @@ export declare class BuildContext<TJob extends Job> {
44
44
  get reactNativeProjectDirectory(): string;
45
45
  get packageManager(): PackageManager;
46
46
  get appConfig(): ExpoConfig;
47
- runBuildPhase<T>(buildPhase: BuildPhase, phase: () => Promise<T>, { doNotMarkStart, doNotMarkEnd }?: {
48
- doNotMarkStart?: boolean | undefined;
49
- doNotMarkEnd?: boolean | undefined;
47
+ runBuildPhase<T>(buildPhase: BuildPhase, phase: () => Promise<T>, { doNotMarkStart, doNotMarkEnd, onError, }?: {
48
+ doNotMarkStart?: boolean;
49
+ doNotMarkEnd?: boolean;
50
+ onError?: (err: Error) => void;
50
51
  }): Promise<T>;
51
52
  markBuildPhaseHasWarnings(): void;
52
53
  private setBuildPhase;
package/dist/context.js CHANGED
@@ -43,7 +43,7 @@ class BuildContext {
43
43
  }
44
44
  return this._appConfig;
45
45
  }
46
- async runBuildPhase(buildPhase, phase, { doNotMarkStart = false, doNotMarkEnd = false } = {}) {
46
+ async runBuildPhase(buildPhase, phase, { doNotMarkStart = false, doNotMarkEnd = false, onError, } = {}) {
47
47
  try {
48
48
  this.setBuildPhase(buildPhase, { doNotMarkStart });
49
49
  const result = await phase();
@@ -75,6 +75,9 @@ class BuildContext {
75
75
  // leaving message empty, website will display err.stack which already includes err.message
76
76
  this.logger.error({ err }, '');
77
77
  }
78
+ if (onError) {
79
+ onError(userError !== null && userError !== void 0 ? userError : err);
80
+ }
78
81
  this.endCurrentBuildPhase({ result: eas_build_job_1.BuildPhaseResult.FAIL });
79
82
  throw userError !== null && userError !== void 0 ? userError : err;
80
83
  }
@@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,MAAM,EAAE,yBAAS,CAAC,WAAW,EAAE,EAAE,gBAAgB,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SACxF;IACH,CAAC;IAEO,oBAAoB,CAAC,EAC3B,MAAM,EACN,YAAY,GAAG,KAAK,GAIrB;QACC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,OAAO;SACR;QACD,IAAI,CAAC,YAAY,EAAE;YACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,yBAAS,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,cAAc,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SAC5F;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACrC,CAAC;CACF;AAlID,oCAkIC","sourcesContent":["import path from 'path';\n\nimport {\n BuildPhase,\n BuildPhaseResult,\n Job,\n LogMarker,\n Env,\n errors,\n Metadata,\n} from '@expo/eas-build-job';\nimport { ExpoConfig } from '@expo/config';\nimport { bunyan } from '@expo/logger';\nimport { SpawnPromise, SpawnOptions, SpawnResult } from '@expo/turtle-spawn';\n\nimport { PackageManager, resolvePackageManager } from './utils/packageManager';\nimport { detectUserError } from './utils/detectUserError';\nimport { readAppConfig } from './utils/appConfig';\n\nexport interface CacheManager {\n saveCache(ctx: BuildContext<Job>): Promise<void>;\n restoreCache(ctx: BuildContext<Job>): Promise<void>;\n}\n\nexport interface LogBuffer {\n getLogs(): string[];\n getPhaseLogs(buildPhase: string): string[];\n}\n\nexport interface BuildContextOptions {\n workingdir: string;\n logger: bunyan;\n logBuffer: LogBuffer;\n env: Env;\n cacheManager?: CacheManager;\n runExpoCliCommand: (args: string, options: SpawnOptions) => SpawnPromise<SpawnResult>;\n reportError?: (msg: string, err?: Error) => void;\n skipNativeBuild?: boolean;\n metadata?: Metadata;\n}\n\nexport class SkipNativeBuildError extends Error {}\n\nexport class BuildContext<TJob extends Job> {\n public readonly workingdir: string;\n public logger: bunyan;\n public readonly logBuffer: LogBuffer;\n public readonly env: Env;\n public readonly cacheManager?: CacheManager;\n public readonly runExpoCliCommand: (\n args: string,\n options: SpawnOptions\n ) => SpawnPromise<SpawnResult>;\n public readonly reportError?: (msg: string, err?: Error) => void;\n public readonly metadata?: Metadata;\n public readonly skipNativeBuild?: boolean;\n\n private readonly defaultLogger: bunyan;\n private buildPhase?: BuildPhase;\n private buildPhaseHasWarnings = false;\n private _appConfig?: ExpoConfig;\n\n constructor(public readonly job: TJob, options: BuildContextOptions) {\n this.workingdir = options.workingdir;\n this.defaultLogger = options.logger;\n this.logger = this.defaultLogger;\n this.logBuffer = options.logBuffer;\n this.cacheManager = options.cacheManager;\n this.runExpoCliCommand = options.runExpoCliCommand;\n this.reportError = options.reportError;\n this.metadata = options.metadata;\n this.skipNativeBuild = options.skipNativeBuild;\n this.env = {\n ...options.env,\n ...job?.builderEnvironment?.env,\n ...job?.secrets?.environmentSecrets,\n };\n }\n\n public get buildDirectory(): string {\n return path.join(this.workingdir, 'build');\n }\n public get reactNativeProjectDirectory(): string {\n return path.join(this.buildDirectory, this.job.projectRootDirectory);\n }\n public get packageManager(): PackageManager {\n return resolvePackageManager(this.reactNativeProjectDirectory);\n }\n public get appConfig(): ExpoConfig {\n if (!this._appConfig) {\n this._appConfig = readAppConfig(this.reactNativeProjectDirectory, this.env, this.logger).exp;\n }\n return this._appConfig;\n }\n\n public async runBuildPhase<T>(\n buildPhase: BuildPhase,\n phase: () => Promise<T>,\n { doNotMarkStart = false, doNotMarkEnd = false } = {}\n ): Promise<T> {\n try {\n this.setBuildPhase(buildPhase, { doNotMarkStart });\n const result = await phase();\n const buildPhaseResult: BuildPhaseResult = this.buildPhaseHasWarnings\n ? BuildPhaseResult.WARNING\n : BuildPhaseResult.SUCCESS;\n this.endCurrentBuildPhase({ result: buildPhaseResult, doNotMarkEnd });\n return result;\n } catch (err: any) {\n let userError: errors.UserError | undefined;\n if (err instanceof errors.UserError) {\n userError = err;\n } else {\n const detectedError = detectUserError(this.logBuffer.getPhaseLogs(buildPhase), {\n job: this.job,\n phase: buildPhase,\n });\n if (detectedError) {\n detectedError.innerError = err;\n userError = detectedError;\n }\n }\n if (userError) {\n this.logger.error(`Error: ${userError.message}`);\n } else {\n // leaving message empty, website will display err.stack which already includes err.message\n this.logger.error({ err }, '');\n }\n this.endCurrentBuildPhase({ result: BuildPhaseResult.FAIL });\n throw userError ?? err;\n }\n }\n\n public markBuildPhaseHasWarnings(): void {\n this.buildPhaseHasWarnings = true;\n }\n\n private setBuildPhase(buildPhase: BuildPhase, { doNotMarkStart = false } = {}): void {\n if (this.buildPhase) {\n if (this.buildPhase === buildPhase) {\n return;\n } else {\n this.logger.info(\n { marker: LogMarker.END_PHASE, result: BuildPhaseResult.UNKNOWN },\n `End phase: ${this.buildPhase}`\n );\n this.logger = this.defaultLogger;\n }\n }\n this.buildPhase = buildPhase;\n this.logger = this.defaultLogger.child({ phase: buildPhase });\n if (!doNotMarkStart) {\n this.logger.info({ marker: LogMarker.START_PHASE }, `Start phase: ${this.buildPhase}`);\n }\n }\n\n private endCurrentBuildPhase({\n result,\n doNotMarkEnd = false,\n }: {\n result: BuildPhaseResult;\n doNotMarkEnd?: boolean;\n }): void {\n if (!this.buildPhase) {\n return;\n }\n if (!doNotMarkEnd) {\n this.logger.info({ marker: LogMarker.END_PHASE, result }, `End phase: ${this.buildPhase}`);\n }\n this.logger = this.defaultLogger;\n this.buildPhase = undefined;\n this.buildPhaseHasWarnings = false;\n }\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAQ6B;AAK7B,2DAA+E;AAC/E,6DAA0D;AAC1D,iDAAkD;AAwBlD,MAAa,oBAAqB,SAAQ,KAAK;CAAG;AAAlD,oDAAkD;AAElD,MAAa,YA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,CAAC,EAC3B,MAAM,EACN,YAAY,GAAG,KAAK,GAIrB;QACC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,OAAO;SACR;QACD,IAAI,CAAC,YAAY,EAAE;YACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,yBAAS,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,cAAc,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SAC5F;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACrC,CAAC;CACF;AA7ID,oCA6IC","sourcesContent":["import path from 'path';\n\nimport {\n BuildPhase,\n BuildPhaseResult,\n Job,\n LogMarker,\n Env,\n errors,\n Metadata,\n} from '@expo/eas-build-job';\nimport { ExpoConfig } from '@expo/config';\nimport { bunyan } from '@expo/logger';\nimport { SpawnPromise, SpawnOptions, SpawnResult } from '@expo/turtle-spawn';\n\nimport { PackageManager, resolvePackageManager } from './utils/packageManager';\nimport { detectUserError } from './utils/detectUserError';\nimport { readAppConfig } from './utils/appConfig';\n\nexport interface CacheManager {\n saveCache(ctx: BuildContext<Job>): Promise<void>;\n restoreCache(ctx: BuildContext<Job>): Promise<void>;\n}\n\nexport interface LogBuffer {\n getLogs(): string[];\n getPhaseLogs(buildPhase: string): string[];\n}\n\nexport interface BuildContextOptions {\n workingdir: string;\n logger: bunyan;\n logBuffer: LogBuffer;\n env: Env;\n cacheManager?: CacheManager;\n runExpoCliCommand: (args: string, options: SpawnOptions) => SpawnPromise<SpawnResult>;\n reportError?: (msg: string, err?: Error) => void;\n skipNativeBuild?: boolean;\n metadata?: Metadata;\n}\n\nexport class SkipNativeBuildError extends Error {}\n\nexport class BuildContext<TJob extends Job> {\n public readonly workingdir: string;\n public logger: bunyan;\n public readonly logBuffer: LogBuffer;\n public readonly env: Env;\n public readonly cacheManager?: CacheManager;\n public readonly runExpoCliCommand: (\n args: string,\n options: SpawnOptions\n ) => SpawnPromise<SpawnResult>;\n public readonly reportError?: (msg: string, err?: Error) => void;\n public readonly metadata?: Metadata;\n public readonly skipNativeBuild?: boolean;\n\n private readonly defaultLogger: bunyan;\n private buildPhase?: BuildPhase;\n private buildPhaseHasWarnings = false;\n private _appConfig?: ExpoConfig;\n\n constructor(public readonly job: TJob, options: BuildContextOptions) {\n this.workingdir = options.workingdir;\n this.defaultLogger = options.logger;\n this.logger = this.defaultLogger;\n this.logBuffer = options.logBuffer;\n this.cacheManager = options.cacheManager;\n this.runExpoCliCommand = options.runExpoCliCommand;\n this.reportError = options.reportError;\n this.metadata = options.metadata;\n this.skipNativeBuild = options.skipNativeBuild;\n this.env = {\n ...options.env,\n ...job?.builderEnvironment?.env,\n ...job?.secrets?.environmentSecrets,\n };\n }\n\n public get buildDirectory(): string {\n return path.join(this.workingdir, 'build');\n }\n public get reactNativeProjectDirectory(): string {\n return path.join(this.buildDirectory, this.job.projectRootDirectory);\n }\n public get packageManager(): PackageManager {\n return resolvePackageManager(this.reactNativeProjectDirectory);\n }\n public get appConfig(): ExpoConfig {\n if (!this._appConfig) {\n this._appConfig = readAppConfig(this.reactNativeProjectDirectory, this.env, this.logger).exp;\n }\n return this._appConfig;\n }\n\n public async runBuildPhase<T>(\n buildPhase: BuildPhase,\n phase: () => Promise<T>,\n {\n doNotMarkStart = false,\n doNotMarkEnd = false,\n onError,\n }: {\n doNotMarkStart?: boolean;\n doNotMarkEnd?: boolean;\n onError?: (err: Error) => void;\n } = {}\n ): Promise<T> {\n try {\n this.setBuildPhase(buildPhase, { doNotMarkStart });\n const result = await phase();\n const buildPhaseResult: BuildPhaseResult = this.buildPhaseHasWarnings\n ? BuildPhaseResult.WARNING\n : BuildPhaseResult.SUCCESS;\n this.endCurrentBuildPhase({ result: buildPhaseResult, doNotMarkEnd });\n return result;\n } catch (err: any) {\n let userError: errors.UserError | undefined;\n if (err instanceof errors.UserError) {\n userError = err;\n } else {\n const detectedError = detectUserError(this.logBuffer.getPhaseLogs(buildPhase), {\n job: this.job,\n phase: buildPhase,\n });\n if (detectedError) {\n detectedError.innerError = err;\n userError = detectedError;\n }\n }\n if (userError) {\n this.logger.error(`Error: ${userError.message}`);\n } else {\n // leaving message empty, website will display err.stack which already includes err.message\n this.logger.error({ err }, '');\n }\n if (onError) {\n onError(userError ?? err);\n }\n this.endCurrentBuildPhase({ result: BuildPhaseResult.FAIL });\n throw userError ?? err;\n }\n }\n\n public markBuildPhaseHasWarnings(): void {\n this.buildPhaseHasWarnings = true;\n }\n\n private setBuildPhase(buildPhase: BuildPhase, { doNotMarkStart = false } = {}): void {\n if (this.buildPhase) {\n if (this.buildPhase === buildPhase) {\n return;\n } else {\n this.logger.info(\n { marker: LogMarker.END_PHASE, result: BuildPhaseResult.UNKNOWN },\n `End phase: ${this.buildPhase}`\n );\n this.logger = this.defaultLogger;\n }\n }\n this.buildPhase = buildPhase;\n this.logger = this.defaultLogger.child({ phase: buildPhase });\n if (!doNotMarkStart) {\n this.logger.info({ marker: LogMarker.START_PHASE }, `Start phase: ${this.buildPhase}`);\n }\n }\n\n private endCurrentBuildPhase({\n result,\n doNotMarkEnd = false,\n }: {\n result: BuildPhaseResult;\n doNotMarkEnd?: boolean;\n }): void {\n if (!this.buildPhase) {\n return;\n }\n if (!doNotMarkEnd) {\n this.logger.info({ marker: LogMarker.END_PHASE, result }, `End phase: ${this.buildPhase}`);\n }\n this.logger = this.defaultLogger;\n this.buildPhase = undefined;\n this.buildPhaseHasWarnings = false;\n }\n}\n"]}
@@ -5,9 +5,11 @@ export declare class XcodeBuildLogger {
5
5
  private loggerError?;
6
6
  private flushing;
7
7
  private logReaderPromise?;
8
+ private logsPath?;
8
9
  constructor(logger: bunyan, projectRoot: string);
9
10
  watchLogFiles(logsDirectory: string): Promise<void>;
10
11
  flush(): Promise<void>;
11
12
  private getBuildLogFilename;
12
13
  private startBuildLogger;
14
+ private findBundlerErrors;
13
15
  }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.XcodeBuildLogger = void 0;
7
7
  const assert_1 = __importDefault(require("assert"));
8
8
  const path_1 = __importDefault(require("path"));
9
+ const fs_extra_1 = __importDefault(require("fs-extra"));
9
10
  const xcpretty_1 = require("@expo/xcpretty");
10
11
  const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
11
12
  const fast_glob_1 = __importDefault(require("fast-glob"));
@@ -20,7 +21,8 @@ class XcodeBuildLogger {
20
21
  while (!this.flushing) {
21
22
  const logsFilename = await this.getBuildLogFilename(logsDirectory);
22
23
  if (logsFilename) {
23
- void this.startBuildLogger(path_1.default.join(logsDirectory, logsFilename));
24
+ this.logsPath = path_1.default.join(logsDirectory, logsFilename);
25
+ void this.startBuildLogger(this.logsPath);
24
26
  return;
25
27
  }
26
28
  await new Promise((res) => setTimeout(res, CHECK_FILE_INTERVAL_MS));
@@ -38,6 +40,9 @@ class XcodeBuildLogger {
38
40
  }
39
41
  catch (_a) { }
40
42
  }
43
+ if (this.logsPath) {
44
+ await this.findBundlerErrors(this.logsPath);
45
+ }
41
46
  }
42
47
  async getBuildLogFilename(logsDirectory) {
43
48
  const paths = await (0, fast_glob_1.default)('*.log', { cwd: logsDirectory });
@@ -66,6 +71,18 @@ class XcodeBuildLogger {
66
71
  }
67
72
  }
68
73
  }
74
+ async findBundlerErrors(logsPath) {
75
+ try {
76
+ const logFile = await fs_extra_1.default.readFile(logsPath, 'utf-8');
77
+ const match = logFile.match(/Welcome to Metro!\s* Fast - Scalable - Integrated\s*([\s\S]*)Run CLI with --verbose flag for more details.\nCommand PhaseScriptExecution failed with a nonzero exit code/);
78
+ if (match) {
79
+ this.logger.info(match[1]);
80
+ }
81
+ }
82
+ catch (err) {
83
+ this.logger.error({ err }, 'Failed to read Xcode logs');
84
+ }
85
+ }
69
86
  }
70
87
  exports.XcodeBuildLogger = XcodeBuildLogger;
71
88
  //# source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ACF;IACH,CAAC;CACF;AA1DD,4CA0DC","sourcesContent":["import assert from 'assert';\nimport path from 'path';\n\nimport { bunyan } from '@expo/logger';\nimport { ExpoRunFormatter } from '@expo/xcpretty';\nimport spawnAsync, { SpawnPromise, SpawnResult } from '@expo/spawn-async';\nimport fg from 'fast-glob';\n\nconst CHECK_FILE_INTERVAL_MS = 1000;\n\nexport class XcodeBuildLogger {\n private loggerError?: Error;\n private flushing: boolean = false;\n private logReaderPromise?: SpawnPromise<SpawnResult>;\n\n constructor(private readonly logger: bunyan, private readonly projectRoot: string) {}\n\n public async watchLogFiles(logsDirectory: string): Promise<void> {\n while (!this.flushing) {\n const logsFilename = await this.getBuildLogFilename(logsDirectory);\n if (logsFilename) {\n void this.startBuildLogger(path.join(logsDirectory, logsFilename));\n return;\n }\n await new Promise((res) => setTimeout(res, CHECK_FILE_INTERVAL_MS));\n }\n }\n\n public async flush(): Promise<void> {\n this.flushing = true;\n if (this.loggerError) {\n throw this.loggerError;\n }\n if (this.logReaderPromise) {\n this.logReaderPromise.child.kill('SIGINT');\n try {\n await this.logReaderPromise;\n } catch {}\n }\n }\n private async getBuildLogFilename(logsDirectory: string): Promise<string | undefined> {\n const paths = await fg('*.log', { cwd: logsDirectory });\n return paths.length >= 1 ? paths[0] : undefined;\n }\n\n private async startBuildLogger(logsPath: string): Promise<void> {\n try {\n const formatter = ExpoRunFormatter.create(this.projectRoot, {\n isDebug: false,\n // TODO: Can provide xcode project name for better parsing\n });\n this.logReaderPromise = spawnAsync('tail', ['-n', '+0', '-f', logsPath], { stdio: 'pipe' });\n assert(this.logReaderPromise.child.stdout, 'stdout is not available');\n this.logReaderPromise.child.stdout.on('data', (data: string) => {\n const lines = formatter.pipe(data.toString());\n for (const line of lines) {\n this.logger.info(line);\n }\n });\n await this.logReaderPromise;\n\n this.logger.info(formatter.getBuildSummary());\n } catch (err: any) {\n if (!this.flushing) {\n this.loggerError = err;\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"xcpretty.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AC;SAC/C;QAAC,OAAO,GAAQ,EAAE;YACjB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;aACxB;SACF;IACH,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAAC,QAAgB;QAC9C,IAAI;YACF,MAAM,OAAO,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACrD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CACzB,0KAA0K,CAC3K,CAAC;YACF,IAAI,KAAK,EAAE;gBACT,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5B;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,2BAA2B,CAAC,CAAC;SACzD;IACH,CAAC;CACF;AA7ED,4CA6EC","sourcesContent":["import assert from 'assert';\nimport path from 'path';\n\nimport fs from 'fs-extra';\nimport { bunyan } from '@expo/logger';\nimport { ExpoRunFormatter } from '@expo/xcpretty';\nimport spawnAsync, { SpawnPromise, SpawnResult } from '@expo/spawn-async';\nimport fg from 'fast-glob';\n\nconst CHECK_FILE_INTERVAL_MS = 1000;\n\nexport class XcodeBuildLogger {\n private loggerError?: Error;\n private flushing: boolean = false;\n private logReaderPromise?: SpawnPromise<SpawnResult>;\n private logsPath?: string;\n\n constructor(private readonly logger: bunyan, private readonly projectRoot: string) {}\n\n public async watchLogFiles(logsDirectory: string): Promise<void> {\n while (!this.flushing) {\n const logsFilename = await this.getBuildLogFilename(logsDirectory);\n if (logsFilename) {\n this.logsPath = path.join(logsDirectory, logsFilename);\n void this.startBuildLogger(this.logsPath);\n return;\n }\n await new Promise((res) => setTimeout(res, CHECK_FILE_INTERVAL_MS));\n }\n }\n\n public async flush(): Promise<void> {\n this.flushing = true;\n if (this.loggerError) {\n throw this.loggerError;\n }\n if (this.logReaderPromise) {\n this.logReaderPromise.child.kill('SIGINT');\n try {\n await this.logReaderPromise;\n } catch {}\n }\n if (this.logsPath) {\n await this.findBundlerErrors(this.logsPath);\n }\n }\n private async getBuildLogFilename(logsDirectory: string): Promise<string | undefined> {\n const paths = await fg('*.log', { cwd: logsDirectory });\n return paths.length >= 1 ? paths[0] : undefined;\n }\n\n private async startBuildLogger(logsPath: string): Promise<void> {\n try {\n const formatter = ExpoRunFormatter.create(this.projectRoot, {\n isDebug: false,\n // TODO: Can provide xcode project name for better parsing\n });\n this.logReaderPromise = spawnAsync('tail', ['-n', '+0', '-f', logsPath], { stdio: 'pipe' });\n assert(this.logReaderPromise.child.stdout, 'stdout is not available');\n this.logReaderPromise.child.stdout.on('data', (data: string) => {\n const lines = formatter.pipe(data.toString());\n for (const line of lines) {\n this.logger.info(line);\n }\n });\n await this.logReaderPromise;\n\n this.logger.info(formatter.getBuildSummary());\n } catch (err: any) {\n if (!this.flushing) {\n this.loggerError = err;\n }\n }\n }\n\n private async findBundlerErrors(logsPath: string): Promise<void> {\n try {\n const logFile = await fs.readFile(logsPath, 'utf-8');\n const match = logFile.match(\n /Welcome to Metro!\\s* Fast - Scalable - Integrated\\s*([\\s\\S]*)Run CLI with --verbose flag for more details.\\nCommand PhaseScriptExecution failed with a nonzero exit code/\n );\n if (match) {\n this.logger.info(match[1]);\n }\n } catch (err) {\n this.logger.error({ err }, 'Failed to read Xcode logs');\n }\n }\n}\n"]}
@@ -98,6 +98,35 @@ const errorHandlers = [
98
98
  return undefined;
99
99
  },
100
100
  },
101
+ {
102
+ phase: eas_build_job_1.BuildPhase.INSTALL_DEPENDENCIES,
103
+ // example log:
104
+ // yarn install v1.22.17
105
+ // [1/4] Resolving packages...
106
+ // [2/4] Fetching packages...
107
+ // [1/4] Resolving packages...
108
+ // [2/4] Fetching packages...
109
+ // [stderr] error https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, chmod '/Users/expo/Library/Caches/Yarn/v6/npm-jest-util-26.6.2-907535dbe4d5a6cb4c47ac9b926f6af29576cbc1-integrity/node_modules/jest-util/build/pluralize.d.ts'"
110
+ regexp: /\[1\/4\] Resolving packages...\s*\[2\/4\] Fetching packages...\s*\[1\/4\] Resolving packages...\s*\[2\/4\] Fetching packages.../,
111
+ createError: (matchResult) => {
112
+ if (matchResult) {
113
+ return new eas_build_job_1.errors.YarnMultipleInstancesError();
114
+ }
115
+ return undefined;
116
+ },
117
+ },
118
+ {
119
+ phase: eas_build_job_1.BuildPhase.INSTALL_DEPENDENCIES,
120
+ // example log:
121
+ // [stderr] WARN tarball tarball data for @typescript-eslint/typescript-estree@5.26.0 (sha512-cozo/GbwixVR0sgfHItz3t1yXu521yn71Wj6PlYCFA3WPhy51CUPkifFKfBis91bDclGmAY45hhaAXVjdn4new==) seems to be corrupted. Trying again.
122
+ regexp: /tarball tarball data for ([^ ]*) .* seems to be corrupted. Trying again/,
123
+ createError: (matchResult) => {
124
+ if (matchResult.length >= 2) {
125
+ return new eas_build_job_1.errors.NpmCorruptedPackageError(matchResult[1]);
126
+ }
127
+ return undefined;
128
+ },
129
+ },
101
130
  {
102
131
  platform: eas_build_job_1.Platform.ANDROID,
103
132
  phase: eas_build_job_1.BuildPhase.RUN_GRADLEW,
@@ -1 +1 @@
1
- {"version":3,"file":"detectUserError.js","sourceRoot":"","sources":["../../src/utils/detectUserError.ts"],"names":[],"mappings":";;;AAAA,uDAAkF;AAiBlF,MAAM,aAAa,GAAmB;IACpC;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KAAK,EAAE,0BAAU,CAAC,YAAY;QAC9B,MAAM,EAAE,4BAA4B;QACpC,eAAe;QACf,gHAAgH;QAChH,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,sBAAM,CAAC,2BAA2B,EAAE;KAC5D;IACD;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;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,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,sBAAM,CAAC,kBAAkB,EAAE;KACnD;IACD;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KAAK,EAAE,0BAAU,CAAC,YAAY;QAC9B,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,sBAAM,CAAC,oBAAoB,EAAE;KACrD;CACF,CAAC;AAEF,SAAgB,eAAe,CAC7B,QAAkB,EAClB,EAAE,GAAG,EAAE,KAAK,EAAgB;IAE5B,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;IACzB,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,aAAa;SAC3B,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;SACvE,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,KAAK,EAAE;YACT,OAAO,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;SACnD;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAhBD,0CAgBC","sourcesContent":["import { Job, errors, Platform, BuildPhase, Workflow } from '@expo/eas-build-job';\n\ninterface ErrorContext {\n phase: BuildPhase;\n job: Job;\n}\n\ninterface ErrorHandler {\n regexp: RegExp;\n platform?: Platform;\n phase?: BuildPhase;\n createError: (\n matchResult: RegExpMatchArray,\n errCtx: ErrorContext\n ) => errors.UserError | undefined;\n}\n\nconst errorHandlers: ErrorHandler[] = [\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n regexp: /requires CocoaPods version/,\n // example log:\n // [!] `React` requires CocoaPods version `>= 1.10.1`, which is not satisfied by your current version, `1.10.0`.\n createError: () => new errors.UnsupportedCocoaPodsVersion(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.RUN_FASTLANE,\n regexp: /Could not find 'bundler' (.*) required by your/,\n // example log:\n // /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:313:in `to_specs': Could not find 'bundler' (2.2.3) required by your /Users/expo/project/build/ios/Gemfile.lock. (Gem::MissingSpecVersionError)\n createError: () => new errors.UnsupportedBundlerVersion(),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n // example log:\n // > Failed to read key keyalias from store \"/build/workingdir/build/generic/keystore-5787e6af-3002-4cb7-8a57-3e73d13313c2.jks\": Invalid keystore format\n regexp: /Invalid keystore format/,\n createError: () => new errors.InvalidKeystoreFormatError(),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n // example log:\n // > Failed to read key keyalias from store \"/build/workingdir/build/generic/keystore-286069a8-4bb9-48a6-add9-acf6b58ea06d.jks\": null\n regexp: /Failed to read key[^\\n]+from store/,\n createError: () => new errors.InvalidKeystoreAliasError(),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.PREBUILD,\n // example log:\n // [15:42:05] Error: Cannot copy google-services.json from /build/workingdir/build/managed/abc to /build/workingdir/build/managed/android/app/google-services.json\n regexp: /Error: Cannot copy google-services\\.json/,\n createError: () => new errors.MissingGoogleServicesJson(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.PREBUILD,\n // example log:\n // [08:44:18] ENOENT: no such file or directory, copyfile '/Users/expo/workingdir/build/managed/abc' -> '/Users/expo/workingdir/build/managed/ios/testapp/GoogleService-Info.plist'\n regexp: /ENOENT: no such file or directory, copyfile .*GoogleService-Info.plist/,\n createError: () => new errors.MissingGoogleServicesPlist(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n // example log:\n // CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/2/a/e/MultiplatformBleAdapter/0.0.3/MultiplatformBleAdapter.podspec.json Response: 429 429: Too Many Requests\n regexp: /CDN: trunk URL couldn't be downloaded.* Response: 429 429: Too Many Requests/,\n createError: () => {\n // do not report it to user, just send to sentry\n const error = new errors.UnknownError();\n error.innerError = Error('cocoapods: Too Many Requests');\n return error;\n },\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n // example log:\n // [!] CocoaPods could not find compatible versions for pod \"Firebase/Core\":\n // In snapshot (Podfile.lock):\n // Firebase/Core (= 6.14.0)\n // In Podfile:\n // EXFirebaseCore (from `../node_modules/expo-firebase-core/ios`) was resolved to 3.0.0, which depends on\n // Firebase/Core (= 7.7.0)\n // You have either:\n // * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.\n // * changed the constraints of dependency `Firebase/Core` inside your development pod `EXFirebaseCore`.\n // You should run `pod update Firebase/Core` to apply changes you've made.\n regexp: /CocoaPods could not find compatible versions for pod /,\n createError: (_, { job }) => {\n const usingDefaultCacheConfig = job.cache.key === '' || !job.cache.key;\n return job.type === Workflow.MANAGED\n ? new errors.IncompatiblePodsManagedWorkflowError(usingDefaultCacheConfig)\n : new errors.IncompatiblePodsGenericWorkflowError(usingDefaultCacheConfig);\n },\n },\n {\n phase: BuildPhase.INSTALL_DEPENDENCIES,\n // example log:\n // [stderr] error https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz: Integrity check failed for \"react-native\" (computed integrity doesn't match our records, got \"sha512-3jHI2YufrJi7eIABRf/DN/I2yOkmIZ0vAyezTz+PAUJiEs4v//5LLojWEU+W53AZsnuaEMcl/4fVy4bd+OuUbA== sha1-o9QuQTXIkc8VozXPaZIullB9a40=\")\n regexp: /Integrity check failed for \"(.*)\" \\(computed integrity doesn't match our records, got/,\n createError: (matchResult: RegExpMatchArray) => {\n if (matchResult.length >= 2) {\n return new errors.YarnLockChecksumError(matchResult[1]);\n }\n return undefined;\n },\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n regexp: /.*/,\n createError: () => new errors.UnknownGradleError(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.RUN_FASTLANE,\n regexp: /.*/,\n createError: () => new errors.UnknownFastlaneError(),\n },\n];\n\nexport function detectUserError(\n logLines: string[],\n { job, phase }: ErrorContext\n): errors.UserError | undefined {\n const { platform } = job;\n const logs = logLines.join('\\n');\n const handlers = errorHandlers\n .filter((handler) => handler.platform === platform || !handler.platform)\n .filter((handler) => handler.phase === phase || !handler.phase);\n for (const handler of handlers) {\n const match = logs.match(handler.regexp);\n if (match) {\n return handler.createError(match, { job, phase });\n }\n }\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"detectUserError.js","sourceRoot":"","sources":["../../src/utils/detectUserError.ts"],"names":[],"mappings":";;;AAAA,uDAAkF;AAiBlF,MAAM,aAAa,GAAmB;IACpC;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KAAK,EAAE,0BAAU,CAAC,YAAY;QAC9B,MAAM,EAAE,4BAA4B;QACpC,eAAe;QACf,gHAAgH;QAChH,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,sBAAM,CAAC,2BAA2B,EAAE;KAC5D;IACD;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KAAK,EAAE,0BAAU,CAAC,YAAY;QAC9B,MAAM,EAAE,gDAAgD;QACxD,eAAe;QACf,mPAAmP;QACnP,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,sBAAM,CAAC,yBAAyB,EAAE;KAC1D;IACD;QACE,QAAQ,EAAE,wBAAQ,CAAC,OAAO;QAC1B,KAAK,EAAE,0BAAU,CA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C,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,KAAK,EAAE;YACT,OAAO,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;SACnD;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAhBD,0CAgBC","sourcesContent":["import { Job, errors, Platform, BuildPhase, Workflow } from '@expo/eas-build-job';\n\ninterface ErrorContext {\n phase: BuildPhase;\n job: Job;\n}\n\ninterface ErrorHandler {\n regexp: RegExp;\n platform?: Platform;\n phase?: BuildPhase;\n createError: (\n matchResult: RegExpMatchArray,\n errCtx: ErrorContext\n ) => errors.UserError | undefined;\n}\n\nconst errorHandlers: ErrorHandler[] = [\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n regexp: /requires CocoaPods version/,\n // example log:\n // [!] `React` requires CocoaPods version `>= 1.10.1`, which is not satisfied by your current version, `1.10.0`.\n createError: () => new errors.UnsupportedCocoaPodsVersion(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.RUN_FASTLANE,\n regexp: /Could not find 'bundler' (.*) required by your/,\n // example log:\n // /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:313:in `to_specs': Could not find 'bundler' (2.2.3) required by your /Users/expo/project/build/ios/Gemfile.lock. (Gem::MissingSpecVersionError)\n createError: () => new errors.UnsupportedBundlerVersion(),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n // example log:\n // > Failed to read key keyalias from store \"/build/workingdir/build/generic/keystore-5787e6af-3002-4cb7-8a57-3e73d13313c2.jks\": Invalid keystore format\n regexp: /Invalid keystore format/,\n createError: () => new errors.InvalidKeystoreFormatError(),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n // example log:\n // > Failed to read key keyalias from store \"/build/workingdir/build/generic/keystore-286069a8-4bb9-48a6-add9-acf6b58ea06d.jks\": null\n regexp: /Failed to read key[^\\n]+from store/,\n createError: () => new errors.InvalidKeystoreAliasError(),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.PREBUILD,\n // example log:\n // [15:42:05] Error: Cannot copy google-services.json from /build/workingdir/build/managed/abc to /build/workingdir/build/managed/android/app/google-services.json\n regexp: /Error: Cannot copy google-services\\.json/,\n createError: () => new errors.MissingGoogleServicesJson(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.PREBUILD,\n // example log:\n // [08:44:18] ENOENT: no such file or directory, copyfile '/Users/expo/workingdir/build/managed/abc' -> '/Users/expo/workingdir/build/managed/ios/testapp/GoogleService-Info.plist'\n regexp: /ENOENT: no such file or directory, copyfile .*GoogleService-Info.plist/,\n createError: () => new errors.MissingGoogleServicesPlist(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n // example log:\n // CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/2/a/e/MultiplatformBleAdapter/0.0.3/MultiplatformBleAdapter.podspec.json Response: 429 429: Too Many Requests\n regexp: /CDN: trunk URL couldn't be downloaded.* Response: 429 429: Too Many Requests/,\n createError: () => {\n // do not report it to user, just send to sentry\n const error = new errors.UnknownError();\n error.innerError = Error('cocoapods: Too Many Requests');\n return error;\n },\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n // example log:\n // [!] CocoaPods could not find compatible versions for pod \"Firebase/Core\":\n // In snapshot (Podfile.lock):\n // Firebase/Core (= 6.14.0)\n // In Podfile:\n // EXFirebaseCore (from `../node_modules/expo-firebase-core/ios`) was resolved to 3.0.0, which depends on\n // Firebase/Core (= 7.7.0)\n // You have either:\n // * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.\n // * changed the constraints of dependency `Firebase/Core` inside your development pod `EXFirebaseCore`.\n // You should run `pod update Firebase/Core` to apply changes you've made.\n regexp: /CocoaPods could not find compatible versions for pod /,\n createError: (_, { job }) => {\n const usingDefaultCacheConfig = job.cache.key === '' || !job.cache.key;\n return job.type === Workflow.MANAGED\n ? new errors.IncompatiblePodsManagedWorkflowError(usingDefaultCacheConfig)\n : new errors.IncompatiblePodsGenericWorkflowError(usingDefaultCacheConfig);\n },\n },\n {\n phase: BuildPhase.INSTALL_DEPENDENCIES,\n // example log:\n // [stderr] error https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz: Integrity check failed for \"react-native\" (computed integrity doesn't match our records, got \"sha512-3jHI2YufrJi7eIABRf/DN/I2yOkmIZ0vAyezTz+PAUJiEs4v//5LLojWEU+W53AZsnuaEMcl/4fVy4bd+OuUbA== sha1-o9QuQTXIkc8VozXPaZIullB9a40=\")\n regexp: /Integrity check failed for \"(.*)\" \\(computed integrity doesn't match our records, got/,\n createError: (matchResult: RegExpMatchArray) => {\n if (matchResult.length >= 2) {\n return new errors.YarnLockChecksumError(matchResult[1]);\n }\n return undefined;\n },\n },\n {\n phase: BuildPhase.INSTALL_DEPENDENCIES,\n // example log:\n // yarn install v1.22.17\n // [1/4] Resolving packages...\n // [2/4] Fetching packages...\n // [1/4] Resolving packages...\n // [2/4] Fetching packages...\n // [stderr] error https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: \"ENOENT: no such file or directory, chmod '/Users/expo/Library/Caches/Yarn/v6/npm-jest-util-26.6.2-907535dbe4d5a6cb4c47ac9b926f6af29576cbc1-integrity/node_modules/jest-util/build/pluralize.d.ts'\"\n regexp: /\\[1\\/4\\] Resolving packages...\\s*\\[2\\/4\\] Fetching packages...\\s*\\[1\\/4\\] Resolving packages...\\s*\\[2\\/4\\] Fetching packages.../,\n createError: (matchResult: RegExpMatchArray) => {\n if (matchResult) {\n return new errors.YarnMultipleInstancesError();\n }\n return undefined;\n },\n },\n {\n phase: BuildPhase.INSTALL_DEPENDENCIES,\n // example log:\n // [stderr] WARN tarball tarball data for @typescript-eslint/typescript-estree@5.26.0 (sha512-cozo/GbwixVR0sgfHItz3t1yXu521yn71Wj6PlYCFA3WPhy51CUPkifFKfBis91bDclGmAY45hhaAXVjdn4new==) seems to be corrupted. Trying again.\n regexp: /tarball tarball data for ([^ ]*) .* seems to be corrupted. Trying again/,\n createError: (matchResult: RegExpMatchArray) => {\n if (matchResult.length >= 2) {\n return new errors.NpmCorruptedPackageError(matchResult[1]);\n }\n return undefined;\n },\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n regexp: /.*/,\n createError: () => new errors.UnknownGradleError(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.RUN_FASTLANE,\n regexp: /.*/,\n createError: () => new errors.UnknownFastlaneError(),\n },\n];\n\nexport function detectUserError(\n logLines: string[],\n { job, phase }: ErrorContext\n): errors.UserError | undefined {\n const { platform } = job;\n const logs = logLines.join('\\n');\n const handlers = errorHandlers\n .filter((handler) => handler.platform === platform || !handler.platform)\n .filter((handler) => handler.phase === phase || !handler.phase);\n for (const handler of handlers) {\n const match = logs.match(handler.regexp);\n if (match) {\n return handler.createError(match, { job, phase });\n }\n }\n return undefined;\n}\n"]}
@@ -110,6 +110,7 @@ const configureExpoUpdatesIfInstalledAsync = async (ctx) => {
110
110
  }
111
111
  const appConfigRuntimeVersion = (0, Updates_1.getRuntimeVersionNullable)(ctx.appConfig, ctx.job.platform);
112
112
  if (((_a = ctx.metadata) === null || _a === void 0 ? void 0 : _a.runtimeVersion) && ((_b = ctx.metadata) === null || _b === void 0 ? void 0 : _b.runtimeVersion) !== appConfigRuntimeVersion) {
113
+ ctx.markBuildPhaseHasWarnings();
113
114
  ctx.logger.warn(`Runtime version from the app config evaluated on your local machine (${ctx.metadata.runtimeVersion}) does not match the one resolved here (${appConfigRuntimeVersion}).`);
114
115
  ctx.logger.warn("If you're using conditional app configs, e.g. depending on an environment variable, make sure to set the variable in eas.json or configure it with EAS Secret.");
115
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"expoUpdates.js","sourceRo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M;QACL,MAAM,IAAA,wCAAgC,EAAC,GAAG,CAAC,CAAC;KAC7C;AACH,CAAC,CAAC;AAtBW,QAAA,oCAAoC,wCAsB/C;AAEK,MAAM,sBAAsB,GAAG,KAAK,EAAE,GAAsB,EAA0B,EAAE;IAC7F,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE;QACxB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC;YACrB,OAAO,MAAM,IAAA,0DAA4C,EAAC,GAAG,CAAC,CAAC;SAChE;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC;YACjB,OAAO,MAAM,IAAA,sDAAwC,EAAC,GAAG,CAAC,CAAC;SAC5D;QACD;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KACjD;AACH,CAAC,CAAC;AAXW,QAAA,sBAAsB,0BAWjC","sourcesContent":["import assert from 'assert';\n\nimport { Platform, Job } from '@expo/eas-build-job';\nimport { getRuntimeVersionNullable } from '@expo/config-plugins/build/utils/Updates';\n\nimport {\n androidSetChannelNativelyAsync,\n androidSetClassicReleaseChannelNativelyAsync,\n androidGetNativelyDefinedClassicReleaseChannelAsync,\n androidGetNativelyDefinedRuntimeVersionAsync,\n} from '../android/expoUpdates';\nimport {\n iosSetChannelNativelyAsync,\n iosSetClassicReleaseChannelNativelyAsync,\n iosGetNativelyDefinedClassicReleaseChannelAsync,\n iosGetNativelyDefinedRuntimeVersionAsync,\n} from '../ios/expoUpdates';\nimport { BuildContext } from '../context';\n\nimport isExpoUpdatesInstalledAsync from './isExpoUpdatesInstalled';\n\n/**\n * Used for when Expo Updates is pointed at an EAS server.\n * @param ctx\n * @param platform\n */\nexport const setChannelNativelyAsync = async (ctx: BuildContext<Job>): 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 response 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\n/**\n * Used for classic Expo Updates\n * @param ctx\n * @param platform\n */\nexport const setClassicReleaseChannelNativelyAsync = async (\n ctx: BuildContext<Job>\n): Promise<void> => {\n assert(ctx.job.releaseChannel, 'releaseChannel must be defined');\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(`Setting the release channel in '${configFile}' to '${ctx.job.releaseChannel}'`);\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetClassicReleaseChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetClassicReleaseChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n};\n\n/**\n * Used for classic Expo Updates\n * @param ctx\n * @param platform\n */\nexport const getNativelyDefinedClassicReleaseChannelAsync = async (\n ctx: BuildContext<Job>\n): Promise<string | null> => {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return androidGetNativelyDefinedClassicReleaseChannelAsync(ctx);\n }\n case Platform.IOS: {\n return iosGetNativelyDefinedClassicReleaseChannelAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n};\n\nexport const configureClassicExpoUpdatesAsync = async (ctx: BuildContext<Job>): Promise<void> => {\n if (ctx.job.releaseChannel) {\n await setClassicReleaseChannelNativelyAsync(ctx);\n } else {\n /**\n * If releaseChannel is not defined:\n * 1. Try to infer it from the native value.\n * 2. If it is not set, fallback to 'default'.\n */\n const releaseChannel = await getNativelyDefinedClassicReleaseChannelAsync(ctx);\n if (releaseChannel) {\n ctx.logger.info(\n `Using the release channel pre-configured in native project (${releaseChannel})`\n );\n ctx.logger.warn('Please add the \"releaseChannel\" field to your build profile (eas.json)');\n } else {\n ctx.logger.info(`Using default release channel for 'expo-updates' (default)`);\n }\n }\n};\n\nexport const configureEASExpoUpdatesAsync = async (ctx: BuildContext<Job>): Promise<void> => {\n await setChannelNativelyAsync(ctx);\n};\n\nexport const configureExpoUpdatesIfInstalledAsync = async (\n ctx: BuildContext<Job>\n): Promise<void> => {\n if (!(await isExpoUpdatesInstalledAsync(ctx.reactNativeProjectDirectory))) {\n return;\n }\n\n const appConfigRuntimeVersion = getRuntimeVersionNullable(ctx.appConfig, ctx.job.platform);\n if (ctx.metadata?.runtimeVersion && ctx.metadata?.runtimeVersion !== appConfigRuntimeVersion) {\n ctx.logger.warn(\n `Runtime version from the app config evaluated on your local machine (${ctx.metadata.runtimeVersion}) does not match the one resolved here (${appConfigRuntimeVersion}).`\n );\n ctx.logger.warn(\n \"If you're using conditional app configs, e.g. depending on an environment variable, make sure to set the variable in eas.json or configure it with EAS Secret.\"\n );\n }\n\n if (ctx.job.updates?.channel) {\n await configureEASExpoUpdatesAsync(ctx);\n } else {\n await configureClassicExpoUpdatesAsync(ctx);\n }\n};\n\nexport const getRuntimeVersionAsync = async (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"]}
1
+ {"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/utils/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAAoD;AACpD,sEAAqF;AAErF,wDAKgC;AAChC,oDAK4B;AAG5B,sFAAmE;AAEnE;;;;GAIG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAAE,GAAsB,EAAiB,EAA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QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE;QACxB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC;YACrB,OAAO,MAAM,IAAA,0DAA4C,EAAC,GAAG,CAAC,CAAC;SAChE;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC;YACjB,OAAO,MAAM,IAAA,sDAAwC,EAAC,GAAG,CAAC,CAAC;SAC5D;QACD;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KACjD;AACH,CAAC,CAAC;AAXW,QAAA,sBAAsB,0BAWjC","sourcesContent":["import assert from 'assert';\n\nimport { Platform, Job } from '@expo/eas-build-job';\nimport { getRuntimeVersionNullable } from '@expo/config-plugins/build/utils/Updates';\n\nimport {\n androidSetChannelNativelyAsync,\n androidSetClassicReleaseChannelNativelyAsync,\n androidGetNativelyDefinedClassicReleaseChannelAsync,\n androidGetNativelyDefinedRuntimeVersionAsync,\n} from '../android/expoUpdates';\nimport {\n iosSetChannelNativelyAsync,\n iosSetClassicReleaseChannelNativelyAsync,\n iosGetNativelyDefinedClassicReleaseChannelAsync,\n iosGetNativelyDefinedRuntimeVersionAsync,\n} from '../ios/expoUpdates';\nimport { BuildContext } from '../context';\n\nimport isExpoUpdatesInstalledAsync from './isExpoUpdatesInstalled';\n\n/**\n * Used for when Expo Updates is pointed at an EAS server.\n * @param ctx\n * @param platform\n */\nexport const setChannelNativelyAsync = async (ctx: BuildContext<Job>): 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 response 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\n/**\n * Used for classic Expo Updates\n * @param ctx\n * @param platform\n */\nexport const setClassicReleaseChannelNativelyAsync = async (\n ctx: BuildContext<Job>\n): Promise<void> => {\n assert(ctx.job.releaseChannel, 'releaseChannel must be defined');\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(`Setting the release channel in '${configFile}' to '${ctx.job.releaseChannel}'`);\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetClassicReleaseChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetClassicReleaseChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n};\n\n/**\n * Used for classic Expo Updates\n * @param ctx\n * @param platform\n */\nexport const getNativelyDefinedClassicReleaseChannelAsync = async (\n ctx: BuildContext<Job>\n): Promise<string | null> => {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return androidGetNativelyDefinedClassicReleaseChannelAsync(ctx);\n }\n case Platform.IOS: {\n return iosGetNativelyDefinedClassicReleaseChannelAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n};\n\nexport const configureClassicExpoUpdatesAsync = async (ctx: BuildContext<Job>): Promise<void> => {\n if (ctx.job.releaseChannel) {\n await setClassicReleaseChannelNativelyAsync(ctx);\n } else {\n /**\n * If releaseChannel is not defined:\n * 1. Try to infer it from the native value.\n * 2. If it is not set, fallback to 'default'.\n */\n const releaseChannel = await getNativelyDefinedClassicReleaseChannelAsync(ctx);\n if (releaseChannel) {\n ctx.logger.info(\n `Using the release channel pre-configured in native project (${releaseChannel})`\n );\n ctx.logger.warn('Please add the \"releaseChannel\" field to your build profile (eas.json)');\n } else {\n ctx.logger.info(`Using default release channel for 'expo-updates' (default)`);\n }\n }\n};\n\nexport const configureEASExpoUpdatesAsync = async (ctx: BuildContext<Job>): Promise<void> => {\n await setChannelNativelyAsync(ctx);\n};\n\nexport const configureExpoUpdatesIfInstalledAsync = async (\n ctx: BuildContext<Job>\n): Promise<void> => {\n if (!(await isExpoUpdatesInstalledAsync(ctx.reactNativeProjectDirectory))) {\n return;\n }\n\n const appConfigRuntimeVersion = getRuntimeVersionNullable(ctx.appConfig, ctx.job.platform);\n if (ctx.metadata?.runtimeVersion && ctx.metadata?.runtimeVersion !== appConfigRuntimeVersion) {\n ctx.markBuildPhaseHasWarnings();\n ctx.logger.warn(\n `Runtime version from the app config evaluated on your local machine (${ctx.metadata.runtimeVersion}) does not match the one resolved here (${appConfigRuntimeVersion}).`\n );\n ctx.logger.warn(\n \"If you're using conditional app configs, e.g. depending on an environment variable, make sure to set the variable in eas.json or configure it with EAS Secret.\"\n );\n }\n\n if (ctx.job.updates?.channel) {\n await configureEASExpoUpdatesAsync(ctx);\n } else {\n await configureClassicExpoUpdatesAsync(ctx);\n }\n};\n\nexport const getRuntimeVersionAsync = async (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"]}
@@ -22,6 +22,7 @@ async function runHookIfPresent(ctx, hook) {
22
22
  }
23
23
  catch (err) {
24
24
  ctx.logger.warn(`Failed to parse or read package.json: ${err.message}`);
25
+ ctx.markBuildPhaseHasWarnings();
25
26
  return;
26
27
  }
27
28
  if ((_a = packageJson.scripts) === null || _a === void 0 ? void 0 : _a[hook]) {
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/utils/hooks.ts"],"names":[],"mappings":";;;;;;AACA,sEAAuC;AAIvC,qDAAmE;AACnE,uCAAyC;AAEzC,IAAY,IAIX;AAJD,WAAY,IAAI;IACd,6CAAqC,CAAA;IACrC,+CAAuC,CAAA;IACvC,+DAAuD,CAAA;AACzD,CAAC,EAJW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAIf;AAMM,KAAK,UAAU,gBAAgB,CACpC,GAAuB,EACvB,IAAU;;IAEV,MAAM,UAAU,GAAG,GAAG,CAAC,2BAA2B,CAAC;IACnD,IAAI,WAAwB,CAAC;IAC7B,IAAI;QACF,WAAW,GAAG,MAAM,IAAA,gCAAe,EAAC,UAAU,CAAC,CAAC;KACjD;IAAC,OAAO,GAAQ,EAAE;QACjB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,yCAAyC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACxE,OAAO;KACR;IACD,IAAI,MAAA,WAAW,CAAC,OAAO,0CAAG,IAAI,CAAC,EAAE;QAC/B,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,6CAA6C,CAAC,CAAC;QAC9E,wFAAwF;QACxF,yBAAyB;QACzB,MAAM,cAAc,GAClB,CAAC,MAAM,IAAA,sBAAY,EAAC,UAAU,CAAC,CAAC,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW;YAC3D,CAAC,CAAC,+BAAc,CAAC,GAAG;YACpB,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC;QACzB,MAAM,IAAA,sBAAK,EAAC,cAAc,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YACzC,GAAG,EAAE,UAAU;YACf,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,GAAG,EAAE,GAAG,CAAC,GAAG;SACb,CAAC,CAAC;KACJ;AACH,CAAC;AA1BD,4CA0BC","sourcesContent":["import { Job } from '@expo/eas-build-job';\nimport spawn from '@expo/turtle-spawn';\n\nimport { BuildContext } from '../context';\n\nimport { PackageManager, readPackageJson } from './packageManager';\nimport { isUsingYarn2 } from './project';\n\nexport enum Hook {\n PRE_INSTALL = 'eas-build-pre-install',\n POST_INSTALL = 'eas-build-post-install',\n PRE_UPLOAD_ARTIFACTS = 'eas-build-pre-upload-artifacts',\n}\n\ninterface PackageJson {\n scripts?: Record<string, string>;\n}\n\nexport async function runHookIfPresent<TJob extends Job>(\n ctx: BuildContext<TJob>,\n hook: Hook\n): Promise<void> {\n const projectDir = ctx.reactNativeProjectDirectory;\n let packageJson: PackageJson;\n try {\n packageJson = await readPackageJson(projectDir);\n } catch (err: any) {\n ctx.logger.warn(`Failed to parse or read package.json: ${err.message}`);\n return;\n }\n if (packageJson.scripts?.[hook]) {\n ctx.logger.info(`Script '${hook}' is present in package.json, running it...`);\n // when using yarn 2, it's not possible to run any scripts before running 'yarn install'\n // use 'npm' in that case\n const packageManager =\n (await isUsingYarn2(projectDir)) && hook === Hook.PRE_INSTALL\n ? PackageManager.NPM\n : ctx.packageManager;\n await spawn(packageManager, ['run', hook], {\n cwd: projectDir,\n logger: ctx.logger,\n env: ctx.env,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/utils/hooks.ts"],"names":[],"mappings":";;;;;;AACA,sEAAuC;AAIvC,qDAAmE;AACnE,uCAAyC;AAEzC,IAAY,IAIX;AAJD,WAAY,IAAI;IACd,6CAAqC,CAAA;IACrC,+CAAuC,CAAA;IACvC,+DAAuD,CAAA;AACzD,CAAC,EAJW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAIf;AAMM,KAAK,UAAU,gBAAgB,CACpC,GAAuB,EACvB,IAAU;;IAEV,MAAM,UAAU,GAAG,GAAG,CAAC,2BAA2B,CAAC;IACnD,IAAI,WAAwB,CAAC;IAC7B,IAAI;QACF,WAAW,GAAG,MAAM,IAAA,gCAAe,EAAC,UAAU,CAAC,CAAC;KACjD;IAAC,OAAO,GAAQ,EAAE;QACjB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,yCAAyC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACxE,GAAG,CAAC,yBAAyB,EAAE,CAAC;QAChC,OAAO;KACR;IACD,IAAI,MAAA,WAAW,CAAC,OAAO,0CAAG,IAAI,CAAC,EAAE;QAC/B,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,6CAA6C,CAAC,CAAC;QAC9E,wFAAwF;QACxF,yBAAyB;QACzB,MAAM,cAAc,GAClB,CAAC,MAAM,IAAA,sBAAY,EAAC,UAAU,CAAC,CAAC,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW;YAC3D,CAAC,CAAC,+BAAc,CAAC,GAAG;YACpB,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC;QACzB,MAAM,IAAA,sBAAK,EAAC,cAAc,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YACzC,GAAG,EAAE,UAAU;YACf,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,GAAG,EAAE,GAAG,CAAC,GAAG;SACb,CAAC,CAAC;KACJ;AACH,CAAC;AA3BD,4CA2BC","sourcesContent":["import { Job } from '@expo/eas-build-job';\nimport spawn from '@expo/turtle-spawn';\n\nimport { BuildContext } from '../context';\n\nimport { PackageManager, readPackageJson } from './packageManager';\nimport { isUsingYarn2 } from './project';\n\nexport enum Hook {\n PRE_INSTALL = 'eas-build-pre-install',\n POST_INSTALL = 'eas-build-post-install',\n PRE_UPLOAD_ARTIFACTS = 'eas-build-pre-upload-artifacts',\n}\n\ninterface PackageJson {\n scripts?: Record<string, string>;\n}\n\nexport async function runHookIfPresent<TJob extends Job>(\n ctx: BuildContext<TJob>,\n hook: Hook\n): Promise<void> {\n const projectDir = ctx.reactNativeProjectDirectory;\n let packageJson: PackageJson;\n try {\n packageJson = await readPackageJson(projectDir);\n } catch (err: any) {\n ctx.logger.warn(`Failed to parse or read package.json: ${err.message}`);\n ctx.markBuildPhaseHasWarnings();\n return;\n }\n if (packageJson.scripts?.[hook]) {\n ctx.logger.info(`Script '${hook}' is present in package.json, running it...`);\n // when using yarn 2, it's not possible to run any scripts before running 'yarn install'\n // use 'npm' in that case\n const packageManager =\n (await isUsingYarn2(projectDir)) && hook === Hook.PRE_INSTALL\n ? PackageManager.NPM\n : ctx.packageManager;\n await spawn(packageManager, ['run', hook], {\n cwd: projectDir,\n logger: ctx.logger,\n env: ctx.env,\n });\n }\n}\n"]}
@@ -26,6 +26,13 @@ async function setup(ctx) {
26
26
  });
27
27
  await ctx.runBuildPhase(eas_build_job_1.BuildPhase.INSTALL_DEPENDENCIES, async () => {
28
28
  await installDependencies(ctx);
29
+ }, {
30
+ onError: (err) => {
31
+ var _a;
32
+ if (err instanceof eas_build_job_1.errors.NpmCorruptedPackageError) {
33
+ (_a = ctx.reportError) === null || _a === void 0 ? void 0 : _a.call(ctx, 'Corrupted npm package', err);
34
+ }
35
+ },
29
36
  });
30
37
  const packageJson = await ctx.runBuildPhase(eas_build_job_1.BuildPhase.READ_PACKAGE_JSON, async () => {
31
38
  const packageJsonContents = await (0, packageManager_1.readPackageJson)(ctx.reactNativeProjectDirectory);
@@ -1 +1 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/utils/project.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,kEAA4C;AAC5C,uDAAyE;AACzE,sEAAwD;AACxD,wDAA0B;AAI1B,mCAAiD;AACjD,mCAAsD;AACtD,qDAAwF;AAExF,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC;AAEtC,KAAK,UAAU,KAAK,CAAmB,GAAuB;;IACnE,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,wBAAwB,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE;YACrB,MAAM,IAAA,mCAA2B,EAAC,GAAG,CAAC,CAAC;SACxC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;QAC9D,MAAM,IAAA,wBAA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0BAA0B,CAAC,CAAC;QAC/B,OAAO,MAAM,OAAO,CAAC;KACtB;YAAS;QACR,IAAI,OAAO,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB;KACF;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport downloadFile from '@expo/downloader';\nimport { ArchiveSourceType, BuildPhase, Job } from '@expo/eas-build-job';\nimport spawn, { SpawnResult } from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\n\nimport { BuildContext } from '../context';\n\nimport { Hook, runHookIfPresent } from './hooks';\nimport { createNpmrcIfNotExistsAsync } from './npmrc';\nimport { findPackagerRootDir, PackageManager, readPackageJson } from './packageManager';\n\nconst MAX_EXPO_DOCTOR_TIMEOUT_MS = 20 * 1000;\n\nexport async function setup<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await downloadAndUnpackProject(ctx);\n if (ctx.env.NPM_TOKEN) {\n await createNpmrcIfNotExistsAsync(ctx);\n }\n });\n\n await ctx.runBuildPhase(BuildPhase.PRE_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_INSTALL);\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_DEPENDENCIES, async () => {\n await installDependencies(ctx);\n });\n\n const packageJson = await ctx.runBuildPhase(BuildPhase.READ_PACKAGE_JSON, async () => {\n const packageJsonContents = await readPackageJson(ctx.reactNativeProjectDirectory);\n ctx.logger.info('Using package.json:');\n ctx.logger.info(JSON.stringify(packageJsonContents, null, 2));\n return packageJsonContents;\n });\n\n await ctx.runBuildPhase(BuildPhase.READ_APP_CONFIG, async () => {\n const appConfig = ctx.appConfig;\n ctx.logger.info('Using app configuration:');\n ctx.logger.info(JSON.stringify(appConfig, null, 2));\n });\n\n const hasExpoPackage = !!packageJson?.dependencies?.expo;\n if (hasExpoPackage) {\n await ctx.runBuildPhase(BuildPhase.RUN_EXPO_DOCTOR, async () => {\n try {\n const { stdout } = await runExpoDoctor(ctx);\n if (!stdout.match(/Didn't find any issues with the project/)) {\n ctx.markBuildPhaseHasWarnings();\n }\n } catch (err) {\n ctx.logger.error({ err }, 'Command \"expo doctor\" failed.');\n ctx.markBuildPhaseHasWarnings();\n }\n });\n }\n}\n\nasync function downloadAndUnpackProject<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n if (ctx.job.projectArchive.type === ArchiveSourceType.S3) {\n throw new Error('ArchiveSourceType.S3 should be resolved earlier to url');\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.PATH) {\n await fs.copy(ctx.job.projectArchive.path, projectTarball); // used in eas-build-cli\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.URL) {\n try {\n await downloadFile(ctx.job.projectArchive.url, projectTarball, { retry: 3 });\n } catch (err: any) {\n ctx?.reportError?.('Failed to download project archive', err);\n throw err;\n }\n }\n\n await spawn(\n 'tar',\n ['--strip-components', '1', '-zxf', 'project.tar.gz', '-C', ctx.buildDirectory],\n {\n cwd: ctx.workingdir,\n logger: ctx.logger,\n }\n );\n}\n\nexport async function installDependencies<TJob extends Job>(\n ctx: BuildContext<TJob>\n): Promise<void> {\n const packagerRunDir = findPackagerRootDir(ctx.reactNativeProjectDirectory);\n if (packagerRunDir !== ctx.reactNativeProjectDirectory) {\n const relativeReactNativeProjectDirectory = path.relative(\n ctx.buildDirectory,\n ctx.reactNativeProjectDirectory\n );\n ctx.logger.info(\n `We detected that '${relativeReactNativeProjectDirectory}' is a ${ctx.packageManager} workspace`\n );\n }\n\n const relativePackagerRunDir = path.relative(ctx.buildDirectory, packagerRunDir);\n let args = ['install'];\n if (ctx.packageManager === PackageManager.PNPM) {\n args = ['install', '--no-frozen-lockfile'];\n } else if (ctx.packageManager === PackageManager.YARN) {\n const isYarn2 = await isUsingYarn2(ctx.reactNativeProjectDirectory);\n if (isYarn2) {\n args = ['install', '--no-immutable'];\n }\n }\n ctx.logger.info(\n `Running \"${ctx.packageManager} ${args.join(' ')}\" in ${\n relativePackagerRunDir\n ? `directory '${relativePackagerRunDir}'`\n : 'the root dir of your repository'\n } `\n );\n await spawn(ctx.packageManager, args, {\n cwd: packagerRunDir,\n logger: ctx.logger,\n env: ctx.env,\n });\n}\n\n/**\n * check if .yarnrc.yml exists in the project dir or in the workspace root dir\n */\nexport async function isUsingYarn2(projectDir: string): Promise<boolean> {\n const yarnrcPath = path.join(projectDir, '.yarnrc.yml');\n const yarnrcRootPath = path.join(findPackagerRootDir(projectDir), '.yarnrc.yml');\n return (await fs.pathExists(yarnrcPath)) || (await fs.pathExists(yarnrcRootPath));\n}\n\nasync function runExpoDoctor<TJob extends Job>(ctx: BuildContext<TJob>): Promise<SpawnResult> {\n ctx.logger.info('Running \"expo doctor\"');\n let timeout: NodeJS.Timeout | undefined;\n try {\n const promise = ctx.runExpoCliCommand('doctor', {\n cwd: ctx.reactNativeProjectDirectory,\n logger: ctx.logger,\n env: ctx.env,\n });\n timeout = setTimeout(() => {\n promise.child.kill();\n ctx?.reportError?.(`\"expo doctor\" timed out`);\n }, MAX_EXPO_DOCTOR_TIMEOUT_MS);\n return await promise;\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/utils/project.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,kEAA4C;AAC5C,uDAAiF;AACjF,sEAAwD;AACxD,wDAA0B;AAI1B,mCAAiD;AACjD,mCAAsD;AACtD,qDAAwF;AAExF,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC;AAEtC,KAAK,UAAU,KAAK,CAAmB,GAAuB;;IACnE,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,wBAAwB,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,EAA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AAM,OAAO,GAAG,GAAG,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YAC9C,GAAG,EAAE,GAAG,CAAC,2BAA2B;YACpC,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,GAAG,EAAE,GAAG,CAAC,GAAG;SACb,CAAC,CAAC;QACH,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;;YACxB,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YACrB,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,WAAW,oDAAG,yBAAyB,CAAC,CAAC;QAChD,CAAC,EAAE,0BAA0B,CAAC,CAAC;QAC/B,OAAO,MAAM,OAAO,CAAC;KACtB;YAAS;QACR,IAAI,OAAO,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB;KACF;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport downloadFile from '@expo/downloader';\nimport { ArchiveSourceType, BuildPhase, errors, Job } from '@expo/eas-build-job';\nimport spawn, { SpawnResult } from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\n\nimport { BuildContext } from '../context';\n\nimport { Hook, runHookIfPresent } from './hooks';\nimport { createNpmrcIfNotExistsAsync } from './npmrc';\nimport { findPackagerRootDir, PackageManager, readPackageJson } from './packageManager';\n\nconst MAX_EXPO_DOCTOR_TIMEOUT_MS = 20 * 1000;\n\nexport async function setup<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await downloadAndUnpackProject(ctx);\n if (ctx.env.NPM_TOKEN) {\n await createNpmrcIfNotExistsAsync(ctx);\n }\n });\n\n await ctx.runBuildPhase(BuildPhase.PRE_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_INSTALL);\n });\n\n await ctx.runBuildPhase(\n BuildPhase.INSTALL_DEPENDENCIES,\n async () => {\n await installDependencies(ctx);\n },\n {\n onError: (err: Error) => {\n if (err instanceof errors.NpmCorruptedPackageError) {\n ctx.reportError?.('Corrupted npm package', err);\n }\n },\n }\n );\n\n const packageJson = await ctx.runBuildPhase(BuildPhase.READ_PACKAGE_JSON, async () => {\n const packageJsonContents = await readPackageJson(ctx.reactNativeProjectDirectory);\n ctx.logger.info('Using package.json:');\n ctx.logger.info(JSON.stringify(packageJsonContents, null, 2));\n return packageJsonContents;\n });\n\n await ctx.runBuildPhase(BuildPhase.READ_APP_CONFIG, async () => {\n const appConfig = ctx.appConfig;\n ctx.logger.info('Using app configuration:');\n ctx.logger.info(JSON.stringify(appConfig, null, 2));\n });\n\n const hasExpoPackage = !!packageJson?.dependencies?.expo;\n if (hasExpoPackage) {\n await ctx.runBuildPhase(BuildPhase.RUN_EXPO_DOCTOR, async () => {\n try {\n const { stdout } = await runExpoDoctor(ctx);\n if (!stdout.match(/Didn't find any issues with the project/)) {\n ctx.markBuildPhaseHasWarnings();\n }\n } catch (err) {\n ctx.logger.error({ err }, 'Command \"expo doctor\" failed.');\n ctx.markBuildPhaseHasWarnings();\n }\n });\n }\n}\n\nasync function downloadAndUnpackProject<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n if (ctx.job.projectArchive.type === ArchiveSourceType.S3) {\n throw new Error('ArchiveSourceType.S3 should be resolved earlier to url');\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.PATH) {\n await fs.copy(ctx.job.projectArchive.path, projectTarball); // used in eas-build-cli\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.URL) {\n try {\n await downloadFile(ctx.job.projectArchive.url, projectTarball, { retry: 3 });\n } catch (err: any) {\n ctx?.reportError?.('Failed to download project archive', err);\n throw err;\n }\n }\n\n await spawn(\n 'tar',\n ['--strip-components', '1', '-zxf', 'project.tar.gz', '-C', ctx.buildDirectory],\n {\n cwd: ctx.workingdir,\n logger: ctx.logger,\n }\n );\n}\n\nexport async function installDependencies<TJob extends Job>(\n ctx: BuildContext<TJob>\n): Promise<void> {\n const packagerRunDir = findPackagerRootDir(ctx.reactNativeProjectDirectory);\n if (packagerRunDir !== ctx.reactNativeProjectDirectory) {\n const relativeReactNativeProjectDirectory = path.relative(\n ctx.buildDirectory,\n ctx.reactNativeProjectDirectory\n );\n ctx.logger.info(\n `We detected that '${relativeReactNativeProjectDirectory}' is a ${ctx.packageManager} workspace`\n );\n }\n\n const relativePackagerRunDir = path.relative(ctx.buildDirectory, packagerRunDir);\n let args = ['install'];\n if (ctx.packageManager === PackageManager.PNPM) {\n args = ['install', '--no-frozen-lockfile'];\n } else if (ctx.packageManager === PackageManager.YARN) {\n const isYarn2 = await isUsingYarn2(ctx.reactNativeProjectDirectory);\n if (isYarn2) {\n args = ['install', '--no-immutable'];\n }\n }\n ctx.logger.info(\n `Running \"${ctx.packageManager} ${args.join(' ')}\" in ${\n relativePackagerRunDir\n ? `directory '${relativePackagerRunDir}'`\n : 'the root dir of your repository'\n } `\n );\n await spawn(ctx.packageManager, args, {\n cwd: packagerRunDir,\n logger: ctx.logger,\n env: ctx.env,\n });\n}\n\n/**\n * check if .yarnrc.yml exists in the project dir or in the workspace root dir\n */\nexport async function isUsingYarn2(projectDir: string): Promise<boolean> {\n const yarnrcPath = path.join(projectDir, '.yarnrc.yml');\n const yarnrcRootPath = path.join(findPackagerRootDir(projectDir), '.yarnrc.yml');\n return (await fs.pathExists(yarnrcPath)) || (await fs.pathExists(yarnrcRootPath));\n}\n\nasync function runExpoDoctor<TJob extends Job>(ctx: BuildContext<TJob>): Promise<SpawnResult> {\n ctx.logger.info('Running \"expo doctor\"');\n let timeout: NodeJS.Timeout | undefined;\n try {\n const promise = ctx.runExpoCliCommand('doctor', {\n cwd: ctx.reactNativeProjectDirectory,\n logger: ctx.logger,\n env: ctx.env,\n });\n timeout = setTimeout(() => {\n promise.child.kill();\n ctx?.reportError?.(`\"expo doctor\" timed out`);\n }, MAX_EXPO_DOCTOR_TIMEOUT_MS);\n return await promise;\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/build-tools",
3
- "version": "0.1.126",
3
+ "version": "0.1.129",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -22,13 +22,13 @@
22
22
  "@expo/config": "6.0.24",
23
23
  "@expo/config-plugins": "4.1.5",
24
24
  "@expo/downloader": "0.0.19",
25
- "@expo/eas-build-job": "0.2.74",
25
+ "@expo/eas-build-job": "0.2.77",
26
26
  "@expo/logger": "0.0.22",
27
27
  "@expo/package-manager": "0.0.54",
28
28
  "@expo/plist": "^0.0.11",
29
29
  "@expo/template-file": "0.1.21",
30
30
  "@expo/turtle-spawn": "0.0.23",
31
- "@expo/xcpretty": "^4.1.1",
31
+ "@expo/xcpretty": "4.1.3",
32
32
  "fast-glob": "^3.2.5",
33
33
  "fs-extra": "^10.0.1",
34
34
  "node-forge": "^1.2.1",