@expo/build-tools 1.0.64 → 1.0.65
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.
- package/dist/builders/custom.js +9 -0
- package/dist/builders/custom.js.map +1 -1
- package/dist/common/easBuildInternal.d.ts +16 -3
- package/dist/common/easBuildInternal.js +21 -19
- package/dist/common/easBuildInternal.js.map +1 -1
- package/dist/common/setup.js +11 -2
- package/dist/common/setup.js.map +1 -1
- package/dist/customBuildContext.d.ts +3 -2
- package/dist/customBuildContext.js +7 -0
- package/dist/customBuildContext.js.map +1 -1
- package/dist/steps/easFunctions.js +2 -0
- package/dist/steps/easFunctions.js.map +1 -1
- package/dist/steps/functions/getCredentialsForBuildTriggeredByGitHubIntegration.d.ts +3 -0
- package/dist/steps/functions/getCredentialsForBuildTriggeredByGitHubIntegration.js +31 -0
- package/dist/steps/functions/getCredentialsForBuildTriggeredByGitHubIntegration.js.map +1 -0
- package/package.json +2 -2
package/dist/builders/custom.js
CHANGED
|
@@ -11,10 +11,19 @@ const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
|
11
11
|
const projectSources_1 = require("../common/projectSources");
|
|
12
12
|
const easFunctions_1 = require("../steps/easFunctions");
|
|
13
13
|
const customBuildContext_1 = require("../customBuildContext");
|
|
14
|
+
const easBuildInternal_1 = require("../common/easBuildInternal");
|
|
14
15
|
async function runCustomBuildAsync(ctx) {
|
|
15
16
|
var _a;
|
|
16
17
|
const customBuildCtx = new customBuildContext_1.CustomBuildContext(ctx);
|
|
17
18
|
await (0, projectSources_1.prepareProjectSourcesAsync)(ctx, customBuildCtx.projectSourceDirectory);
|
|
19
|
+
if (ctx.job.triggeredBy === eas_build_job_1.BuildTrigger.GIT_BASED_INTEGRATION) {
|
|
20
|
+
// We need to setup envs from eas.json
|
|
21
|
+
const env = await (0, easBuildInternal_1.resolveEnvFromBuildProfileAsync)(ctx, {
|
|
22
|
+
cwd: customBuildCtx.projectSourceDirectory,
|
|
23
|
+
});
|
|
24
|
+
ctx.updateEnv(env);
|
|
25
|
+
customBuildCtx.updateEnv(ctx.env);
|
|
26
|
+
}
|
|
18
27
|
const relativeConfigPath = (0, nullthrows_1.default)((_a = ctx.job.customBuildConfig) === null || _a === void 0 ? void 0 : _a.path, 'Custom build config must be defined for custom builds');
|
|
19
28
|
const configPath = path_1.default.join(ctx.getReactNativeProjectDirectory(customBuildCtx.projectSourceDirectory), relativeConfigPath);
|
|
20
29
|
const globalContext = new steps_1.BuildStepGlobalContext(customBuildCtx, false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/builders/custom.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/builders/custom.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAAoE;AACpE,uCAAgF;AAChF,4DAAoC;AAGpC,6DAAsE;AACtE,wDAAwD;AACxD,8DAA2D;AAC3D,iEAA6E;AAEtE,KAAK,UAAU,mBAAmB,CAAgB,GAAoB;;IAC3E,MAAM,cAAc,GAAG,IAAI,uCAAkB,CAAC,GAAG,CAAC,CAAC;IACnD,MAAM,IAAA,2CAA0B,EAAC,GAAG,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC;IAC7E,IAAI,GAAG,CAAC,GAAG,CAAC,WAAW,KAAK,4BAAY,CAAC,qBAAqB,EAAE,CAAC;QAC/D,sCAAsC;QACtC,MAAM,GAAG,GAAG,MAAM,IAAA,kDAA+B,EAAC,GAAG,EAAE;YACrD,GAAG,EAAE,cAAc,CAAC,sBAAsB;SAC3C,CAAC,CAAC;QACH,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACnB,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,kBAAkB,GAAG,IAAA,oBAAU,EACnC,MAAA,GAAG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A/CD,kDA+CC","sourcesContent":["import path from 'path';\n\nimport { BuildPhase, BuildTrigger, Job } from '@expo/eas-build-job';\nimport { BuildConfigParser, BuildStepGlobalContext, errors } from '@expo/steps';\nimport nullthrows from 'nullthrows';\n\nimport { Artifacts, BuildContext } from '../context';\nimport { prepareProjectSourcesAsync } from '../common/projectSources';\nimport { getEasFunctions } from '../steps/easFunctions';\nimport { CustomBuildContext } from '../customBuildContext';\nimport { resolveEnvFromBuildProfileAsync } from '../common/easBuildInternal';\n\nexport async function runCustomBuildAsync<T extends Job>(ctx: BuildContext<T>): Promise<Artifacts> {\n const customBuildCtx = new CustomBuildContext(ctx);\n await prepareProjectSourcesAsync(ctx, customBuildCtx.projectSourceDirectory);\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n // We need to setup envs from eas.json\n const env = await resolveEnvFromBuildProfileAsync(ctx, {\n cwd: customBuildCtx.projectSourceDirectory,\n });\n ctx.updateEnv(env);\n customBuildCtx.updateEnv(ctx.env);\n }\n const relativeConfigPath = nullthrows(\n ctx.job.customBuildConfig?.path,\n 'Custom build config must be defined for custom builds'\n );\n const configPath = path.join(\n ctx.getReactNativeProjectDirectory(customBuildCtx.projectSourceDirectory),\n relativeConfigPath\n );\n\n const globalContext = new BuildStepGlobalContext(customBuildCtx, false);\n const easFunctions = getEasFunctions(customBuildCtx);\n const parser = new BuildConfigParser(globalContext, {\n externalFunctions: easFunctions,\n configPath,\n });\n const workflow = await ctx.runBuildPhase(BuildPhase.PARSE_CUSTOM_WORKFLOW_CONFIG, async () => {\n try {\n return await parser.parseAsync();\n } catch (parseError: any) {\n ctx.logger.error('Failed to parse the custom build config file.');\n if (parseError instanceof errors.BuildWorkflowError) {\n for (const err of parseError.errors) {\n ctx.logger.error({ err });\n }\n }\n throw parseError;\n }\n });\n try {\n await workflow.executeAsync();\n } catch (err: any) {\n err.artifacts = ctx.artifacts;\n throw err;\n }\n\n return ctx.artifacts;\n}\n"]}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="bunyan" />
|
|
2
|
+
import { Env, Job, Metadata } from '@expo/eas-build-job';
|
|
3
|
+
import { bunyan } from '@expo/logger';
|
|
4
|
+
import { BuildStepEnv } from '@expo/steps';
|
|
2
5
|
import { BuildContext } from '../context';
|
|
3
|
-
export declare function runEasBuildInternalAsync<TJob extends Job>(
|
|
4
|
-
|
|
6
|
+
export declare function runEasBuildInternalAsync<TJob extends Job>({ job, logger, env, cwd, }: {
|
|
7
|
+
job: TJob;
|
|
8
|
+
logger: bunyan;
|
|
9
|
+
env: BuildStepEnv;
|
|
10
|
+
cwd: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
newJob: TJob;
|
|
13
|
+
newMetadata: Metadata;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function resolveEnvFromBuildProfileAsync<TJob extends Job>(ctx: BuildContext<TJob>, { cwd }: {
|
|
16
|
+
cwd: string;
|
|
17
|
+
}): Promise<Env>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.resolveEnvFromBuildProfileAsync = exports.runEasBuildInternalAsync = void 0;
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
8
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
9
9
|
const logger_1 = require("@expo/logger");
|
|
@@ -17,28 +17,30 @@ const EasBuildInternalResultSchema = joi_1.default.object({
|
|
|
17
17
|
job: joi_1.default.object().unknown(),
|
|
18
18
|
metadata: joi_1.default.object().unknown(),
|
|
19
19
|
});
|
|
20
|
-
async function runEasBuildInternalAsync(
|
|
20
|
+
async function runEasBuildInternalAsync({ job, logger, env, cwd, }) {
|
|
21
21
|
const { cmd, args, extraEnv } = await resolveEasCommandPrefixAndEnvAsync();
|
|
22
|
-
const { buildProfile } =
|
|
22
|
+
const { buildProfile } = job;
|
|
23
23
|
(0, assert_1.default)(buildProfile, 'build profile is missing in a build from git-based integration.');
|
|
24
|
-
const result = await (0, turtle_spawn_1.default)(cmd, [...args, 'build:internal', '--platform',
|
|
25
|
-
cwd
|
|
24
|
+
const result = await (0, turtle_spawn_1.default)(cmd, [...args, 'build:internal', '--platform', job.platform, '--profile', buildProfile], {
|
|
25
|
+
cwd,
|
|
26
26
|
env: {
|
|
27
|
-
...
|
|
28
|
-
EXPO_TOKEN: (0, nullthrows_1.default)(
|
|
27
|
+
...env,
|
|
28
|
+
EXPO_TOKEN: (0, nullthrows_1.default)(job.secrets, 'Secrets must be defined for non-custom builds')
|
|
29
29
|
.robotAccessToken,
|
|
30
30
|
...extraEnv,
|
|
31
31
|
},
|
|
32
|
-
logger
|
|
32
|
+
logger,
|
|
33
33
|
mode: logger_1.PipeMode.STDERR_ONLY_AS_STDOUT,
|
|
34
34
|
});
|
|
35
35
|
const stdout = result.stdout.toString();
|
|
36
36
|
const parsed = JSON.parse(stdout);
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
return validateEasBuildInternalResult({
|
|
38
|
+
result: parsed,
|
|
39
|
+
oldJob: job,
|
|
40
|
+
});
|
|
39
41
|
}
|
|
40
42
|
exports.runEasBuildInternalAsync = runEasBuildInternalAsync;
|
|
41
|
-
async function
|
|
43
|
+
async function resolveEnvFromBuildProfileAsync(ctx, { cwd }) {
|
|
42
44
|
var _a;
|
|
43
45
|
const { cmd, args, extraEnv } = await resolveEasCommandPrefixAndEnvAsync();
|
|
44
46
|
const { buildProfile } = ctx.job;
|
|
@@ -56,7 +58,7 @@ async function configureEnvFromBuildProfileAsync(ctx) {
|
|
|
56
58
|
'--json',
|
|
57
59
|
'--eas-json-only',
|
|
58
60
|
], {
|
|
59
|
-
cwd
|
|
61
|
+
cwd,
|
|
60
62
|
env: { ...ctx.env, ...extraEnv },
|
|
61
63
|
});
|
|
62
64
|
}
|
|
@@ -68,9 +70,9 @@ async function configureEnvFromBuildProfileAsync(ctx) {
|
|
|
68
70
|
const stdout = spawnResult.stdout.toString();
|
|
69
71
|
const parsed = JSON.parse(stdout);
|
|
70
72
|
const env = validateEnvs(parsed.buildProfile);
|
|
71
|
-
|
|
73
|
+
return env;
|
|
72
74
|
}
|
|
73
|
-
exports.
|
|
75
|
+
exports.resolveEnvFromBuildProfileAsync = resolveEnvFromBuildProfileAsync;
|
|
74
76
|
async function resolveEasCommandPrefixAndEnvAsync() {
|
|
75
77
|
var _a;
|
|
76
78
|
const npxArgsPrefix = (await (0, packageManager_1.isAtLeastNpm7Async)()) ? ['-y'] : [];
|
|
@@ -96,7 +98,7 @@ async function resolveEasCommandPrefixAndEnvAsync() {
|
|
|
96
98
|
};
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
|
-
function validateEasBuildInternalResult(
|
|
101
|
+
function validateEasBuildInternalResult({ oldJob, result, }) {
|
|
100
102
|
const { value, error } = EasBuildInternalResultSchema.validate(result, {
|
|
101
103
|
stripUnknown: true,
|
|
102
104
|
convert: true,
|
|
@@ -105,10 +107,10 @@ function validateEasBuildInternalResult(ctx, result) {
|
|
|
105
107
|
if (error) {
|
|
106
108
|
throw error;
|
|
107
109
|
}
|
|
108
|
-
const
|
|
109
|
-
(0, assert_1.default)(
|
|
110
|
-
const
|
|
111
|
-
return {
|
|
110
|
+
const newJob = (0, eas_build_job_1.sanitizeJob)(value.job);
|
|
111
|
+
(0, assert_1.default)(newJob.platform === oldJob.platform, 'eas-cli returned a job for a wrong platform');
|
|
112
|
+
const newMetadata = (0, eas_build_job_1.sanitizeMetadata)(value.metadata);
|
|
113
|
+
return { newJob, newMetadata };
|
|
112
114
|
}
|
|
113
115
|
function validateEnvs(result) {
|
|
114
116
|
const { value, error } = joi_1.default.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easBuildInternal.js","sourceRoot":"","sources":["../../src/common/easBuildInternal.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAAwF;AACxF,
|
|
1
|
+
{"version":3,"file":"easBuildInternal.js","sourceRoot":"","sources":["../../src/common/easBuildInternal.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAAwF;AACxF,yCAAgD;AAChD,sEAAuC;AACvC,8CAAsB;AACtB,4DAAoC;AAIpC,4DAA6D;AAE7D,MAAM,uBAAuB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAEtD,MAAM,4BAA4B,GAAG,aAAG,CAAC,MAAM,CAAoC;IACjF,GAAG,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC3B,QAAQ,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;CACjC,CAAC,CAAC;AAEI,KAAK,UAAU,wBAAwB,CAAmB,EAC/D,GAAG,EACH,MAAM,EACN,GAAG,EACH,GAAG,GAMJ;IAIC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,kCAAkC,EAAE,CAAC;IAC3E,MAAM,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC;IAC7B,IAAA,gBAAM,EAAC,YAAY,EAAE,iEAAiE,CAAC,CAAC;IACxF,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAK,EACxB,GAAG,EACH,CAAC,GAAG,IAAI,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,CAAC,EAClF;QACE,GAAG;QACH,GAAG,EAAE;YACH,GAAG,GAAG;YACN,UAAU,EAAE,IAAA,oBAAU,EAAC,GAAG,CAAC,OAAO,EAAE,+CAA+C,CAAC;iBACjF,gBAAgB;YACnB,GAAG,QAAQ;SACZ;QACD,MAAM;QACN,IAAI,EAAE,iBAAQ,CAAC,qBAAqB;KACrC,CACF,CAAC;IACF,MAAM,MAAM,GAAG,MAA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,MAAM,KAAK,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,IAAA,2BAAW,EAAC,KAAK,CAAC,GAAG,CAAS,CAAC;IAC9C,IAAA,gBAAM,EAAC,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,EAAE,6CAA6C,CAAC,CAAC;IAC3F,MAAM,WAAW,GAAG,IAAA,gCAAgB,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACjC,CAAC;AAED,SAAS,YAAY,CAAC,MAAW;IAC/B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,aAAG,CAAC,MAAM,CAAC;QAClC,GAAG,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,aAAG,CAAC,MAAM,EAAE,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC;KACtD,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE;QAClB,YAAY,EAAE,IAAI;QAClB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IACH,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,CAAC;AACpB,CAAC","sourcesContent":["import assert from 'assert';\n\nimport { Env, Job, Metadata, sanitizeJob, sanitizeMetadata } from '@expo/eas-build-job';\nimport { PipeMode, bunyan } from '@expo/logger';\nimport spawn from '@expo/turtle-spawn';\nimport Joi from 'joi';\nimport nullthrows from 'nullthrows';\nimport { BuildStepEnv } from '@expo/steps';\n\nimport { BuildContext } from '../context';\nimport { isAtLeastNpm7Async } from '../utils/packageManager';\n\nconst EAS_CLI_STAGING_NPM_TAG = 'latest-eas-build-staging';\nconst EAS_CLI_PRODUCTION_NPM_TAG = 'latest-eas-build';\n\nconst EasBuildInternalResultSchema = Joi.object<{ job: object; metadata: object }>({\n job: Joi.object().unknown(),\n metadata: Joi.object().unknown(),\n});\n\nexport async function runEasBuildInternalAsync<TJob extends Job>({\n job,\n logger,\n env,\n cwd,\n}: {\n job: TJob;\n logger: bunyan;\n env: BuildStepEnv;\n cwd: string;\n}): Promise<{\n newJob: TJob;\n newMetadata: Metadata;\n}> {\n const { cmd, args, extraEnv } = await resolveEasCommandPrefixAndEnvAsync();\n const { buildProfile } = job;\n assert(buildProfile, 'build profile is missing in a build from git-based integration.');\n const result = await spawn(\n cmd,\n [...args, 'build:internal', '--platform', job.platform, '--profile', buildProfile],\n {\n cwd,\n env: {\n ...env,\n EXPO_TOKEN: nullthrows(job.secrets, 'Secrets must be defined for non-custom builds')\n .robotAccessToken,\n ...extraEnv,\n },\n logger,\n mode: PipeMode.STDERR_ONLY_AS_STDOUT,\n }\n );\n const stdout = result.stdout.toString();\n const parsed = JSON.parse(stdout);\n return validateEasBuildInternalResult({\n result: parsed,\n oldJob: job,\n });\n}\n\nexport async function resolveEnvFromBuildProfileAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n { cwd }: { cwd: string }\n): Promise<Env> {\n const { cmd, args, extraEnv } = await resolveEasCommandPrefixAndEnvAsync();\n const { buildProfile } = ctx.job;\n assert(buildProfile, 'build profile is missing in a build from git-based integration.');\n let spawnResult;\n try {\n spawnResult = await spawn(\n cmd,\n [\n ...args,\n 'config',\n '--platform',\n ctx.job.platform,\n '--profile',\n buildProfile,\n '--non-interactive',\n '--json',\n '--eas-json-only',\n ],\n {\n cwd,\n env: { ...ctx.env, ...extraEnv },\n }\n );\n } catch (err: any) {\n ctx.logger.error(`Failed to the read build profile ${buildProfile} from eas.json.`);\n ctx.logger.error(err.stderr?.toString());\n throw Error(`Failed to read the build profile ${buildProfile} from eas.json.`);\n }\n const stdout = spawnResult.stdout.toString();\n const parsed = JSON.parse(stdout);\n const env = validateEnvs(parsed.buildProfile);\n return env;\n}\n\nasync function resolveEasCommandPrefixAndEnvAsync(): Promise<{\n cmd: string;\n args: string[];\n extraEnv: Env;\n}> {\n const npxArgsPrefix = (await isAtLeastNpm7Async()) ? ['-y'] : [];\n if (process.env.ENVIRONMENT === 'development') {\n return {\n cmd: process.env.EAS_BUILD_INTERNAL_EXECUTABLE ?? `eas`,\n args: [],\n extraEnv: { EXPO_LOCAL: '1' },\n };\n } else if (process.env.ENVIRONMENT === 'staging') {\n return {\n cmd: 'npx',\n args: [...npxArgsPrefix, `eas-cli@${EAS_CLI_STAGING_NPM_TAG}`],\n extraEnv: { EXPO_STAGING: '1' },\n };\n } else {\n return {\n cmd: 'npx',\n args: [...npxArgsPrefix, `eas-cli@${EAS_CLI_PRODUCTION_NPM_TAG}`],\n extraEnv: {},\n };\n }\n}\n\nfunction validateEasBuildInternalResult<TJob extends Job>({\n oldJob,\n result,\n}: {\n oldJob: TJob;\n result: any;\n}): { newJob: TJob; newMetadata: Metadata } {\n const { value, error } = EasBuildInternalResultSchema.validate(result, {\n stripUnknown: true,\n convert: true,\n abortEarly: false,\n });\n if (error) {\n throw error;\n }\n const newJob = sanitizeJob(value.job) as TJob;\n assert(newJob.platform === oldJob.platform, 'eas-cli returned a job for a wrong platform');\n const newMetadata = sanitizeMetadata(value.metadata);\n return { newJob, newMetadata };\n}\n\nfunction validateEnvs(result: any): Env {\n const { value, error } = Joi.object({\n env: Joi.object().pattern(Joi.string(), Joi.string()),\n }).validate(result, {\n stripUnknown: true,\n convert: true,\n abortEarly: false,\n });\n if (error) {\n throw error;\n }\n return value?.env;\n}\n"]}
|
package/dist/common/setup.js
CHANGED
|
@@ -38,7 +38,10 @@ async function setupAsync(ctx) {
|
|
|
38
38
|
if (ctx.job.triggeredBy === common_1.BuildTrigger.GIT_BASED_INTEGRATION) {
|
|
39
39
|
// We need to setup envs from eas.json before
|
|
40
40
|
// eas-build-pre-install hook is called.
|
|
41
|
-
await (0, easBuildInternal_1.
|
|
41
|
+
const env = await (0, easBuildInternal_1.resolveEnvFromBuildProfileAsync)(ctx, {
|
|
42
|
+
cwd: ctx.getReactNativeProjectDirectory(),
|
|
43
|
+
});
|
|
44
|
+
ctx.updateEnv(env);
|
|
42
45
|
}
|
|
43
46
|
// try to read package.json to see if it exists and is valid
|
|
44
47
|
return (0, project_1.readPackageJson)(ctx.getReactNativeProjectDirectory());
|
|
@@ -55,7 +58,13 @@ async function setupAsync(ctx) {
|
|
|
55
58
|
});
|
|
56
59
|
if (ctx.job.triggeredBy === common_1.BuildTrigger.GIT_BASED_INTEGRATION) {
|
|
57
60
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.EAS_BUILD_INTERNAL, async () => {
|
|
58
|
-
await (0, easBuildInternal_1.runEasBuildInternalAsync)(
|
|
61
|
+
const { newJob, newMetadata } = await (0, easBuildInternal_1.runEasBuildInternalAsync)({
|
|
62
|
+
job: ctx.job,
|
|
63
|
+
env: ctx.env,
|
|
64
|
+
logger: ctx.logger,
|
|
65
|
+
cwd: ctx.getReactNativeProjectDirectory(),
|
|
66
|
+
});
|
|
67
|
+
ctx.updateJobInformation(newJob, newMetadata);
|
|
59
68
|
});
|
|
60
69
|
}
|
|
61
70
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.READ_APP_CONFIG, async () => {
|
package/dist/common/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/common/setup.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,sEAAsE;AACtE,wDAA0B;AAC1B,uDAAqE;AACrE,4DAA+D;AAC/D,4DAAoC;AAEpC,4DAAkE;AAGlE,8CAAmE;AACnE,0CAAwD;AACxD,0CAAiD;AACjD,4DAA6D;AAC7D,8CAA2E;AAC3E,kDAA4E;AAE5E,qDAA8D;AAC9D,+DAAqF;AACrF,yDAAiG;AAEjG,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7C,MAAM,oCAAoC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5D,MAAM,oCAAo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AC,KAAK,CAAC,GAAG,CAAC,SAAS,8DAA8D,GAAG,CAAC,GAAG,CAAC,oBAAoB,MAAM,YAAY,mDAAmD,CAC9O,CAAC;IACJ,CAAC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,CAAA,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,0CAAE,GAAG,0CAAE,SAAS,CAAA,EAAE,CAAC;QAC7E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACrF,GAAG,CAAC,yBAAyB,EAAE,CAAC;IAClC,CAAC;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport spawn, { SpawnPromise, SpawnResult } from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\nimport { BuildPhase, Ios, Job, Platform } from '@expo/eas-build-job';\nimport { BuildTrigger } from '@expo/eas-build-job/dist/common';\nimport nullthrows from 'nullthrows';\nimport { ExpoConfig } from '@expo/config';\nimport { UserFacingError } from '@expo/eas-build-job/dist/errors';\n\nimport { BuildContext } from '../context';\nimport { deleteXcodeEnvLocalIfExistsAsync } from '../ios/xcodeEnv';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { setUpNpmrcAsync } from '../utils/npmrc';\nimport { isAtLeastNpm7Async } from '../utils/packageManager';\nimport { readPackageJson, shouldUseGlobalExpoCli } from '../utils/project';\nimport { getParentAndDescendantProcessPidsAsync } from '../utils/processes';\n\nimport { prepareProjectSourcesAsync } from './projectSources';\nimport { installDependenciesAsync, resolvePackagerDir } from './installDependencies';\nimport { configureEnvFromBuildProfileAsync, runEasBuildInternalAsync } from './easBuildInternal';\n\nconst MAX_EXPO_DOCTOR_TIMEOUT_MS = 30 * 1000;\nconst INSTALL_DEPENDENCIES_WARN_TIMEOUT_MS = 15 * 60 * 1000;\nconst INSTALL_DEPENDENCIES_KILL_TIMEOUT_MS = 30 * 60 * 1000;\n\nclass DoctorTimeoutError extends Error {}\nclass InstallDependenciesTimeoutError extends Error {}\n\nexport async function setupAsync<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n const packageJson = await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await prepareProjectSourcesAsync(ctx);\n await setUpNpmrcAsync(ctx, ctx.logger);\n if (ctx.job.platform === Platform.IOS && ctx.env.EAS_BUILD_RUNNER === 'eas-build') {\n await deleteXcodeEnvLocalIfExistsAsync(ctx as BuildContext<Ios.Job>);\n }\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n // We need to setup envs from eas.json before\n // eas-build-pre-install hook is called.\n await configureEnvFromBuildProfileAsync(ctx);\n }\n // try to read package.json to see if it exists and is valid\n return readPackageJson(ctx.getReactNativeProjectDirectory());\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.READ_PACKAGE_JSON, async () => {\n ctx.logger.info('Using package.json:');\n ctx.logger.info(JSON.stringify(packageJson, null, 2));\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_DEPENDENCIES, async () => {\n await runInstallDependenciesAsync(ctx);\n });\n\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n await ctx.runBuildPhase(BuildPhase.EAS_BUILD_INTERNAL, async () => {\n await runEasBuildInternalAsync(ctx);\n });\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 await validateAppConfigAsync(ctx, appConfig);\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 if (err instanceof DoctorTimeoutError) {\n ctx.logger.error(err.message);\n } else {\n ctx.logger.error({ err }, 'Command \"expo doctor\" failed.');\n }\n ctx.markBuildPhaseHasWarnings();\n }\n });\n }\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 let timedOut = false;\n const isAtLeastNpm7 = await isAtLeastNpm7Async();\n try {\n let promise: SpawnPromise<SpawnResult>;\n if (!shouldUseGlobalExpoCli(ctx)) {\n const argsPrefix = isAtLeastNpm7 ? ['-y'] : [];\n promise = spawn('npx', [...argsPrefix, 'expo-doctor'], {\n cwd: ctx.getReactNativeProjectDirectory(),\n logger: ctx.logger,\n env: ctx.env,\n });\n } else {\n promise = ctx.runGlobalExpoCliCommand(\n ['doctor'],\n {\n cwd: ctx.getReactNativeProjectDirectory(),\n logger: ctx.logger,\n env: ctx.env,\n },\n isAtLeastNpm7\n );\n }\n timeout = setTimeout(async () => {\n timedOut = true;\n const ppid = nullthrows(promise.child.pid);\n const pids = await getParentAndDescendantProcessPidsAsync(ppid);\n pids.forEach((pid) => {\n process.kill(pid);\n });\n ctx.reportError?.(`\"expo doctor\" timed out`, undefined, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n }, MAX_EXPO_DOCTOR_TIMEOUT_MS);\n return await promise;\n } catch (err: any) {\n if (timedOut) {\n throw new DoctorTimeoutError('\"expo doctor\" timed out, skipping...');\n }\n throw err;\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n}\n\nasync function runInstallDependenciesAsync<TJob extends Job>(\n ctx: BuildContext<TJob>\n): Promise<void> {\n let warnTimeout: NodeJS.Timeout | undefined;\n let killTimeout: NodeJS.Timeout | undefined;\n let killTimedOut: boolean = false;\n try {\n const installDependenciesSpawnPromise = (\n await installDependenciesAsync(ctx, {\n logger: ctx.logger,\n infoCallbackFn: () => {\n if (warnTimeout) {\n warnTimeout.refresh();\n }\n if (killTimeout) {\n killTimeout.refresh();\n }\n },\n cwd: resolvePackagerDir(ctx),\n })\n ).spawnPromise;\n\n warnTimeout = setTimeout(() => {\n ctx.logger.warn(\n '\"Install dependencies\" phase takes longer then expected and it did not produce any logs in the past 15 minutes. Consider evaluating your package.json file for possible issues with dependencies'\n );\n }, INSTALL_DEPENDENCIES_WARN_TIMEOUT_MS);\n\n killTimeout = setTimeout(async () => {\n killTimedOut = true;\n ctx.logger.error(\n '\"Install dependencies\" phase takes a very long time and it did not produce any logs in the past 30 minutes. Most likely an unexpected error happened with your dependencies which caused the process to hang and it will be terminated'\n );\n const ppid = nullthrows(installDependenciesSpawnPromise.child.pid);\n const pids = await getParentAndDescendantProcessPidsAsync(ppid);\n pids.forEach((pid) => {\n process.kill(pid);\n });\n ctx.reportError?.('\"Install dependencies\" phase takes a very long time', undefined, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n }, INSTALL_DEPENDENCIES_KILL_TIMEOUT_MS);\n\n await installDependenciesSpawnPromise;\n } catch (err: any) {\n if (killTimedOut) {\n throw new InstallDependenciesTimeoutError(\n '\"Install dependencies\" phase was inactive for over 30 minutes. Please evaluate your package.json file'\n );\n }\n throw err;\n } finally {\n if (warnTimeout) {\n clearTimeout(warnTimeout);\n }\n if (killTimeout) {\n clearTimeout(killTimeout);\n }\n }\n}\n\nasync function validateAppConfigAsync(\n ctx: BuildContext<Job>,\n appConfig: ExpoConfig\n): Promise<void> {\n if (\n appConfig?.extra?.eas?.projectId &&\n ctx.env.EAS_BUILD_PROJECT_ID &&\n appConfig.extra.eas.projectId !== ctx.env.EAS_BUILD_PROJECT_ID\n ) {\n const isUsingDynamicConfig =\n (await fs.pathExists(path.join(ctx.getReactNativeProjectDirectory(), 'app.config.ts'))) ||\n (await fs.pathExists(path.join(ctx.getReactNativeProjectDirectory(), 'app.config.js')));\n const isGitHubBuild = ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION;\n let extraMessage = '';\n if (isGitHubBuild && isUsingDynamicConfig) {\n extraMessage =\n 'Make sure you connected your GitHub repository to the correct Expo project and if you are using environment variables to switch between projects in app.config.js/app.config.ts remember to set those variables in eas.json too. ';\n } else if (isGitHubBuild) {\n extraMessage = 'Make sure you connected your GitHub repository to the correct Expo project. ';\n } else if (isUsingDynamicConfig) {\n extraMessage =\n 'If you are using environment variables to switch between projects in app.config.js/app.config.ts, make sure those variables are also set inside EAS Build. You can do that using \"env\" field in eas.json or EAS Secrets. ';\n }\n throw new UserFacingError(\n 'EAS_BUILD_PROJECT_ID_MISMATCH',\n `The value of the \"extra.eas.projectId\" field (${appConfig.extra.eas.projectId}) in the app config does not match the current project id (${ctx.env.EAS_BUILD_PROJECT_ID}). ${extraMessage}Learn more: https://expo.fyi/eas-config-mismatch.`\n );\n } else if (ctx.env.EAS_BUILD_PROJECT_ID && !appConfig?.extra?.eas?.projectId) {\n ctx.logger.error(`The \"extra.eas.projectId\" field is missing from your app config.`);\n ctx.markBuildPhaseHasWarnings();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/common/setup.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,sEAAsE;AACtE,wDAA0B;AAC1B,uDAAqE;AACrE,4DAA+D;AAC/D,4DAAoC;AAEpC,4DAAkE;AAGlE,8CAAmE;AACnE,0CAAwD;AACxD,0CAAiD;AACjD,4DAA6D;AAC7D,8CAA2E;AAC3E,kDAA4E;AAE5E,qDAA8D;AAC9D,+DAAqF;AACrF,yDAA+F;AAE/F,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7C,MAAM,oCAAoC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5D,MAAM,oCAAoC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE5D,MAAM,kBAAmB,SAAQ,KAAK;CAAG;A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AAI,aAAa,IAAI,oBAAoB,EAAE,CAAC;YAC1C,YAAY;gBACV,mOAAmO,CAAC;QACxO,CAAC;aAAM,IAAI,aAAa,EAAE,CAAC;YACzB,YAAY,GAAG,8EAA8E,CAAC;QAChG,CAAC;aAAM,IAAI,oBAAoB,EAAE,CAAC;YAChC,YAAY;gBACV,2NAA2N,CAAC;QAChO,CAAC;QACD,MAAM,IAAI,wBAAe,CACvB,+BAA+B,EAC/B,iDAAiD,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,8DAA8D,GAAG,CAAC,GAAG,CAAC,oBAAoB,MAAM,YAAY,mDAAmD,CAC9O,CAAC;IACJ,CAAC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,CAAA,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,0CAAE,GAAG,0CAAE,SAAS,CAAA,EAAE,CAAC;QAC7E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACrF,GAAG,CAAC,yBAAyB,EAAE,CAAC;IAClC,CAAC;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport spawn, { SpawnPromise, SpawnResult } from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\nimport { BuildPhase, Ios, Job, Platform } from '@expo/eas-build-job';\nimport { BuildTrigger } from '@expo/eas-build-job/dist/common';\nimport nullthrows from 'nullthrows';\nimport { ExpoConfig } from '@expo/config';\nimport { UserFacingError } from '@expo/eas-build-job/dist/errors';\n\nimport { BuildContext } from '../context';\nimport { deleteXcodeEnvLocalIfExistsAsync } from '../ios/xcodeEnv';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { setUpNpmrcAsync } from '../utils/npmrc';\nimport { isAtLeastNpm7Async } from '../utils/packageManager';\nimport { readPackageJson, shouldUseGlobalExpoCli } from '../utils/project';\nimport { getParentAndDescendantProcessPidsAsync } from '../utils/processes';\n\nimport { prepareProjectSourcesAsync } from './projectSources';\nimport { installDependenciesAsync, resolvePackagerDir } from './installDependencies';\nimport { resolveEnvFromBuildProfileAsync, runEasBuildInternalAsync } from './easBuildInternal';\n\nconst MAX_EXPO_DOCTOR_TIMEOUT_MS = 30 * 1000;\nconst INSTALL_DEPENDENCIES_WARN_TIMEOUT_MS = 15 * 60 * 1000;\nconst INSTALL_DEPENDENCIES_KILL_TIMEOUT_MS = 30 * 60 * 1000;\n\nclass DoctorTimeoutError extends Error {}\nclass InstallDependenciesTimeoutError extends Error {}\n\nexport async function setupAsync<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n const packageJson = await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await prepareProjectSourcesAsync(ctx);\n await setUpNpmrcAsync(ctx, ctx.logger);\n if (ctx.job.platform === Platform.IOS && ctx.env.EAS_BUILD_RUNNER === 'eas-build') {\n await deleteXcodeEnvLocalIfExistsAsync(ctx as BuildContext<Ios.Job>);\n }\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n // We need to setup envs from eas.json before\n // eas-build-pre-install hook is called.\n const env = await resolveEnvFromBuildProfileAsync(ctx, {\n cwd: ctx.getReactNativeProjectDirectory(),\n });\n ctx.updateEnv(env);\n }\n // try to read package.json to see if it exists and is valid\n return readPackageJson(ctx.getReactNativeProjectDirectory());\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.READ_PACKAGE_JSON, async () => {\n ctx.logger.info('Using package.json:');\n ctx.logger.info(JSON.stringify(packageJson, null, 2));\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_DEPENDENCIES, async () => {\n await runInstallDependenciesAsync(ctx);\n });\n\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n await ctx.runBuildPhase(BuildPhase.EAS_BUILD_INTERNAL, async () => {\n const { newJob, newMetadata } = await runEasBuildInternalAsync({\n job: ctx.job,\n env: ctx.env,\n logger: ctx.logger,\n cwd: ctx.getReactNativeProjectDirectory(),\n });\n ctx.updateJobInformation(newJob, newMetadata);\n });\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 await validateAppConfigAsync(ctx, appConfig);\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 if (err instanceof DoctorTimeoutError) {\n ctx.logger.error(err.message);\n } else {\n ctx.logger.error({ err }, 'Command \"expo doctor\" failed.');\n }\n ctx.markBuildPhaseHasWarnings();\n }\n });\n }\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 let timedOut = false;\n const isAtLeastNpm7 = await isAtLeastNpm7Async();\n try {\n let promise: SpawnPromise<SpawnResult>;\n if (!shouldUseGlobalExpoCli(ctx)) {\n const argsPrefix = isAtLeastNpm7 ? ['-y'] : [];\n promise = spawn('npx', [...argsPrefix, 'expo-doctor'], {\n cwd: ctx.getReactNativeProjectDirectory(),\n logger: ctx.logger,\n env: ctx.env,\n });\n } else {\n promise = ctx.runGlobalExpoCliCommand(\n ['doctor'],\n {\n cwd: ctx.getReactNativeProjectDirectory(),\n logger: ctx.logger,\n env: ctx.env,\n },\n isAtLeastNpm7\n );\n }\n timeout = setTimeout(async () => {\n timedOut = true;\n const ppid = nullthrows(promise.child.pid);\n const pids = await getParentAndDescendantProcessPidsAsync(ppid);\n pids.forEach((pid) => {\n process.kill(pid);\n });\n ctx.reportError?.(`\"expo doctor\" timed out`, undefined, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n }, MAX_EXPO_DOCTOR_TIMEOUT_MS);\n return await promise;\n } catch (err: any) {\n if (timedOut) {\n throw new DoctorTimeoutError('\"expo doctor\" timed out, skipping...');\n }\n throw err;\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n}\n\nasync function runInstallDependenciesAsync<TJob extends Job>(\n ctx: BuildContext<TJob>\n): Promise<void> {\n let warnTimeout: NodeJS.Timeout | undefined;\n let killTimeout: NodeJS.Timeout | undefined;\n let killTimedOut: boolean = false;\n try {\n const installDependenciesSpawnPromise = (\n await installDependenciesAsync(ctx, {\n logger: ctx.logger,\n infoCallbackFn: () => {\n if (warnTimeout) {\n warnTimeout.refresh();\n }\n if (killTimeout) {\n killTimeout.refresh();\n }\n },\n cwd: resolvePackagerDir(ctx),\n })\n ).spawnPromise;\n\n warnTimeout = setTimeout(() => {\n ctx.logger.warn(\n '\"Install dependencies\" phase takes longer then expected and it did not produce any logs in the past 15 minutes. Consider evaluating your package.json file for possible issues with dependencies'\n );\n }, INSTALL_DEPENDENCIES_WARN_TIMEOUT_MS);\n\n killTimeout = setTimeout(async () => {\n killTimedOut = true;\n ctx.logger.error(\n '\"Install dependencies\" phase takes a very long time and it did not produce any logs in the past 30 minutes. Most likely an unexpected error happened with your dependencies which caused the process to hang and it will be terminated'\n );\n const ppid = nullthrows(installDependenciesSpawnPromise.child.pid);\n const pids = await getParentAndDescendantProcessPidsAsync(ppid);\n pids.forEach((pid) => {\n process.kill(pid);\n });\n ctx.reportError?.('\"Install dependencies\" phase takes a very long time', undefined, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n }, INSTALL_DEPENDENCIES_KILL_TIMEOUT_MS);\n\n await installDependenciesSpawnPromise;\n } catch (err: any) {\n if (killTimedOut) {\n throw new InstallDependenciesTimeoutError(\n '\"Install dependencies\" phase was inactive for over 30 minutes. Please evaluate your package.json file'\n );\n }\n throw err;\n } finally {\n if (warnTimeout) {\n clearTimeout(warnTimeout);\n }\n if (killTimeout) {\n clearTimeout(killTimeout);\n }\n }\n}\n\nasync function validateAppConfigAsync(\n ctx: BuildContext<Job>,\n appConfig: ExpoConfig\n): Promise<void> {\n if (\n appConfig?.extra?.eas?.projectId &&\n ctx.env.EAS_BUILD_PROJECT_ID &&\n appConfig.extra.eas.projectId !== ctx.env.EAS_BUILD_PROJECT_ID\n ) {\n const isUsingDynamicConfig =\n (await fs.pathExists(path.join(ctx.getReactNativeProjectDirectory(), 'app.config.ts'))) ||\n (await fs.pathExists(path.join(ctx.getReactNativeProjectDirectory(), 'app.config.js')));\n const isGitHubBuild = ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION;\n let extraMessage = '';\n if (isGitHubBuild && isUsingDynamicConfig) {\n extraMessage =\n 'Make sure you connected your GitHub repository to the correct Expo project and if you are using environment variables to switch between projects in app.config.js/app.config.ts remember to set those variables in eas.json too. ';\n } else if (isGitHubBuild) {\n extraMessage = 'Make sure you connected your GitHub repository to the correct Expo project. ';\n } else if (isUsingDynamicConfig) {\n extraMessage =\n 'If you are using environment variables to switch between projects in app.config.js/app.config.ts, make sure those variables are also set inside EAS Build. You can do that using \"env\" field in eas.json or EAS Secrets. ';\n }\n throw new UserFacingError(\n 'EAS_BUILD_PROJECT_ID_MISMATCH',\n `The value of the \"extra.eas.projectId\" field (${appConfig.extra.eas.projectId}) in the app config does not match the current project id (${ctx.env.EAS_BUILD_PROJECT_ID}). ${extraMessage}Learn more: https://expo.fyi/eas-config-mismatch.`\n );\n } else if (ctx.env.EAS_BUILD_PROJECT_ID && !appConfig?.extra?.eas?.projectId) {\n ctx.logger.error(`The \"extra.eas.projectId\" field is missing from your app config.`);\n ctx.markBuildPhaseHasWarnings();\n }\n}\n"]}
|
|
@@ -16,12 +16,13 @@ export declare class CustomBuildContext implements ExternalBuildContextProvider
|
|
|
16
16
|
readonly buildLogsDirectory: string;
|
|
17
17
|
readonly logger: bunyan;
|
|
18
18
|
readonly runtimeApi: BuilderRuntimeApi;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
job: Job;
|
|
20
|
+
metadata?: Metadata;
|
|
21
21
|
private _env;
|
|
22
22
|
constructor(buildCtx: BuildContext<Job>);
|
|
23
23
|
get runtimePlatform(): BuildRuntimePlatform;
|
|
24
24
|
get env(): Env;
|
|
25
25
|
staticContext(): any;
|
|
26
26
|
updateEnv(env: Env): void;
|
|
27
|
+
updateJobInformation(job: Job, metadata: Metadata): void;
|
|
27
28
|
}
|
|
@@ -40,6 +40,13 @@ class CustomBuildContext {
|
|
|
40
40
|
updateEnv(env) {
|
|
41
41
|
this._env = env;
|
|
42
42
|
}
|
|
43
|
+
updateJobInformation(job, metadata) {
|
|
44
|
+
if (this.job.triggeredBy !== eas_build_job_1.BuildTrigger.GIT_BASED_INTEGRATION) {
|
|
45
|
+
throw new Error('Updating job information is only allowed when build was triggered by a git-based integration.');
|
|
46
|
+
}
|
|
47
|
+
this.job = { ...job, triggeredBy: this.job.triggeredBy };
|
|
48
|
+
this.metadata = metadata;
|
|
49
|
+
}
|
|
43
50
|
}
|
|
44
51
|
exports.CustomBuildContext = CustomBuildContext;
|
|
45
52
|
//# sourceMappingURL=customBuildContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customBuildContext.js","sourceRoot":"","sources":["../src/customBuildContext.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"customBuildContext.js","sourceRoot":"","sources":["../src/customBuildContext.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAA6F;AAE7F,uCAAiF;AAIjF,MAAM,8BAA8B,GAA2C;IAC7E,CAAC,wBAAQ,CAAC,OAAO,CAAC,EAAE,4BAAoB,CAAC,KAAK;IAC9C,CAAC,wBAAQ,CAAC,GAAG,CAAC,EAAE,4BAAoB,CAAC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C;IAClB,CAAC;IAEM,oBAAoB,CAAC,GAAQ,EAAE,QAAkB;QACtD,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,EAAE,GAAG,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;QACzD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAvED,gDAuEC","sourcesContent":["import path from 'path';\n\nimport { BuildPhase, BuildTrigger, Env, Job, Metadata, Platform } 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 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: Job;\n public metadata?: Metadata;\n\n private _env: Env;\n\n constructor(buildCtx: BuildContext<Job>) {\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 get runtimePlatform(): BuildRuntimePlatform {\n return platformToBuildRuntimePlatform[this.job.platform];\n }\n\n public get env(): Env {\n return this._env;\n }\n\n public staticContext(): any {\n return {\n job: this.job,\n metadata: this.metadata,\n };\n }\n\n public updateEnv(env: Env): void {\n this._env = env;\n }\n\n public updateJobInformation(job: Job, 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 = { ...job, triggeredBy: this.job.triggeredBy };\n this.metadata = metadata;\n }\n}\n"]}
|
|
@@ -19,6 +19,7 @@ const runFastlane_1 = require("./functions/runFastlane");
|
|
|
19
19
|
const startAndroidEmulator_1 = require("./functions/startAndroidEmulator");
|
|
20
20
|
const startIosSimulator_1 = require("./functions/startIosSimulator");
|
|
21
21
|
const installMaestro_1 = require("./functions/installMaestro");
|
|
22
|
+
const getCredentialsForBuildTriggeredByGitHubIntegration_1 = require("./functions/getCredentialsForBuildTriggeredByGitHubIntegration");
|
|
22
23
|
function getEasFunctions(ctx) {
|
|
23
24
|
return [
|
|
24
25
|
(0, checkout_1.createCheckoutBuildFunction)(),
|
|
@@ -39,6 +40,7 @@ function getEasFunctions(ctx) {
|
|
|
39
40
|
(0, startAndroidEmulator_1.createStartAndroidEmulatorBuildFunction)(),
|
|
40
41
|
(0, startIosSimulator_1.createStartIosSimulatorBuildFunction)(),
|
|
41
42
|
(0, installMaestro_1.createInstallMaestroBuildFunction)(),
|
|
43
|
+
(0, getCredentialsForBuildTriggeredByGitHubIntegration_1.createGetCredentialsForBuildTriggeredByGithubIntegration)(ctx),
|
|
42
44
|
];
|
|
43
45
|
}
|
|
44
46
|
exports.getEasFunctions = getEasFunctions;
|
|
@@ -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;
|
|
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;AAE1I,SAAgB,eAAe,CAAC,GAAuB;IACrD,OAAO;QACL,IAAA,sCAA2B,GAAE;QAC7B,IAAA,kDAAiC,EAAC,GAAG,CAAC;QACtC,IAAA,2CAA6B,GAAE;QAC/B,IAAA,0DAAqC,GAAE;QACvC,IAAA,sCAA2B,GAAE;QAC7B,IAAA,4EAA8C,EAAC,GAAG,CAAC;QACnD,IAAA,qEAAqC,GAAE;QACvC,IAAA,2DAAgC,GAAE;QAClC,IAAA,yDAA+B,GAAE;QACjC,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;QACnC,IAAA,6GAAwD,EAAC,GAAG,CAAC;KAC9D,CAAC;AACJ,CAAC;AAtBD,0CAsBC","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';\n\nexport function getEasFunctions(ctx: CustomBuildContext): BuildFunction[] {\n return [\n createCheckoutBuildFunction(),\n createUploadArtifactBuildFunction(ctx),\n createSetUpNpmrcBuildFunction(),\n createInstallNodeModulesBuildFunction(),\n createPrebuildBuildFunction(),\n createFindAndUploadBuildArtifactsBuildFunction(ctx),\n configureEASUpdateIfInstalledFunction(),\n injectAndroidCredentialsFunction(),\n configureAndroidVersionFunction(),\n runGradleFunction(),\n resolveAppleTeamIdFromCredentialsFunction(),\n configureIosCredentialsFunction(),\n configureIosVersionFunction(),\n generateGymfileFromTemplateFunction(),\n runFastlaneFunction(),\n createStartAndroidEmulatorBuildFunction(),\n createStartIosSimulatorBuildFunction(),\n createInstallMaestroBuildFunction(),\n createGetCredentialsForBuildTriggeredByGithubIntegration(ctx),\n ];\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createGetCredentialsForBuildTriggeredByGithubIntegration = void 0;
|
|
4
|
+
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
5
|
+
const steps_1 = require("@expo/steps");
|
|
6
|
+
const easBuildInternal_1 = require("../../common/easBuildInternal");
|
|
7
|
+
function createGetCredentialsForBuildTriggeredByGithubIntegration(ctx) {
|
|
8
|
+
return new steps_1.BuildFunction({
|
|
9
|
+
namespace: 'eas',
|
|
10
|
+
id: 'get_credentials_for_build_triggered_by_github_integration',
|
|
11
|
+
name: 'Get credentials for build triggered by GitHub integration',
|
|
12
|
+
fn: async (stepCtx, { env }) => {
|
|
13
|
+
if (ctx.job.triggeredBy === eas_build_job_1.BuildTrigger.GIT_BASED_INTEGRATION) {
|
|
14
|
+
stepCtx.logger.info('Getting credentials for build triggered by EAS GitHub integration...');
|
|
15
|
+
const { newJob, newMetadata } = await (0, easBuildInternal_1.runEasBuildInternalAsync)({
|
|
16
|
+
job: ctx.job,
|
|
17
|
+
env,
|
|
18
|
+
logger: stepCtx.logger,
|
|
19
|
+
cwd: stepCtx.workingDirectory,
|
|
20
|
+
});
|
|
21
|
+
ctx.updateJobInformation(newJob, newMetadata);
|
|
22
|
+
stepCtx.logger.info('Credentials obtained.');
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
stepCtx.logger.info('Not a build triggered by EAS GitHub integration. Skipping...');
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.createGetCredentialsForBuildTriggeredByGithubIntegration = createGetCredentialsForBuildTriggeredByGithubIntegration;
|
|
31
|
+
//# sourceMappingURL=getCredentialsForBuildTriggeredByGitHubIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCredentialsForBuildTriggeredByGitHubIntegration.js","sourceRoot":"","sources":["../../../src/steps/functions/getCredentialsForBuildTriggeredByGitHubIntegration.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,uCAA4C;AAE5C,oEAAyE;AAGzE,SAAgB,wDAAwD,CACtE,GAAuB;IAEvB,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,2DAA2D;QAC/D,IAAI,EAAE,2DAA2D;QACjE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;YAC7B,IAAI,GAAG,CAAC,GAAG,CAAC,WAAW,KAAK,4BAAY,CAAC,qBAAqB,EAAE,CAAC;gBAC/D,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;gBAC5F,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,2CAAwB,EAAC;oBAC7D,GAAG,EAAE,GAAG,CAAC,GAAG;oBACZ,GAAG;oBACH,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,GAAG,EAAE,OAAO,CAAC,gBAAgB;iBAC9B,CAAC,CAAC;gBACH,GAAG,CAAC,oBAAoB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;gBAC9C,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YAC/C,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;YACtF,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAvBD,4HAuBC","sourcesContent":["import { BuildTrigger } from '@expo/eas-build-job';\nimport { BuildFunction } from '@expo/steps';\n\nimport { runEasBuildInternalAsync } from '../../common/easBuildInternal';\nimport { CustomBuildContext } from '../../customBuildContext';\n\nexport function createGetCredentialsForBuildTriggeredByGithubIntegration(\n ctx: CustomBuildContext\n): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'get_credentials_for_build_triggered_by_github_integration',\n name: 'Get credentials for build triggered by GitHub integration',\n fn: async (stepCtx, { env }) => {\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n stepCtx.logger.info('Getting credentials for build triggered by EAS GitHub integration...');\n const { newJob, newMetadata } = await runEasBuildInternalAsync({\n job: ctx.job,\n env,\n logger: stepCtx.logger,\n cwd: stepCtx.workingDirectory,\n });\n ctx.updateJobInformation(newJob, newMetadata);\n stepCtx.logger.info('Credentials obtained.');\n } else {\n stepCtx.logger.info('Not a build triggered by EAS GitHub integration. Skipping...');\n }\n },\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/build-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.65",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"node": "20.11.0",
|
|
68
68
|
"yarn": "1.22.21"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "ce1e02ddeb8223fd19ad647071658d6826e40900"
|
|
71
71
|
}
|