@expo/build-tools 1.0.51 → 1.0.53
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/common/installDependencies.d.ts +4 -6
- package/dist/common/installDependencies.js +10 -7
- package/dist/common/installDependencies.js.map +1 -1
- package/dist/common/prebuild.js +5 -1
- package/dist/common/prebuild.js.map +1 -1
- package/dist/common/setup.js +55 -4
- package/dist/common/setup.js.map +1 -1
- package/dist/context.js +7 -1
- package/dist/context.js.map +1 -1
- package/dist/customBuildContext.d.ts +2 -1
- package/dist/customBuildContext.js +2 -0
- package/dist/customBuildContext.js.map +1 -1
- package/dist/steps/functions/configureEASUpdateIfInstalled.js +11 -5
- package/dist/steps/functions/configureEASUpdateIfInstalled.js.map +1 -1
- package/dist/utils/appConfig.d.ts +6 -1
- package/dist/utils/appConfig.js +19 -4
- package/dist/utils/appConfig.js.map +1 -1
- package/package.json +6 -5
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/// <reference types="bunyan" />
|
|
2
1
|
import { Job } from '@expo/eas-build-job';
|
|
3
|
-
import {
|
|
2
|
+
import { SpawnPromise, SpawnResult, SpawnOptions } from '@expo/turtle-spawn';
|
|
4
3
|
import { BuildContext } from '../context';
|
|
5
|
-
export declare function installDependenciesAsync<TJob extends Job>(ctx: BuildContext<TJob>, { logger,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}): Promise<void>;
|
|
4
|
+
export declare function installDependenciesAsync<TJob extends Job>(ctx: BuildContext<TJob>, { logger, infoCallbackFn, cwd }: SpawnOptions): Promise<{
|
|
5
|
+
spawnPromise: SpawnPromise<SpawnResult>;
|
|
6
|
+
}>;
|
|
9
7
|
export declare function resolvePackagerDir(ctx: BuildContext<Job>): string;
|
|
@@ -8,7 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
|
|
9
9
|
const packageManager_1 = require("../utils/packageManager");
|
|
10
10
|
const project_1 = require("../utils/project");
|
|
11
|
-
async function installDependenciesAsync(ctx, { logger,
|
|
11
|
+
async function installDependenciesAsync(ctx, { logger, infoCallbackFn, cwd }) {
|
|
12
12
|
let args = ['install'];
|
|
13
13
|
if (ctx.packageManager === packageManager_1.PackageManager.PNPM) {
|
|
14
14
|
args = ['install', '--no-frozen-lockfile'];
|
|
@@ -19,12 +19,15 @@ async function installDependenciesAsync(ctx, { logger, workingDir }) {
|
|
|
19
19
|
args = ['install', '--no-immutable', '--inline-builds'];
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
logger.info(`Running "${ctx.packageManager} ${args.join(' ')}" in ${
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
logger === null || logger === void 0 ? void 0 : logger.info(`Running "${ctx.packageManager} ${args.join(' ')}" in ${cwd} directory`);
|
|
23
|
+
return {
|
|
24
|
+
spawnPromise: (0, turtle_spawn_1.default)(ctx.packageManager, args, {
|
|
25
|
+
cwd,
|
|
26
|
+
logger,
|
|
27
|
+
infoCallbackFn,
|
|
28
|
+
env: ctx.env,
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
28
31
|
}
|
|
29
32
|
exports.installDependenciesAsync = installDependenciesAsync;
|
|
30
33
|
function resolvePackagerDir(ctx) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installDependencies.js","sourceRoot":"","sources":["../../src/common/installDependencies.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;
|
|
1
|
+
{"version":3,"file":"installDependencies.js","sourceRoot":"","sources":["../../src/common/installDependencies.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,sEAAoF;AAGpF,4DAA8E;AAC9E,8CAAgD;AAEzC,KAAK,UAAU,wBAAwB,CAC5C,GAAuB,EACvB,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAgB;IAE7C,IAAI,IAAI,GAAG,CAAC,SAA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-job';\nimport spawn, { SpawnPromise, SpawnResult, SpawnOptions } from '@expo/turtle-spawn';\n\nimport { BuildContext } from '../context';\nimport { PackageManager, findPackagerRootDir } from '../utils/packageManager';\nimport { isUsingYarn2 } from '../utils/project';\n\nexport async function installDependenciesAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n { logger, infoCallbackFn, cwd }: SpawnOptions\n): Promise<{ spawnPromise: SpawnPromise<SpawnResult> }> {\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.getReactNativeProjectDirectory());\n if (isYarn2) {\n args = ['install', '--no-immutable', '--inline-builds'];\n }\n }\n logger?.info(`Running \"${ctx.packageManager} ${args.join(' ')}\" in ${cwd} directory`);\n return {\n spawnPromise: spawn(ctx.packageManager, args, {\n cwd,\n logger,\n infoCallbackFn,\n env: ctx.env,\n }),\n };\n}\n\nexport function resolvePackagerDir(ctx: BuildContext<Job>): string {\n const packagerRunDir = findPackagerRootDir(ctx.getReactNativeProjectDirectory());\n if (packagerRunDir !== ctx.getReactNativeProjectDirectory()) {\n const relativeReactNativeProjectDirectory = path.relative(\n ctx.buildDirectory,\n ctx.getReactNativeProjectDirectory()\n );\n ctx.logger.info(\n `We detected that '${relativeReactNativeProjectDirectory}' is a ${ctx.packageManager} workspace`\n );\n }\n return packagerRunDir;\n}\n"]}
|
package/dist/common/prebuild.js
CHANGED
|
@@ -25,7 +25,11 @@ async function prebuildAsync(ctx, { logger, workingDir, options }) {
|
|
|
25
25
|
await (0, project_1.runExpoCliCommand)(ctx, prebuildCommandArgs, spawnOptions, {
|
|
26
26
|
npmVersionAtLeast7: await (0, packageManager_1.isAtLeastNpm7Async)(),
|
|
27
27
|
});
|
|
28
|
-
await (0, installDependencies_1.installDependenciesAsync)(ctx, {
|
|
28
|
+
const installDependenciesSpawnPromise = (await (0, installDependencies_1.installDependenciesAsync)(ctx, {
|
|
29
|
+
logger,
|
|
30
|
+
cwd: (0, installDependencies_1.resolvePackagerDir)(ctx),
|
|
31
|
+
})).spawnPromise;
|
|
32
|
+
await installDependenciesSpawnPromise;
|
|
29
33
|
}
|
|
30
34
|
exports.prebuildAsync = prebuildAsync;
|
|
31
35
|
function getPrebuildCommandArgs(ctx) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prebuild.js","sourceRoot":"","sources":["../../src/common/prebuild.ts"],"names":[],"mappings":";;;;;;AAEA,oDAA4B;AAI5B,4DAA6D;AAC7D,8CAA6E;AAE7E,+DAAqF;AAM9E,KAAK,UAAU,aAAa,CACjC,GAAuB,EACvB,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAqE;;IAElG,MAAM,oBAAoB,GAAG,MAAA,GAAG,CAAC,GAAG,CAAC,kBAAkB,0CAAE,OAAO,CAAC;IACjE,MAAM,kBAAkB,GACtB,CAAC,oBAAoB,IAAI,gBAAM,CAAC,SAAS,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;IAE7E,MAAM,YAAY,GAAiB;QACjC,GAAG,EAAE,UAAU;QACf,MAAM;QACN,GAAG,EAAE;YACH,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjE,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS;YACrB,GAAG,GAAG,CAAC,GAAG;SACX;KACF,CAAC;IAEF,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;IACxD,MAAM,IAAA,2BAAiB,EAAC,GAAG,EAAE,mBAAmB,EAAE,YAAY,EAAE;QAC9D,kBAAkB,EAAE,MAAM,IAAA,mCAAkB,GAAE;KAC/C,CAAC,CAAC;IACH,MAAM,IAAA,8CAAwB,EAAC,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"prebuild.js","sourceRoot":"","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CAAC,QAAQ,EAAE,CAAC;IAC3E,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE;QAChD,eAAe,GAAG,GAAG,eAAe,eAAe,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;KACvE;IACD,MAAM,gBAAgB,GAAG,MAAM,CAAC;IAChC,MAAM,iBAAiB,GAAG,OAAO,CAAC;IAClC,MAAM,oBAAoB,GAAG,WAAW,CAAC;IACzC,IAAI,eAAe,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QAChD,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;KAC7E;IACD,IAAI,eAAe,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;QACjD,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;KAC9E;IACD,IAAI,eAAe,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE;QACpD,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;KACjF;IACD,IAAI,CAAC,IAAA,gCAAsB,EAAC,GAAG,CAAC,EAAE;QAChC,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;KACrE;IACD,OAAO,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import { Job } from '@expo/eas-build-job';\nimport { SpawnOptions } from '@expo/turtle-spawn';\nimport semver from 'semver';\nimport { bunyan } from '@expo/logger';\n\nimport { BuildContext } from '../context';\nimport { isAtLeastNpm7Async } from '../utils/packageManager';\nimport { runExpoCliCommand, shouldUseGlobalExpoCli } from '../utils/project';\n\nimport { installDependenciesAsync, resolvePackagerDir } from './installDependencies';\n\nexport interface PrebuildOptions {\n extraEnvs?: Record<string, string>;\n}\n\nexport async function prebuildAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n { logger, workingDir, options }: { logger: bunyan; workingDir: string; options?: PrebuildOptions }\n): Promise<void> {\n const customExpoCliVersion = ctx.job.builderEnvironment?.expoCli;\n const shouldDisableSharp =\n !customExpoCliVersion || semver.satisfies(customExpoCliVersion, '>=5.4.4');\n\n const spawnOptions: SpawnOptions = {\n cwd: workingDir,\n logger,\n env: {\n ...(shouldDisableSharp ? { EXPO_IMAGE_UTILS_NO_SHARP: '1' } : {}),\n ...options?.extraEnvs,\n ...ctx.env,\n },\n };\n\n const prebuildCommandArgs = getPrebuildCommandArgs(ctx);\n await runExpoCliCommand(ctx, prebuildCommandArgs, spawnOptions, {\n npmVersionAtLeast7: await isAtLeastNpm7Async(),\n });\n const installDependenciesSpawnPromise = (\n await installDependenciesAsync(ctx, {\n logger,\n cwd: resolvePackagerDir(ctx),\n })\n ).spawnPromise;\n await installDependenciesSpawnPromise;\n}\n\nfunction getPrebuildCommandArgs<TJob extends Job>(ctx: BuildContext<TJob>): string[] {\n let prebuildCommand =\n ctx.job.experimental?.prebuildCommand ??\n `prebuild --non-interactive --no-install --platform ${ctx.job.platform}`;\n if (!prebuildCommand.match(/(?:--platform| -p)/)) {\n prebuildCommand = `${prebuildCommand} --platform ${ctx.job.platform}`;\n }\n const npxCommandPrefix = 'npx ';\n const expoCommandPrefix = 'expo ';\n const expoCliCommandPrefix = 'expo-cli ';\n if (prebuildCommand.startsWith(npxCommandPrefix)) {\n prebuildCommand = prebuildCommand.substring(npxCommandPrefix.length).trim();\n }\n if (prebuildCommand.startsWith(expoCommandPrefix)) {\n prebuildCommand = prebuildCommand.substring(expoCommandPrefix.length).trim();\n }\n if (prebuildCommand.startsWith(expoCliCommandPrefix)) {\n prebuildCommand = prebuildCommand.substring(expoCliCommandPrefix.length).trim();\n }\n if (!shouldUseGlobalExpoCli(ctx)) {\n prebuildCommand = prebuildCommand.replace(' --non-interactive', '');\n }\n return prebuildCommand.split(' ');\n}\n"]}
|
package/dist/common/setup.js
CHANGED
|
@@ -21,8 +21,12 @@ const projectSources_1 = require("./projectSources");
|
|
|
21
21
|
const installDependencies_1 = require("./installDependencies");
|
|
22
22
|
const easBuildInternal_1 = require("./easBuildInternal");
|
|
23
23
|
const MAX_EXPO_DOCTOR_TIMEOUT_MS = 30 * 1000;
|
|
24
|
+
const INSTALL_DEPENDENCIES_WARN_TIMEOUT_MS = 15 * 60 * 1000;
|
|
25
|
+
const INSTALL_DEPENDENCIES_KILL_TIMEOUT_MS = 30 * 60 * 1000;
|
|
24
26
|
class DoctorTimeoutError extends Error {
|
|
25
27
|
}
|
|
28
|
+
class InstallDependenciesTimeoutError extends Error {
|
|
29
|
+
}
|
|
26
30
|
async function setupAsync(ctx) {
|
|
27
31
|
var _a;
|
|
28
32
|
const packageJson = await ctx.runBuildPhase(eas_build_job_1.BuildPhase.PREPARE_PROJECT, async () => {
|
|
@@ -47,10 +51,7 @@ async function setupAsync(ctx) {
|
|
|
47
51
|
ctx.logger.info(JSON.stringify(packageJson, null, 2));
|
|
48
52
|
});
|
|
49
53
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.INSTALL_DEPENDENCIES, async () => {
|
|
50
|
-
await (
|
|
51
|
-
logger: ctx.logger,
|
|
52
|
-
workingDir: (0, installDependencies_1.resolvePackagerDir)(ctx),
|
|
53
|
-
});
|
|
54
|
+
await runInstallDependenciesAsync(ctx);
|
|
54
55
|
});
|
|
55
56
|
if (ctx.job.triggeredBy === common_1.BuildTrigger.GIT_BASED_INTEGRATION) {
|
|
56
57
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.EAS_BUILD_INTERNAL, async () => {
|
|
@@ -133,6 +134,56 @@ async function runExpoDoctor(ctx) {
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
}
|
|
137
|
+
async function runInstallDependenciesAsync(ctx) {
|
|
138
|
+
let warnTimeout;
|
|
139
|
+
let killTimeout;
|
|
140
|
+
let killTimedOut = false;
|
|
141
|
+
try {
|
|
142
|
+
const installDependenciesSpawnPromise = (await (0, installDependencies_1.installDependenciesAsync)(ctx, {
|
|
143
|
+
logger: ctx.logger,
|
|
144
|
+
infoCallbackFn: () => {
|
|
145
|
+
if (warnTimeout) {
|
|
146
|
+
warnTimeout.refresh();
|
|
147
|
+
}
|
|
148
|
+
if (killTimeout) {
|
|
149
|
+
killTimeout.refresh();
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
cwd: (0, installDependencies_1.resolvePackagerDir)(ctx),
|
|
153
|
+
})).spawnPromise;
|
|
154
|
+
warnTimeout = setTimeout(() => {
|
|
155
|
+
ctx.logger.warn('"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');
|
|
156
|
+
}, INSTALL_DEPENDENCIES_WARN_TIMEOUT_MS);
|
|
157
|
+
killTimeout = setTimeout(async () => {
|
|
158
|
+
var _a;
|
|
159
|
+
killTimedOut = true;
|
|
160
|
+
ctx.logger.error('"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');
|
|
161
|
+
const ppid = (0, nullthrows_1.default)(installDependenciesSpawnPromise.child.pid);
|
|
162
|
+
const pids = await (0, processes_1.getParentAndDescendantProcessPidsAsync)(ppid);
|
|
163
|
+
pids.forEach((pid) => {
|
|
164
|
+
process.kill(pid);
|
|
165
|
+
});
|
|
166
|
+
(_a = ctx.reportError) === null || _a === void 0 ? void 0 : _a.call(ctx, '"Install dependencies" phase takes a very long time', undefined, {
|
|
167
|
+
extras: { buildId: ctx.env.EAS_BUILD_ID },
|
|
168
|
+
});
|
|
169
|
+
}, INSTALL_DEPENDENCIES_KILL_TIMEOUT_MS);
|
|
170
|
+
await installDependenciesSpawnPromise;
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
if (killTimedOut) {
|
|
174
|
+
throw new InstallDependenciesTimeoutError('"Install dependencies" phase was inactive for over 30 minutes. Please evaluate your package.json file');
|
|
175
|
+
}
|
|
176
|
+
throw err;
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
if (warnTimeout) {
|
|
180
|
+
clearTimeout(warnTimeout);
|
|
181
|
+
}
|
|
182
|
+
if (killTimeout) {
|
|
183
|
+
clearTimeout(killTimeout);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
136
187
|
async function validateAppConfigAsync(ctx, appConfig) {
|
|
137
188
|
var _a, _b, _c, _d;
|
|
138
189
|
if (((_b = (_a = appConfig === null || appConfig === void 0 ? void 0 : appConfig.extra) === null || _a === void 0 ? void 0 : _a.eas) === null || _b === void 0 ? void 0 : _b.projectId) &&
|
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;AAE7C,MAAM,kBAAmB,SAAQ,KAAK;CAAG;AAElC,KAAK,UAAU,UAAU,CAAmB,GAAuB;;IACxE,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QACjF,MAAM,IAAA,2CAA0B,EAAC,GAAG,CAAC,CAAC;QACtC,MAAM,IAAA,uBAAe,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,GAAG,CAAC,GAAG,CAAC,QAA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BACV,mOAAmO,CAAC;SACvO;aAAM,IAAI,aAAa,EAAE;YACxB,YAAY,GAAG,8EAA8E,CAAC;SAC/F;aAAM,IAAI,oBAAoB,EAAE;YAC/B,YAAY;gBACV,2NAA2N,CAAC;SAC/N;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;KACH;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;QAC5E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACrF,GAAG,CAAC,yBAAyB,EAAE,CAAC;KACjC;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;\n\nclass DoctorTimeoutError 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 installDependenciesAsync(ctx, {\n logger: ctx.logger,\n workingDir: resolvePackagerDir(ctx),\n });\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 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,+DAA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A,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,0CAAE,GAAG,0CAAE,SAAS,CAAA,EAAE;QAC5E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACrF,GAAG,CAAC,yBAAyB,EAAE,CAAC;KACjC;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"]}
|
package/dist/context.js
CHANGED
|
@@ -88,8 +88,14 @@ class BuildContext {
|
|
|
88
88
|
return (0, packageManager_1.resolvePackageManager)(this.getReactNativeProjectDirectory());
|
|
89
89
|
}
|
|
90
90
|
get appConfig() {
|
|
91
|
+
var _a;
|
|
91
92
|
if (!this._appConfig) {
|
|
92
|
-
this._appConfig = (0, appConfig_1.readAppConfig)(
|
|
93
|
+
this._appConfig = (0, appConfig_1.readAppConfig)({
|
|
94
|
+
projectDir: this.getReactNativeProjectDirectory(),
|
|
95
|
+
env: this.env,
|
|
96
|
+
logger: this.logger,
|
|
97
|
+
sdkVersion: (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.sdkVersion,
|
|
98
|
+
}).exp;
|
|
93
99
|
}
|
|
94
100
|
return this._appConfig;
|
|
95
101
|
}
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAC1B,uDAU6B;AAI7B,4DAA+D;AAE/D,2DAA+E;AAC/E,2DAAwE;AACxE,iDAAkD;AAClD,mEAAkF;AAElF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,CACN,CAAC;aACH;SACF;QACD,OAAO,kBAAkB,CAAC;IAC5B,CAAC;CACF;AAvSD,oCAuSC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\nimport {\n BuildPhase,\n BuildPhaseResult,\n BuildPhaseStats,\n Job,\n LogMarker,\n Env,\n errors,\n Metadata,\n EnvironmentSecretType,\n} from '@expo/eas-build-job';\nimport { ExpoConfig } from '@expo/config';\nimport { bunyan } from '@expo/logger';\nimport { SpawnPromise, SpawnOptions, SpawnResult } from '@expo/turtle-spawn';\nimport { BuildTrigger } from '@expo/eas-build-job/dist/common';\n\nimport { PackageManager, resolvePackageManager } from './utils/packageManager';\nimport { resolveBuildPhaseErrorAsync } from './buildErrors/detectError';\nimport { readAppConfig } from './utils/appConfig';\nimport { createTemporaryEnvironmentSecretFile } from './utils/environmentSecrets';\n\nexport enum ArtifactType {\n APPLICATION_ARCHIVE = 'APPLICATION_ARCHIVE',\n BUILD_ARTIFACTS = 'BUILD_ARTIFACTS',\n /**\n * @deprecated\n */\n XCODE_BUILD_LOGS = 'XCODE_BUILD_LOGS',\n}\n\nexport type Artifacts = Partial<Record<ArtifactType, string>>;\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 /**\n * @deprecated\n */\n runGlobalExpoCliCommand: (\n args: string[],\n options: SpawnOptions,\n npmVersionAtLeast7: boolean\n ) => SpawnPromise<SpawnResult>;\n uploadArtifacts: (type: ArtifactType, paths: string[], logger: bunyan) => Promise<string | null>;\n reportError?: (\n msg: string,\n err?: Error,\n options?: { tags?: Record<string, string>; extras?: Record<string, string> }\n ) => void;\n reportBuildPhaseStats?: (stats: BuildPhaseStats) => 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 cacheManager?: CacheManager;\n /**\n * @deprecated\n */\n public readonly runGlobalExpoCliCommand: (\n args: string[],\n options: SpawnOptions,\n npmVersionAtLeast7: boolean\n ) => SpawnPromise<SpawnResult>;\n public readonly reportError?: (\n msg: string,\n err?: Error,\n options?: { tags?: Record<string, string>; extras?: Record<string, string> }\n ) => void;\n public readonly skipNativeBuild?: boolean;\n public artifacts: Artifacts = {};\n\n private _env: Env;\n private _job: TJob;\n private _metadata?: Metadata;\n private readonly defaultLogger: bunyan;\n private readonly _uploadArtifacts: (\n type: ArtifactType,\n paths: string[],\n logger: bunyan\n ) => Promise<string | null>;\n private buildPhase?: BuildPhase;\n private buildPhaseSkipped = false;\n private buildPhaseHasWarnings = false;\n private _appConfig?: ExpoConfig;\n private readonly reportBuildPhaseStats?: (stats: BuildPhaseStats) => void;\n\n constructor(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.runGlobalExpoCliCommand = options.runGlobalExpoCliCommand;\n this._uploadArtifacts = options.uploadArtifacts;\n this.reportError = options.reportError;\n this._job = job;\n this._metadata = options.metadata;\n this.skipNativeBuild = options.skipNativeBuild;\n this.reportBuildPhaseStats = options.reportBuildPhaseStats;\n\n const environmentSecrets = this.getEnvironmentSecrets(job);\n this._env = {\n ...options.env,\n ...job?.builderEnvironment?.env,\n ...environmentSecrets,\n __EAS_BUILD_ENVS_DIR: this.buildEnvsDirectory,\n };\n this._env.PATH = this._env.PATH\n ? [this.buildExecutablesDirectory, this._env.PATH].join(':')\n : this.buildExecutablesDirectory;\n }\n\n public get job(): TJob {\n return this._job;\n }\n public get metadata(): Metadata | undefined {\n return this._metadata;\n }\n public get env(): Env {\n return this._env;\n }\n public get buildDirectory(): string {\n return path.join(this.workingdir, 'build');\n }\n public get buildLogsDirectory(): string {\n return path.join(this.workingdir, 'logs');\n }\n /**\n * Directory used to store executables used during regular (non-custom) builds.\n */\n public get buildExecutablesDirectory(): string {\n return path.join(this.workingdir, 'bin');\n }\n /**\n * Directory used to store env variables registered in the current build step.\n * All values stored here will be available in the next build phase as env variables.\n */\n public get buildEnvsDirectory(): string {\n return path.join(this.workingdir, 'env');\n }\n public get environmentSecretsDirectory(): string {\n return path.join(this.workingdir, 'environment-secrets');\n }\n public get packageManager(): PackageManager {\n return resolvePackageManager(this.getReactNativeProjectDirectory());\n }\n public get appConfig(): ExpoConfig {\n if (!this._appConfig) {\n this._appConfig = readAppConfig(\n this.getReactNativeProjectDirectory(),\n this.env,\n this.logger\n ).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 }: {\n doNotMarkStart?: boolean;\n doNotMarkEnd?: boolean;\n } = {}\n ): Promise<T> {\n let startTimestamp = Date.now();\n try {\n this.setBuildPhase(buildPhase, { doNotMarkStart });\n startTimestamp = Date.now();\n const result = await phase();\n const durationMs = Date.now() - startTimestamp;\n const buildPhaseResult: BuildPhaseResult = this.buildPhaseSkipped\n ? BuildPhaseResult.SKIPPED\n : this.buildPhaseHasWarnings\n ? BuildPhaseResult.WARNING\n : BuildPhaseResult.SUCCESS;\n await this.endCurrentBuildPhaseAsync({ result: buildPhaseResult, doNotMarkEnd, durationMs });\n return result;\n } catch (err: any) {\n const durationMs = Date.now() - startTimestamp;\n const resolvedError = await this.handleBuildPhaseErrorAsync(err, buildPhase);\n await this.endCurrentBuildPhaseAsync({ result: BuildPhaseResult.FAIL, durationMs });\n throw resolvedError;\n }\n }\n\n public markBuildPhaseSkipped(): void {\n this.buildPhaseSkipped = true;\n }\n\n public markBuildPhaseHasWarnings(): void {\n this.buildPhaseHasWarnings = true;\n }\n\n public async uploadArtifacts(type: ArtifactType, paths: string[], logger: bunyan): Promise<void> {\n const url = await this._uploadArtifacts(type, paths, logger);\n if (url) {\n this.artifacts[type] = url;\n }\n }\n\n public updateEnv(env: Env): void {\n if (this._job.triggeredBy !== BuildTrigger.GIT_BASED_INTEGRATION) {\n throw new Error(\n 'Updating environment variables is only allowed when build was triggered by a git-based integration.'\n );\n }\n this._env = {\n ...env,\n ...this._env,\n __EAS_BUILD_ENVS_DIR: this.buildEnvsDirectory,\n };\n this._env.PATH = this._env.PATH\n ? [this.buildExecutablesDirectory, this._env.PATH].join(':')\n : this.buildExecutablesDirectory;\n }\n\n public updateJobInformation(job: TJob, metadata: Metadata): void {\n if (this._job.triggeredBy !== BuildTrigger.GIT_BASED_INTEGRATION) {\n throw new Error(\n 'Updating job information is only allowed when build was triggered by a git-based integration.'\n );\n }\n this._job = { ...job, triggeredBy: this._job.triggeredBy };\n this._metadata = metadata;\n }\n\n private async handleBuildPhaseErrorAsync(\n err: any,\n buildPhase: BuildPhase\n ): Promise<errors.BuildError> {\n const buildError = await resolveBuildPhaseErrorAsync(\n err,\n this.logBuffer.getPhaseLogs(buildPhase),\n {\n job: this.job,\n phase: buildPhase,\n env: this.env,\n },\n this.buildLogsDirectory\n );\n if (buildError.errorCode === errors.ErrorCode.UNKNOWN_ERROR) {\n // leaving message empty, website will display err.stack which already includes err.message\n this.logger.error({ err }, '');\n } else {\n this.logger.error(`Error: ${buildError.userFacingMessage}`);\n }\n return buildError;\n }\n\n public getReactNativeProjectDirectory(baseDirectory = this.buildDirectory): string {\n return path.join(baseDirectory, this.job.projectRootDirectory ?? '.');\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 async endCurrentBuildPhaseAsync({\n result,\n doNotMarkEnd = false,\n durationMs,\n }: {\n result: BuildPhaseResult;\n doNotMarkEnd?: boolean;\n durationMs: number;\n }): Promise<void> {\n if (!this.buildPhase) {\n return;\n }\n await this.collectAndUpdateEnvVariablesAsync();\n\n this.reportBuildPhaseStats?.({ buildPhase: this.buildPhase, result, durationMs });\n\n if (!doNotMarkEnd) {\n this.logger.info(\n { marker: LogMarker.END_PHASE, result, durationMs },\n `End phase: ${this.buildPhase}`\n );\n }\n this.logger = this.defaultLogger;\n this.buildPhase = undefined;\n this.buildPhaseSkipped = false;\n this.buildPhaseHasWarnings = false;\n }\n\n private async collectAndUpdateEnvVariablesAsync(): Promise<void> {\n const filenames = await fs.readdir(this.buildEnvsDirectory);\n\n const entries = await Promise.all(\n filenames.map(async (basename) => {\n const rawContents = await fs.readFile(\n path.join(this.buildEnvsDirectory, basename),\n 'utf-8'\n );\n return [basename, rawContents];\n })\n );\n await Promise.all(\n filenames.map(async (basename) => {\n await fs.remove(path.join(this.buildEnvsDirectory, basename));\n })\n );\n this._env = {\n ...this._env,\n ...Object.fromEntries(entries),\n };\n }\n\n private getEnvironmentSecrets(job: TJob): Record<string, string> {\n if (!job?.secrets?.environmentSecrets) {\n return {};\n }\n\n const environmentSecrets: Record<string, string> = {};\n for (const { name, type, value } of job.secrets.environmentSecrets) {\n if (type === EnvironmentSecretType.STRING) {\n environmentSecrets[name] = value;\n } else {\n environmentSecrets[name] = createTemporaryEnvironmentSecretFile(\n this.environmentSecretsDirectory,\n value\n );\n }\n }\n return environmentSecrets;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;;;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AC,OAAO,CAAC,kBAAkB,EAAE;YAClE,IAAI,IAAI,KAAK,qCAAqB,CAAC,MAAM,EAAE;gBACzC,kBAAkB,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;aAClC;iBAAM;gBACL,kBAAkB,CAAC,IAAI,CAAC,GAAG,IAAA,yDAAoC,EAC7D,IAAI,CAAC,2BAA2B,EAChC,KAAK,CACN,CAAC;aACH;SACF;QACD,OAAO,kBAAkB,CAAC;IAC5B,CAAC;CACF;AAxSD,oCAwSC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\nimport {\n BuildPhase,\n BuildPhaseResult,\n BuildPhaseStats,\n Job,\n LogMarker,\n Env,\n errors,\n Metadata,\n EnvironmentSecretType,\n} from '@expo/eas-build-job';\nimport { ExpoConfig } from '@expo/config';\nimport { bunyan } from '@expo/logger';\nimport { SpawnPromise, SpawnOptions, SpawnResult } from '@expo/turtle-spawn';\nimport { BuildTrigger } from '@expo/eas-build-job/dist/common';\n\nimport { PackageManager, resolvePackageManager } from './utils/packageManager';\nimport { resolveBuildPhaseErrorAsync } from './buildErrors/detectError';\nimport { readAppConfig } from './utils/appConfig';\nimport { createTemporaryEnvironmentSecretFile } from './utils/environmentSecrets';\n\nexport enum ArtifactType {\n APPLICATION_ARCHIVE = 'APPLICATION_ARCHIVE',\n BUILD_ARTIFACTS = 'BUILD_ARTIFACTS',\n /**\n * @deprecated\n */\n XCODE_BUILD_LOGS = 'XCODE_BUILD_LOGS',\n}\n\nexport type Artifacts = Partial<Record<ArtifactType, string>>;\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 /**\n * @deprecated\n */\n runGlobalExpoCliCommand: (\n args: string[],\n options: SpawnOptions,\n npmVersionAtLeast7: boolean\n ) => SpawnPromise<SpawnResult>;\n uploadArtifacts: (type: ArtifactType, paths: string[], logger: bunyan) => Promise<string | null>;\n reportError?: (\n msg: string,\n err?: Error,\n options?: { tags?: Record<string, string>; extras?: Record<string, string> }\n ) => void;\n reportBuildPhaseStats?: (stats: BuildPhaseStats) => 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 cacheManager?: CacheManager;\n /**\n * @deprecated\n */\n public readonly runGlobalExpoCliCommand: (\n args: string[],\n options: SpawnOptions,\n npmVersionAtLeast7: boolean\n ) => SpawnPromise<SpawnResult>;\n public readonly reportError?: (\n msg: string,\n err?: Error,\n options?: { tags?: Record<string, string>; extras?: Record<string, string> }\n ) => void;\n public readonly skipNativeBuild?: boolean;\n public artifacts: Artifacts = {};\n\n private _env: Env;\n private _job: TJob;\n private _metadata?: Metadata;\n private readonly defaultLogger: bunyan;\n private readonly _uploadArtifacts: (\n type: ArtifactType,\n paths: string[],\n logger: bunyan\n ) => Promise<string | null>;\n private buildPhase?: BuildPhase;\n private buildPhaseSkipped = false;\n private buildPhaseHasWarnings = false;\n private _appConfig?: ExpoConfig;\n private readonly reportBuildPhaseStats?: (stats: BuildPhaseStats) => void;\n\n constructor(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.runGlobalExpoCliCommand = options.runGlobalExpoCliCommand;\n this._uploadArtifacts = options.uploadArtifacts;\n this.reportError = options.reportError;\n this._job = job;\n this._metadata = options.metadata;\n this.skipNativeBuild = options.skipNativeBuild;\n this.reportBuildPhaseStats = options.reportBuildPhaseStats;\n\n const environmentSecrets = this.getEnvironmentSecrets(job);\n this._env = {\n ...options.env,\n ...job?.builderEnvironment?.env,\n ...environmentSecrets,\n __EAS_BUILD_ENVS_DIR: this.buildEnvsDirectory,\n };\n this._env.PATH = this._env.PATH\n ? [this.buildExecutablesDirectory, this._env.PATH].join(':')\n : this.buildExecutablesDirectory;\n }\n\n public get job(): TJob {\n return this._job;\n }\n public get metadata(): Metadata | undefined {\n return this._metadata;\n }\n public get env(): Env {\n return this._env;\n }\n public get buildDirectory(): string {\n return path.join(this.workingdir, 'build');\n }\n public get buildLogsDirectory(): string {\n return path.join(this.workingdir, 'logs');\n }\n /**\n * Directory used to store executables used during regular (non-custom) builds.\n */\n public get buildExecutablesDirectory(): string {\n return path.join(this.workingdir, 'bin');\n }\n /**\n * Directory used to store env variables registered in the current build step.\n * All values stored here will be available in the next build phase as env variables.\n */\n public get buildEnvsDirectory(): string {\n return path.join(this.workingdir, 'env');\n }\n public get environmentSecretsDirectory(): string {\n return path.join(this.workingdir, 'environment-secrets');\n }\n public get packageManager(): PackageManager {\n return resolvePackageManager(this.getReactNativeProjectDirectory());\n }\n public get appConfig(): ExpoConfig {\n if (!this._appConfig) {\n this._appConfig = readAppConfig({\n projectDir: this.getReactNativeProjectDirectory(),\n env: this.env,\n logger: this.logger,\n sdkVersion: this.metadata?.sdkVersion,\n }).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 }: {\n doNotMarkStart?: boolean;\n doNotMarkEnd?: boolean;\n } = {}\n ): Promise<T> {\n let startTimestamp = Date.now();\n try {\n this.setBuildPhase(buildPhase, { doNotMarkStart });\n startTimestamp = Date.now();\n const result = await phase();\n const durationMs = Date.now() - startTimestamp;\n const buildPhaseResult: BuildPhaseResult = this.buildPhaseSkipped\n ? BuildPhaseResult.SKIPPED\n : this.buildPhaseHasWarnings\n ? BuildPhaseResult.WARNING\n : BuildPhaseResult.SUCCESS;\n await this.endCurrentBuildPhaseAsync({ result: buildPhaseResult, doNotMarkEnd, durationMs });\n return result;\n } catch (err: any) {\n const durationMs = Date.now() - startTimestamp;\n const resolvedError = await this.handleBuildPhaseErrorAsync(err, buildPhase);\n await this.endCurrentBuildPhaseAsync({ result: BuildPhaseResult.FAIL, durationMs });\n throw resolvedError;\n }\n }\n\n public markBuildPhaseSkipped(): void {\n this.buildPhaseSkipped = true;\n }\n\n public markBuildPhaseHasWarnings(): void {\n this.buildPhaseHasWarnings = true;\n }\n\n public async uploadArtifacts(type: ArtifactType, paths: string[], logger: bunyan): Promise<void> {\n const url = await this._uploadArtifacts(type, paths, logger);\n if (url) {\n this.artifacts[type] = url;\n }\n }\n\n public updateEnv(env: Env): void {\n if (this._job.triggeredBy !== BuildTrigger.GIT_BASED_INTEGRATION) {\n throw new Error(\n 'Updating environment variables is only allowed when build was triggered by a git-based integration.'\n );\n }\n this._env = {\n ...env,\n ...this._env,\n __EAS_BUILD_ENVS_DIR: this.buildEnvsDirectory,\n };\n this._env.PATH = this._env.PATH\n ? [this.buildExecutablesDirectory, this._env.PATH].join(':')\n : this.buildExecutablesDirectory;\n }\n\n public updateJobInformation(job: TJob, metadata: Metadata): void {\n if (this._job.triggeredBy !== BuildTrigger.GIT_BASED_INTEGRATION) {\n throw new Error(\n 'Updating job information is only allowed when build was triggered by a git-based integration.'\n );\n }\n this._job = { ...job, triggeredBy: this._job.triggeredBy };\n this._metadata = metadata;\n }\n\n private async handleBuildPhaseErrorAsync(\n err: any,\n buildPhase: BuildPhase\n ): Promise<errors.BuildError> {\n const buildError = await resolveBuildPhaseErrorAsync(\n err,\n this.logBuffer.getPhaseLogs(buildPhase),\n {\n job: this.job,\n phase: buildPhase,\n env: this.env,\n },\n this.buildLogsDirectory\n );\n if (buildError.errorCode === errors.ErrorCode.UNKNOWN_ERROR) {\n // leaving message empty, website will display err.stack which already includes err.message\n this.logger.error({ err }, '');\n } else {\n this.logger.error(`Error: ${buildError.userFacingMessage}`);\n }\n return buildError;\n }\n\n public getReactNativeProjectDirectory(baseDirectory = this.buildDirectory): string {\n return path.join(baseDirectory, this.job.projectRootDirectory ?? '.');\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 async endCurrentBuildPhaseAsync({\n result,\n doNotMarkEnd = false,\n durationMs,\n }: {\n result: BuildPhaseResult;\n doNotMarkEnd?: boolean;\n durationMs: number;\n }): Promise<void> {\n if (!this.buildPhase) {\n return;\n }\n await this.collectAndUpdateEnvVariablesAsync();\n\n this.reportBuildPhaseStats?.({ buildPhase: this.buildPhase, result, durationMs });\n\n if (!doNotMarkEnd) {\n this.logger.info(\n { marker: LogMarker.END_PHASE, result, durationMs },\n `End phase: ${this.buildPhase}`\n );\n }\n this.logger = this.defaultLogger;\n this.buildPhase = undefined;\n this.buildPhaseSkipped = false;\n this.buildPhaseHasWarnings = false;\n }\n\n private async collectAndUpdateEnvVariablesAsync(): Promise<void> {\n const filenames = await fs.readdir(this.buildEnvsDirectory);\n\n const entries = await Promise.all(\n filenames.map(async (basename) => {\n const rawContents = await fs.readFile(\n path.join(this.buildEnvsDirectory, basename),\n 'utf-8'\n );\n return [basename, rawContents];\n })\n );\n await Promise.all(\n filenames.map(async (basename) => {\n await fs.remove(path.join(this.buildEnvsDirectory, basename));\n })\n );\n this._env = {\n ...this._env,\n ...Object.fromEntries(entries),\n };\n }\n\n private getEnvironmentSecrets(job: TJob): Record<string, string> {\n if (!job?.secrets?.environmentSecrets) {\n return {};\n }\n\n const environmentSecrets: Record<string, string> = {};\n for (const { name, type, value } of job.secrets.environmentSecrets) {\n if (type === EnvironmentSecretType.STRING) {\n environmentSecrets[name] = value;\n } else {\n environmentSecrets[name] = createTemporaryEnvironmentSecretFile(\n this.environmentSecretsDirectory,\n value\n );\n }\n }\n return environmentSecrets;\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="bunyan" />
|
|
2
|
-
import { Env, Job } from '@expo/eas-build-job';
|
|
2
|
+
import { Env, Job, Metadata } from '@expo/eas-build-job';
|
|
3
3
|
import { bunyan } from '@expo/logger';
|
|
4
4
|
import { ExternalBuildContextProvider, BuildRuntimePlatform } from '@expo/steps';
|
|
5
5
|
import { ArtifactType, BuildContext } from './context';
|
|
@@ -14,6 +14,7 @@ export declare class CustomBuildContext implements ExternalBuildContextProvider
|
|
|
14
14
|
readonly logger: bunyan;
|
|
15
15
|
readonly runtimeApi: BuilderRuntimeApi;
|
|
16
16
|
readonly job: Job;
|
|
17
|
+
readonly metadata?: Metadata;
|
|
17
18
|
private _env;
|
|
18
19
|
constructor(buildCtx: BuildContext<Job>);
|
|
19
20
|
get runtimePlatform(): BuildRuntimePlatform;
|
|
@@ -15,6 +15,7 @@ class CustomBuildContext {
|
|
|
15
15
|
constructor(buildCtx) {
|
|
16
16
|
this._env = buildCtx.env;
|
|
17
17
|
this.job = buildCtx.job;
|
|
18
|
+
this.metadata = buildCtx.metadata;
|
|
18
19
|
this.logger = buildCtx.logger.child({ phase: eas_build_job_1.BuildPhase.CUSTOM });
|
|
19
20
|
this.projectSourceDirectory = path_1.default.join(buildCtx.workingdir, 'temporary-custom-build');
|
|
20
21
|
this.projectTargetDirectory = path_1.default.join(buildCtx.workingdir, 'build');
|
|
@@ -33,6 +34,7 @@ class CustomBuildContext {
|
|
|
33
34
|
staticContext() {
|
|
34
35
|
return {
|
|
35
36
|
job: this.job,
|
|
37
|
+
metadata: this.metadata,
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
updateEnv(env) {
|
|
@@ -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,uDAA+E;AAE/E,uCAAiF;AAIjF,MAAM,8BAA8B,GAA2C;IAC7E,CAAC,wBAAQ,CAAC,OAAO,CAAC,EAAE,4BAAoB,CAAC,KAAK;IAC9C,CAAC,wBAAQ,CAAC,GAAG,CAAC,EAAE,4BAAoB,CAAC,MAAM;CAC5C,CAAC;AAMF,MAAa,kBAAkB;IA4B7B,YAAY,QAA2B;QACrC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAElC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,0BAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,sBAAsB,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC;QACvF,IAAI,CAAC,sBAAsB,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACtE,IAAI,CAAC,uBAAuB,GAAG,QAAQ,CAAC,8BAA8B,EAAE,CAAC;QACzE,IAAI,CAAC,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACjE,IAAI,CAAC,UAAU,GAAG;YAChB,eAAe,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,GAAG,IAAI,CAAC;SACnE,CAAC;IACJ,CAAC;IAED,IAAW,eAAe;QACxB,OAAO,8BAA8B,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAEM,aAAa;QAClB,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;IACJ,CAAC;IAEM,SAAS,CAAC,GAAQ;QACvB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;CACF;AA7DD,gDA6DC","sourcesContent":["import path from 'path';\n\nimport { BuildPhase, Env, Job, Metadata, Platform } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport { ExternalBuildContextProvider, BuildRuntimePlatform } from '@expo/steps';\n\nimport { ArtifactType, 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 uploadArtifacts: (type: ArtifactType, paths: string[], 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 readonly job: Job;\n public readonly 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 uploadArtifacts: (...args) => buildCtx['uploadArtifacts'](...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"]}
|
|
@@ -29,11 +29,17 @@ function configureEASUpdateIfInstalledFunction() {
|
|
|
29
29
|
fn: async (stepCtx, { env, inputs }) => {
|
|
30
30
|
(0, assert_1.default)(stepCtx.global.staticContext.job, 'Job is not defined');
|
|
31
31
|
const job = stepCtx.global.staticContext.job;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const metadata = stepCtx.global.staticContext.metadata;
|
|
33
|
+
const appConfig = (0, appConfig_1.readAppConfig)({
|
|
34
|
+
projectDir: stepCtx.workingDirectory,
|
|
35
|
+
env: Object.keys(env).reduce((acc, key) => {
|
|
36
|
+
var _a;
|
|
37
|
+
acc[key] = (_a = env[key]) !== null && _a !== void 0 ? _a : '';
|
|
38
|
+
return acc;
|
|
39
|
+
}, {}),
|
|
40
|
+
logger: stepCtx.logger,
|
|
41
|
+
sdkVersion: metadata === null || metadata === void 0 ? void 0 : metadata.sdkVersion,
|
|
42
|
+
}).exp;
|
|
37
43
|
const releaseChannelInput = inputs.channel.value;
|
|
38
44
|
const runtimeVersionInput = inputs.runtime_version.value;
|
|
39
45
|
if (runtimeVersionInput && !semver_1.default.valid(runtimeVersionInput)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configureEASUpdateIfInstalled.js","sourceRoot":"","sources":["../../../src/steps/functions/configureEASUpdateIfInstalled.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uCAAyF;AAEzF,oDAA4B;AAE5B,sDAA0E;AAC1E,qDAAsD;AAEtD,SAAgB,qCAAqC;IACnD,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,sBAAsB;QAC1B,IAAI,EAAE,sBAAsB;QAC5B,cAAc,EAAE;YACd,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,iBAAiB;gBACrB,QAAQ,EAAE,KAAK;gBACf,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;aACzD,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,SAAS;gBACb,QAAQ,EAAE,KAAK;gBACf,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;aACzD,CAAC;SACH;QACD,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;YACrC,IAAA,gBAAM,EAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;YAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,GAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"configureEASUpdateIfInstalled.js","sourceRoot":"","sources":["../../../src/steps/functions/configureEASUpdateIfInstalled.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uCAAyF;AAEzF,oDAA4B;AAE5B,sDAA0E;AAC1E,qDAAsD;AAEtD,SAAgB,qCAAqC;IACnD,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAA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AAM,CAAC,eAAe,CAAC,KAA2B,CAAC;YAC/E,IAAI,mBAAmB,IAAI,CAAC,gBAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE;gBAC7D,MAAM,IAAI,KAAK,CACb,0FAA0F,mBAAmB,EAAE,CAChH,CAAC;aACH;YAED,MAAM,IAAA,gDAAkC,EAAC;gBACvC,GAAG;gBACH,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;gBAC1C,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,SAAS;gBACT,MAAM,EAAE;oBACN,cAAc,EAAE,mBAAmB;oBACnC,OAAO,EAAE,mBAAmB;iBAC7B;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AApDD,sFAoDC","sourcesContent":["import assert from 'assert';\n\nimport { BuildFunction, BuildStepInput, BuildStepInputValueTypeName } from '@expo/steps';\nimport { Job, Metadata } from '@expo/eas-build-job';\nimport semver from 'semver';\n\nimport { configureEASUpdateIfInstalledAsync } from '../utils/expoUpdates';\nimport { readAppConfig } from '../../utils/appConfig';\n\nexport function configureEASUpdateIfInstalledFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'configure_eas_update',\n name: 'Configure EAS Update',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'runtime_version',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'channel',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n ],\n fn: async (stepCtx, { env, inputs }) => {\n assert(stepCtx.global.staticContext.job, 'Job is not defined');\n const job = stepCtx.global.staticContext.job as Job;\n const metadata = stepCtx.global.staticContext.metadata as Metadata | undefined;\n\n const appConfig = readAppConfig({\n projectDir: stepCtx.workingDirectory,\n env: Object.keys(env).reduce((acc, key) => {\n acc[key] = env[key] ?? '';\n return acc;\n }, {} as Record<string, string>),\n logger: stepCtx.logger,\n sdkVersion: metadata?.sdkVersion,\n }).exp;\n\n const releaseChannelInput = inputs.channel.value as string | undefined;\n const runtimeVersionInput = inputs.runtime_version.value as string | undefined;\n if (runtimeVersionInput && !semver.valid(runtimeVersionInput)) {\n throw new Error(\n `Runtime version provided by the \"runtime_version\" input is not a valid semver version: ${releaseChannelInput}`\n );\n }\n\n await configureEASUpdateIfInstalledAsync({\n job,\n workingDirectory: stepCtx.workingDirectory,\n logger: stepCtx.logger,\n appConfig,\n inputs: {\n runtimeVersion: runtimeVersionInput,\n channel: releaseChannelInput,\n },\n });\n },\n });\n}\n"]}
|
|
@@ -2,4 +2,9 @@
|
|
|
2
2
|
import { ProjectConfig } from '@expo/config';
|
|
3
3
|
import { Env } from '@expo/eas-build-job';
|
|
4
4
|
import { bunyan } from '@expo/logger';
|
|
5
|
-
export declare function readAppConfig(projectDir
|
|
5
|
+
export declare function readAppConfig({ projectDir, env, logger, sdkVersion, }: {
|
|
6
|
+
projectDir: string;
|
|
7
|
+
env: Env;
|
|
8
|
+
logger: bunyan;
|
|
9
|
+
sdkVersion?: string;
|
|
10
|
+
}): ProjectConfig;
|
package/dist/utils/appConfig.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.readAppConfig = void 0;
|
|
4
7
|
const config_1 = require("@expo/config");
|
|
5
8
|
const logger_1 = require("@expo/logger");
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
const env_1 = require("@expo/env");
|
|
10
|
+
const semver_1 = __importDefault(require("semver"));
|
|
11
|
+
function readAppConfig({ projectDir, env, logger, sdkVersion, }) {
|
|
8
12
|
const originalProcessExit = process.exit;
|
|
9
13
|
const originalProcessCwd = process.cwd;
|
|
10
14
|
const originalStdoutWrite = process.stdout.write;
|
|
11
15
|
const originalStderrWrite = process.stderr.write;
|
|
16
|
+
const originalProcessEnv = process.env;
|
|
12
17
|
const stdoutStore = [];
|
|
18
|
+
const shouldLoadEnvVarsFromDotenvFile = sdkVersion && semver_1.default.satisfies(sdkVersion, '>=49');
|
|
19
|
+
const envVarsFromDotenvFile = shouldLoadEnvVarsFromDotenvFile ? (0, env_1.load)(projectDir) : {};
|
|
20
|
+
const newEnvsToUse = { ...env, ...envVarsFromDotenvFile };
|
|
13
21
|
try {
|
|
14
|
-
|
|
22
|
+
for (const [key, value] of Object.entries(newEnvsToUse)) {
|
|
23
|
+
process.env[key] = value;
|
|
24
|
+
}
|
|
15
25
|
process.exit = () => {
|
|
16
26
|
throw new Error('Failed to evaluate app config file');
|
|
17
27
|
};
|
|
@@ -38,7 +48,12 @@ function readAppConfig(projectDir, env, logger) {
|
|
|
38
48
|
throw err;
|
|
39
49
|
}
|
|
40
50
|
finally {
|
|
41
|
-
|
|
51
|
+
for (const [key] of Object.entries(newEnvsToUse)) {
|
|
52
|
+
delete process.env[key];
|
|
53
|
+
}
|
|
54
|
+
for (const [key, value] of Object.entries(originalProcessEnv)) {
|
|
55
|
+
process.env[key] = value;
|
|
56
|
+
}
|
|
42
57
|
process.exit = originalProcessExit;
|
|
43
58
|
process.cwd = originalProcessCwd;
|
|
44
59
|
process.stdout.write = originalStdoutWrite;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appConfig.js","sourceRoot":"","sources":["../../src/utils/appConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"appConfig.js","sourceRoot":"","sources":["../../src/utils/appConfig.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAwD;AAExD,yCAAmD;AACnD,mCAAiC;AACjC,oDAA4B;AAE5B,SAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,GAAG,EACH,MAAM,EACN,UAAU,GAMX;IACC,MAAM,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IACzC,MAAM,kBAAkB,GAA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C;AACH,CAAC;AA5DD,sCA4DC","sourcesContent":["import { getConfig, ProjectConfig } from '@expo/config';\nimport { Env } from '@expo/eas-build-job';\nimport { bunyan, LoggerLevel } from '@expo/logger';\nimport { load } from '@expo/env';\nimport semver from 'semver';\n\nexport function readAppConfig({\n projectDir,\n env,\n logger,\n sdkVersion,\n}: {\n projectDir: string;\n env: Env;\n logger: bunyan;\n sdkVersion?: string;\n}): ProjectConfig {\n const originalProcessExit = process.exit;\n const originalProcessCwd = process.cwd;\n const originalStdoutWrite = process.stdout.write;\n const originalStderrWrite = process.stderr.write;\n const originalProcessEnv = process.env;\n\n const stdoutStore: { text: string; level: LoggerLevel }[] = [];\n const shouldLoadEnvVarsFromDotenvFile = sdkVersion && semver.satisfies(sdkVersion, '>=49');\n const envVarsFromDotenvFile = shouldLoadEnvVarsFromDotenvFile ? load(projectDir) : {};\n const newEnvsToUse = { ...env, ...envVarsFromDotenvFile };\n try {\n for (const [key, value] of Object.entries(newEnvsToUse)) {\n process.env[key] = value;\n }\n process.exit = () => {\n throw new Error('Failed to evaluate app config file');\n };\n process.cwd = () => projectDir;\n process.stdout.write = function (...args: any) {\n stdoutStore.push({ text: String(args[0]), level: LoggerLevel.INFO });\n return originalStdoutWrite.apply(process.stdout, args);\n };\n process.stderr.write = function (...args: any) {\n stdoutStore.push({ text: String(args[0]), level: LoggerLevel.ERROR });\n return originalStderrWrite.apply(process.stderr, args);\n };\n return getConfig(projectDir, {\n skipSDKVersionRequirement: true,\n isPublicConfig: true,\n });\n } catch (err) {\n process.stdout.write = originalStdoutWrite;\n process.stderr.write = originalStderrWrite;\n stdoutStore.forEach(({ text, level }) => {\n logger[level](text.trim());\n });\n throw err;\n } finally {\n for (const [key] of Object.entries(newEnvsToUse)) {\n delete process.env[key];\n }\n for (const [key, value] of Object.entries(originalProcessEnv)) {\n process.env[key] = value;\n }\n process.exit = originalProcessExit;\n process.cwd = originalProcessCwd;\n process.stdout.write = originalStdoutWrite;\n process.stderr.write = originalStderrWrite;\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.53",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -25,12 +25,13 @@
|
|
|
25
25
|
"@expo/config-plugins": "^7.2.4",
|
|
26
26
|
"@expo/downloader": "1.0.37",
|
|
27
27
|
"@expo/eas-build-job": "1.0.50",
|
|
28
|
-
"@expo/
|
|
28
|
+
"@expo/env": "^0.0.5",
|
|
29
|
+
"@expo/logger": "1.0.52",
|
|
29
30
|
"@expo/package-manager": "1.1.2",
|
|
30
31
|
"@expo/plist": "^0.0.20",
|
|
31
|
-
"@expo/steps": "1.0.
|
|
32
|
+
"@expo/steps": "1.0.52",
|
|
32
33
|
"@expo/template-file": "1.0.37",
|
|
33
|
-
"@expo/turtle-spawn": "1.0.
|
|
34
|
+
"@expo/turtle-spawn": "1.0.52",
|
|
34
35
|
"@expo/xcpretty": "^4.2.2",
|
|
35
36
|
"fast-glob": "^3.3.1",
|
|
36
37
|
"fs-extra": "^11.1.1",
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"node": "18.13.0",
|
|
66
67
|
"yarn": "1.22.19"
|
|
67
68
|
},
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "693d682b3130a8a80eba3ba62282f69e5a6a3304"
|
|
69
70
|
}
|