@expo/build-tools 1.0.16 → 1.0.18
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 +1 -1
- package/dist/builders/custom.js.map +1 -1
- package/dist/common/installDependencies.d.ts +2 -1
- package/dist/common/installDependencies.js +4 -4
- package/dist/common/installDependencies.js.map +1 -1
- package/dist/common/prebuild.js +1 -1
- package/dist/common/prebuild.js.map +1 -1
- package/dist/common/setup.js +35 -8
- package/dist/common/setup.js.map +1 -1
- package/dist/steps/easFunctions.js +8 -1
- package/dist/steps/easFunctions.js.map +1 -1
- package/dist/steps/functions/checkout.js +1 -1
- package/dist/steps/functions/checkout.js.map +1 -1
- package/dist/steps/functions/installNodeModules.d.ts +4 -0
- package/dist/steps/functions/installNodeModules.js +17 -0
- package/dist/steps/functions/installNodeModules.js.map +1 -0
- package/dist/steps/functions/setUpNpmrc.d.ts +4 -0
- package/dist/steps/functions/setUpNpmrc.js +17 -0
- package/dist/steps/functions/setUpNpmrc.js.map +1 -0
- package/dist/utils/npmrc.d.ts +2 -2
- package/dist/utils/npmrc.js +17 -10
- package/dist/utils/npmrc.js.map +1 -1
- package/package.json +3 -3
package/dist/builders/custom.js
CHANGED
|
@@ -19,7 +19,7 @@ async function runCustomBuildAsync(ctx) {
|
|
|
19
19
|
await (0, projectSources_1.prepareProjectSourcesAsync)(ctx, ctx.temporaryCustomBuildDirectory);
|
|
20
20
|
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');
|
|
21
21
|
const configPath = path_1.default.join(ctx.getReactNativeProjectDirectory(ctx.temporaryCustomBuildDirectory), relativeConfigPath);
|
|
22
|
-
const buildStepContext = new steps_1.BuildStepContext(ctx.env.EAS_BUILD_ID, ctx.logger.child({ phase: eas_build_job_1.BuildPhase.CUSTOM }), false, platformToBuildRuntimePlatform[ctx.job.platform], ctx.temporaryCustomBuildDirectory, ctx.buildDirectory);
|
|
22
|
+
const buildStepContext = new steps_1.BuildStepContext(ctx.env.EAS_BUILD_ID, ctx.logger.child({ phase: eas_build_job_1.BuildPhase.CUSTOM }), false, platformToBuildRuntimePlatform[ctx.job.platform], ctx.temporaryCustomBuildDirectory, ctx.buildDirectory, ctx.getReactNativeProjectDirectory());
|
|
23
23
|
const easFunctions = (0, easFunctions_1.getEasFunctions)(ctx);
|
|
24
24
|
const parser = new steps_1.BuildConfigParser(buildStepContext, {
|
|
25
25
|
configPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/builders/custom.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAAgE;AAChE,uCAAgG;AAChG,4DAAoC;AAGpC,6DAAsE;AACtE,wDAAwD;AAExD,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;AAEK,KAAK,UAAU,mBAAmB,CAAgB,GAAoB;;IAC3E,MAAM,IAAA,2CAA0B,EAAC,GAAG,EAAE,GAAG,CAAC,6BAA6B,CAAC,CAAC;IACzE,MAAM,kBAAkB,GAAG,IAAA,oBAAU,EACnC,MAAA,GAAG,CAAC,GAAG,CAAC,iBAAiB,0CAAE,IAAI,EAC/B,uDAAuD,CACxD,CAAC;IACF,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAC1B,GAAG,CAAC,8BAA8B,CAAC,GAAG,CAAC,6BAA6B,CAAC,EACrE,kBAAkB,CACnB,CAAC;IAEF,MAAM,gBAAgB,GAAG,IAAI,wBAAgB,CAC3C,GAAG,CAAC,GAAG,CAAC,YAAY,EACpB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,0BAAU,CAAC,MAA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G,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,yBAAiB,CAAC,gBAAgB,EAAE;QACrD,UAAU;QACV,iBAAiB,EAAE,YAAY;KAChC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC3F,IAAI;YACF,OAAO,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;SAClC;QAAC,OAAO,UAAe,EAAE;YACxB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;YAClE,IAAI,UAAU,YAAY,cAAM,CAAC,kBAAkB,EAAE;gBACnD,KAAK,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE;oBACnC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;iBAC3B;aACF;YACD,MAAM,UAAU,CAAC;SAClB;IACH,CAAC,CAAC,CAAC;IACH,IAAI;QACF,MAAM,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACtC;IAAC,OAAO,GAAQ,EAAE;QACjB,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QAC9B,MAAM,GAAG,CAAC;KACX;IAED,OAAO,GAAG,CAAC,SAAS,CAAC;AACvB,CAAC;AA9CD,kDA8CC","sourcesContent":["import path from 'path';\n\nimport { BuildPhase, Job, Platform } from '@expo/eas-build-job';\nimport { BuildConfigParser, BuildStepContext, errors, BuildRuntimePlatform } from '@expo/steps';\nimport nullthrows from 'nullthrows';\n\nimport { Artifacts, BuildContext } from '../context';\nimport { prepareProjectSourcesAsync } from '../common/projectSources';\nimport { getEasFunctions } from '../steps/easFunctions';\n\nconst platformToBuildRuntimePlatform: Record<Platform, BuildRuntimePlatform> = {\n [Platform.ANDROID]: BuildRuntimePlatform.LINUX,\n [Platform.IOS]: BuildRuntimePlatform.DARWIN,\n};\n\nexport async function runCustomBuildAsync<T extends Job>(ctx: BuildContext<T>): Promise<Artifacts> {\n await prepareProjectSourcesAsync(ctx, ctx.temporaryCustomBuildDirectory);\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(ctx.temporaryCustomBuildDirectory),\n relativeConfigPath\n );\n\n const buildStepContext = new BuildStepContext(\n ctx.env.EAS_BUILD_ID,\n ctx.logger.child({ phase: BuildPhase.CUSTOM }),\n false,\n platformToBuildRuntimePlatform[ctx.job.platform],\n ctx.temporaryCustomBuildDirectory,\n ctx.buildDirectory,\n ctx.getReactNativeProjectDirectory()\n );\n const easFunctions = getEasFunctions(ctx);\n const parser = new BuildConfigParser(buildStepContext, {\n configPath,\n externalFunctions: easFunctions,\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(ctx.env);\n } catch (err: any) {\n err.artifacts = ctx.artifacts;\n throw err;\n }\n\n return ctx.artifacts;\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Job } from '@expo/eas-build-job';
|
|
2
|
+
import { bunyan } from '@expo/logger';
|
|
2
3
|
import { BuildContext } from '../context';
|
|
3
|
-
export declare function installDependenciesAsync<TJob extends Job>(ctx: BuildContext<TJob
|
|
4
|
+
export declare function installDependenciesAsync<TJob extends Job>(ctx: BuildContext<TJob>, logger: bunyan): Promise<void>;
|
|
@@ -8,11 +8,11 @@ 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) {
|
|
11
|
+
async function installDependenciesAsync(ctx, logger) {
|
|
12
12
|
const packagerRunDir = (0, packageManager_1.findPackagerRootDir)(ctx.getReactNativeProjectDirectory());
|
|
13
13
|
if (packagerRunDir !== ctx.getReactNativeProjectDirectory()) {
|
|
14
14
|
const relativeReactNativeProjectDirectory = path_1.default.relative(ctx.buildDirectory, ctx.getReactNativeProjectDirectory());
|
|
15
|
-
|
|
15
|
+
logger.info(`We detected that '${relativeReactNativeProjectDirectory}' is a ${ctx.packageManager} workspace`);
|
|
16
16
|
}
|
|
17
17
|
const relativePackagerRunDir = path_1.default.relative(ctx.buildDirectory, packagerRunDir);
|
|
18
18
|
let args = ['install'];
|
|
@@ -25,12 +25,12 @@ async function installDependenciesAsync(ctx) {
|
|
|
25
25
|
args = ['install', '--no-immutable'];
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
logger.info(`Running "${ctx.packageManager} ${args.join(' ')}" in ${relativePackagerRunDir
|
|
29
29
|
? `directory '${relativePackagerRunDir}'`
|
|
30
30
|
: 'the root dir of your repository'} `);
|
|
31
31
|
await (0, turtle_spawn_1.default)(ctx.packageManager, args, {
|
|
32
32
|
cwd: packagerRunDir,
|
|
33
|
-
logger
|
|
33
|
+
logger,
|
|
34
34
|
env: ctx.env,
|
|
35
35
|
});
|
|
36
36
|
}
|
|
@@ -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;AAIxB,sEAAuC;AAGvC,4DAA8E;AAC9E,8CAAgD;AAEzC,KAAK,UAAU,wBAAwB,CAC5C,GAAu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qCC","sourcesContent":["import path from 'path';\n\nimport { Job } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport spawn from '@expo/turtle-spawn';\n\nimport { BuildContext } from '../context';\nimport { findPackagerRootDir, PackageManager } from '../utils/packageManager';\nimport { isUsingYarn2 } from '../utils/project';\n\nexport async function installDependenciesAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n logger: bunyan\n): Promise<void> {\n const packagerRunDir = findPackagerRootDir(ctx.getReactNativeProjectDirectory());\n if (packagerRunDir !== ctx.getReactNativeProjectDirectory()) {\n const relativeReactNativeProjectDirectory = path.relative(\n ctx.buildDirectory,\n ctx.getReactNativeProjectDirectory()\n );\n logger.info(\n `We detected that '${relativeReactNativeProjectDirectory}' is a ${ctx.packageManager} workspace`\n );\n }\n\n const relativePackagerRunDir = path.relative(ctx.buildDirectory, packagerRunDir);\n let args = ['install'];\n if (ctx.packageManager === PackageManager.PNPM) {\n args = ['install', '--no-frozen-lockfile'];\n } else if (ctx.packageManager === PackageManager.YARN) {\n const isYarn2 = await isUsingYarn2(ctx.getReactNativeProjectDirectory());\n if (isYarn2) {\n args = ['install', '--no-immutable'];\n }\n }\n logger.info(\n `Running \"${ctx.packageManager} ${args.join(' ')}\" in ${\n relativePackagerRunDir\n ? `directory '${relativePackagerRunDir}'`\n : 'the root dir of your repository'\n } `\n );\n await spawn(ctx.packageManager, args, {\n cwd: packagerRunDir,\n logger,\n env: ctx.env,\n });\n}\n"]}
|
package/dist/common/prebuild.js
CHANGED
|
@@ -25,7 +25,7 @@ async function prebuildAsync(ctx, 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
|
+
await (0, installDependencies_1.installDependenciesAsync)(ctx, ctx.logger);
|
|
29
29
|
}
|
|
30
30
|
exports.prebuildAsync = prebuildAsync;
|
|
31
31
|
function getPrebuildCommandArgs(ctx) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prebuild.js","sourceRoot":"","sources":["../../src/common/prebuild.ts"],"names":[],"mappings":";;;;;;AAEA,oDAA4B;AAG5B,4DAA6D;AAC7D,8CAA6E;AAE7E,+DAAiE;AAM1D,KAAK,UAAU,aAAa,CACjC,GAAuB,EACvB,OAAyB;;IAEzB,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,GAAG,CAAC,8BAA8B,EAAE;QACzC,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,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,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"prebuild.js","sourceRoot":"","sources":["../../src/common/prebuild.ts"],"names":[],"mappings":";;;;;;AAEA,oDAA4B;AAG5B,4DAA6D;AAC7D,8CAA6E;AAE7E,+DAAiE;AAM1D,KAAK,UAAU,aA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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';\n\nimport { BuildContext } from '../context';\nimport { isAtLeastNpm7Async } from '../utils/packageManager';\nimport { runExpoCliCommand, shouldUseGlobalExpoCli } from '../utils/project';\n\nimport { installDependenciesAsync } 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 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: ctx.getReactNativeProjectDirectory(),\n logger: ctx.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 await installDependenciesAsync(ctx, ctx.logger);\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
|
@@ -4,10 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.setupAsync = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
7
8
|
const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
|
|
9
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
10
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
9
11
|
const common_1 = require("@expo/eas-build-job/dist/common");
|
|
10
12
|
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
13
|
+
const errors_1 = require("@expo/eas-build-job/dist/errors");
|
|
11
14
|
const xcodeEnv_1 = require("../ios/xcodeEnv");
|
|
12
15
|
const hooks_1 = require("../utils/hooks");
|
|
13
16
|
const npmrc_1 = require("../utils/npmrc");
|
|
@@ -24,12 +27,7 @@ async function setupAsync(ctx) {
|
|
|
24
27
|
var _a;
|
|
25
28
|
const packageJson = await ctx.runBuildPhase(eas_build_job_1.BuildPhase.PREPARE_PROJECT, async () => {
|
|
26
29
|
await (0, projectSources_1.prepareProjectSourcesAsync)(ctx);
|
|
27
|
-
|
|
28
|
-
await (0, npmrc_1.createNpmrcIfNotExistsAsync)(ctx);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
await (0, npmrc_1.logIfNpmrcExistsAsync)(ctx);
|
|
32
|
-
}
|
|
30
|
+
await (0, npmrc_1.setUpNpmrcAsync)(ctx, ctx.logger);
|
|
33
31
|
if (ctx.job.platform === eas_build_job_1.Platform.IOS && ctx.env.EAS_BUILD_RUNNER === 'eas-build') {
|
|
34
32
|
await (0, xcodeEnv_1.deleteXcodeEnvLocalIfExistsAsync)(ctx);
|
|
35
33
|
}
|
|
@@ -49,7 +47,7 @@ async function setupAsync(ctx) {
|
|
|
49
47
|
ctx.logger.info(JSON.stringify(packageJson, null, 2));
|
|
50
48
|
});
|
|
51
49
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.INSTALL_DEPENDENCIES, async () => {
|
|
52
|
-
await (0, installDependencies_1.installDependenciesAsync)(ctx);
|
|
50
|
+
await (0, installDependencies_1.installDependenciesAsync)(ctx, ctx.logger);
|
|
53
51
|
});
|
|
54
52
|
if (ctx.job.triggeredBy === common_1.BuildTrigger.GIT_BASED_INTEGRATION) {
|
|
55
53
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.EAS_BUILD_INTERNAL, async () => {
|
|
@@ -57,8 +55,10 @@ async function setupAsync(ctx) {
|
|
|
57
55
|
});
|
|
58
56
|
}
|
|
59
57
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.READ_APP_CONFIG, async () => {
|
|
58
|
+
const appConfig = ctx.appConfig;
|
|
60
59
|
ctx.logger.info('Using app configuration:');
|
|
61
|
-
ctx.logger.info(JSON.stringify(
|
|
60
|
+
ctx.logger.info(JSON.stringify(appConfig, null, 2));
|
|
61
|
+
await validateAppConfigAsync(ctx, appConfig);
|
|
62
62
|
});
|
|
63
63
|
const hasExpoPackage = !!((_a = packageJson.dependencies) === null || _a === void 0 ? void 0 : _a.expo);
|
|
64
64
|
if (hasExpoPackage) {
|
|
@@ -130,4 +130,31 @@ async function runExpoDoctor(ctx) {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
+
async function validateAppConfigAsync(ctx, appConfig) {
|
|
134
|
+
var _a, _b, _c, _d;
|
|
135
|
+
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) &&
|
|
136
|
+
ctx.env.EAS_BUILD_PROJECT_ID &&
|
|
137
|
+
appConfig.extra.eas.projectId !== ctx.env.EAS_BUILD_PROJECT_ID) {
|
|
138
|
+
const isUsingDynamicConfig = (await fs_extra_1.default.pathExists(path_1.default.join(ctx.getReactNativeProjectDirectory(), 'app.config.ts'))) ||
|
|
139
|
+
(await fs_extra_1.default.pathExists(path_1.default.join(ctx.getReactNativeProjectDirectory(), 'app.config.js')));
|
|
140
|
+
const isGitHubBuild = ctx.job.triggeredBy === common_1.BuildTrigger.GIT_BASED_INTEGRATION;
|
|
141
|
+
let extraMessage = '';
|
|
142
|
+
if (isGitHubBuild && isUsingDynamicConfig) {
|
|
143
|
+
extraMessage =
|
|
144
|
+
'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. ';
|
|
145
|
+
}
|
|
146
|
+
else if (isGitHubBuild) {
|
|
147
|
+
extraMessage = 'Make sure you connected your GitHub repository to the correct Expo project. ';
|
|
148
|
+
}
|
|
149
|
+
else if (isUsingDynamicConfig) {
|
|
150
|
+
extraMessage =
|
|
151
|
+
'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. ';
|
|
152
|
+
}
|
|
153
|
+
throw new errors_1.UserFacingError('EAS_BUILD_PROJECT_ID_MISMATCH', `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.`);
|
|
154
|
+
}
|
|
155
|
+
else if (ctx.env.EAS_BUILD_PROJECT_ID && !((_d = (_c = appConfig === null || appConfig === void 0 ? void 0 : appConfig.extra) === null || _c === void 0 ? void 0 : _c.eas) === null || _d === void 0 ? void 0 : _d.projectId)) {
|
|
156
|
+
ctx.logger.error(`The "extra.eas.projectId" field is missing from your app config.`);
|
|
157
|
+
ctx.markBuildPhaseHasWarnings();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
133
160
|
//# sourceMappingURL=setup.js.map
|
package/dist/common/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/common/setup.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAsE;AACtE,uDAAqE;AACrE,4DAA+D;AAC/D,4DAAoC;AAGpC,8CAAmE;AACnE,0CAAwD;AACxD,0CAAoF;AACpF,4DAA6D;AAC7D,8CAA2E;AAC3E,kDAA4E;AAE5E,qDAA8D;AAC9D,+DAAiE;AACjE,yDAAiG;AAEjG,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7C,MAAM,kBAAmB,SAAQ,KAAK;CAAG;AAEl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AC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3C,MAAM,IAAI,GAAG,MAAM,IAAA,kDAAsC,EAAC,IAAI,CAAC,CAAC;YAChE,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC,CAAC,CAAC;YACH,MAAA,GAAG,CAAC,WAAW,oDAAG,yBAAyB,EAAE,SAAS,EAAE;gBACtD,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE;aAC1C,CAAC,CAAC;QACL,CAAC,EAAE,0BAA0B,CAAC,CAAC;QAC/B,OAAO,MAAM,OAAO,CAAC;KACtB;IAAC,OAAO,GAAQ,EAAE;QACjB,IAAI,QAAQ,EAAE;YACZ,MAAM,IAAI,kBAAkB,CAAC,sCAAsC,CAAC,CAAC;SACtE;QACD,MAAM,GAAG,CAAC;KACX;YAAS;QACR,IAAI,OAAO,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB;KACF;AACH,CAAC","sourcesContent":["import spawn, { SpawnPromise, SpawnResult } from '@expo/turtle-spawn';\nimport { BuildPhase, Ios, Job, Platform } from '@expo/eas-build-job';\nimport { BuildTrigger } from '@expo/eas-build-job/dist/common';\nimport nullthrows from 'nullthrows';\n\nimport { BuildContext } from '../context';\nimport { deleteXcodeEnvLocalIfExistsAsync } from '../ios/xcodeEnv';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { createNpmrcIfNotExistsAsync, logIfNpmrcExistsAsync } 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 } 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 if (ctx.env.NPM_TOKEN) {\n await createNpmrcIfNotExistsAsync(ctx);\n } else {\n await logIfNpmrcExistsAsync(ctx);\n }\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 });\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 ctx.logger.info('Using app configuration:');\n ctx.logger.info(JSON.stringify(ctx.appConfig, null, 2));\n });\n\n const hasExpoPackage = !!packageJson.dependencies?.expo;\n if (hasExpoPackage) {\n await ctx.runBuildPhase(BuildPhase.RUN_EXPO_DOCTOR, async () => {\n try {\n const { stdout } = await runExpoDoctor(ctx);\n if (!stdout.match(/Didn't find any issues with the project/)) {\n ctx.markBuildPhaseHasWarnings();\n }\n } catch (err) {\n 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"]}
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/common/setup.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,sEAAsE;AACtE,wDAA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,CAAC,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC,GAAG,CAAC,oBAAoB,EAC9D;QACA,MAAM,oBAAoB,GACxB,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;YACvF,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;QAC1F,MAAM,aAAa,GAAG,GAAG,CAAC,GAAG,CAAC,WAAW,KAAK,qBAAY,CAAC,qBAAqB,CAAC;QACjF,IAAI,YAAY,GAAG,EAAE,CAAC;QACtB,IAAI,aAAa,IAAI,oBAAoB,EAAE;YACzC,YAAY;gBACV,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 } 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, ctx.logger);\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"]}
|
|
@@ -3,8 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getEasFunctions = void 0;
|
|
4
4
|
const uploadArtifact_1 = require("./functions/uploadArtifact");
|
|
5
5
|
const checkout_1 = require("./functions/checkout");
|
|
6
|
+
const setUpNpmrc_1 = require("./functions/setUpNpmrc");
|
|
7
|
+
const installNodeModules_1 = require("./functions/installNodeModules");
|
|
6
8
|
function getEasFunctions(ctx) {
|
|
7
|
-
return [
|
|
9
|
+
return [
|
|
10
|
+
(0, checkout_1.createCheckoutBuildFunction)(),
|
|
11
|
+
(0, uploadArtifact_1.createUploadArtifactBuildFunction)(ctx),
|
|
12
|
+
(0, setUpNpmrc_1.createSetUpNpmrcBuildFunction)(ctx),
|
|
13
|
+
(0, installNodeModules_1.createInstallNodeModulesBuildFunction)(ctx),
|
|
14
|
+
];
|
|
8
15
|
}
|
|
9
16
|
exports.getEasFunctions = getEasFunctions;
|
|
10
17
|
//# sourceMappingURL=easFunctions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easFunctions.js","sourceRoot":"","sources":["../../src/steps/easFunctions.ts"],"names":[],"mappings":";;;AAKA,+DAA+E;AAC/E,mDAAmE;
|
|
1
|
+
{"version":3,"file":"easFunctions.js","sourceRoot":"","sources":["../../src/steps/easFunctions.ts"],"names":[],"mappings":";;;AAKA,+DAA+E;AAC/E,mDAAmE;AACnE,uDAAuE;AACvE,uEAAuF;AAEvF,SAAgB,eAAe,CAAgB,GAAoB;IACjE,OAAO;QACL,IAAA,sCAA2B,GAAE;QAC7B,IAAA,kDAAiC,EAAC,GAAG,CAAC;QACtC,IAAA,0CAA6B,EAAC,GAAG,CAAC;QAClC,IAAA,0DAAqC,EAAC,GAAG,CAAC;KAC3C,CAAC;AACJ,CAAC;AAPD,0CAOC","sourcesContent":["import { Job } from '@expo/eas-build-job';\nimport { BuildFunction } from '@expo/steps';\n\nimport { BuildContext } from '../context';\n\nimport { createUploadArtifactBuildFunction } from './functions/uploadArtifact';\nimport { createCheckoutBuildFunction } from './functions/checkout';\nimport { createSetUpNpmrcBuildFunction } from './functions/setUpNpmrc';\nimport { createInstallNodeModulesBuildFunction } from './functions/installNodeModules';\n\nexport function getEasFunctions<T extends Job>(ctx: BuildContext<T>): BuildFunction[] {\n return [\n createCheckoutBuildFunction(),\n createUploadArtifactBuildFunction(ctx),\n createSetUpNpmrcBuildFunction(ctx),\n createInstallNodeModulesBuildFunction(ctx),\n ];\n}\n"]}
|
|
@@ -13,7 +13,7 @@ function createCheckoutBuildFunction() {
|
|
|
13
13
|
name: 'Checkout',
|
|
14
14
|
fn: async (stepsCtx) => {
|
|
15
15
|
stepsCtx.logger.info('Checking out project directory');
|
|
16
|
-
await fs_extra_1.default.move(stepsCtx.projectSourceDirectory, stepsCtx.
|
|
16
|
+
await fs_extra_1.default.move(stepsCtx.projectSourceDirectory, stepsCtx.projectTargetDirectory, {
|
|
17
17
|
overwrite: true,
|
|
18
18
|
});
|
|
19
19
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../../src/steps/functions/checkout.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA4C;AAC5C,wDAA0B;AAE1B,SAAgB,2BAA2B;IACzC,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;YACrB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YACvD,MAAM,kBAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EAAE,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../../src/steps/functions/checkout.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA4C;AAC5C,wDAA0B;AAE1B,SAAgB,2BAA2B;IACzC,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;YACrB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YACvD,MAAM,kBAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB,EAAE;gBAC9E,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAZD,kEAYC","sourcesContent":["import { BuildFunction } from '@expo/steps';\nimport fs from 'fs-extra';\n\nexport function createCheckoutBuildFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'checkout',\n name: 'Checkout',\n fn: async (stepsCtx) => {\n stepsCtx.logger.info('Checking out project directory');\n await fs.move(stepsCtx.projectSourceDirectory, stepsCtx.projectTargetDirectory, {\n overwrite: true,\n });\n },\n });\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInstallNodeModulesBuildFunction = void 0;
|
|
4
|
+
const steps_1 = require("@expo/steps");
|
|
5
|
+
const installDependencies_1 = require("../../common/installDependencies");
|
|
6
|
+
function createInstallNodeModulesBuildFunction(ctx) {
|
|
7
|
+
return new steps_1.BuildFunction({
|
|
8
|
+
namespace: 'eas',
|
|
9
|
+
id: 'install_node_modules',
|
|
10
|
+
name: 'Install node modules',
|
|
11
|
+
fn: async (stepsCtx) => {
|
|
12
|
+
await (0, installDependencies_1.installDependenciesAsync)(ctx, stepsCtx.logger);
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.createInstallNodeModulesBuildFunction = createInstallNodeModulesBuildFunction;
|
|
17
|
+
//# sourceMappingURL=installNodeModules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installNodeModules.js","sourceRoot":"","sources":["../../../src/steps/functions/installNodeModules.ts"],"names":[],"mappings":";;;AACA,uCAA4C;AAG5C,0EAA4E;AAE5E,SAAgB,qCAAqC,CACnD,GAAoB;IAEpB,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,sBAAsB;QAC1B,IAAI,EAAE,sBAAsB;QAC5B,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;YACrB,MAAM,IAAA,8CAAwB,EAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACvD,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAXD,sFAWC","sourcesContent":["import { Job } from '@expo/eas-build-job';\nimport { BuildFunction } from '@expo/steps';\n\nimport { BuildContext } from '../../context';\nimport { installDependenciesAsync } from '../../common/installDependencies';\n\nexport function createInstallNodeModulesBuildFunction<T extends Job>(\n ctx: BuildContext<T>\n): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'install_node_modules',\n name: 'Install node modules',\n fn: async (stepsCtx) => {\n await installDependenciesAsync(ctx, stepsCtx.logger);\n },\n });\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSetUpNpmrcBuildFunction = void 0;
|
|
4
|
+
const steps_1 = require("@expo/steps");
|
|
5
|
+
const npmrc_1 = require("../../utils/npmrc");
|
|
6
|
+
function createSetUpNpmrcBuildFunction(ctx) {
|
|
7
|
+
return new steps_1.BuildFunction({
|
|
8
|
+
namespace: 'eas',
|
|
9
|
+
id: 'use_npm_token',
|
|
10
|
+
name: 'Use NPM_TOKEN',
|
|
11
|
+
fn: async (stepsCtx) => {
|
|
12
|
+
await (0, npmrc_1.setUpNpmrcAsync)(ctx, stepsCtx.logger);
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.createSetUpNpmrcBuildFunction = createSetUpNpmrcBuildFunction;
|
|
17
|
+
//# sourceMappingURL=setUpNpmrc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setUpNpmrc.js","sourceRoot":"","sources":["../../../src/steps/functions/setUpNpmrc.ts"],"names":[],"mappings":";;;AACA,uCAA4C;AAG5C,6CAAoD;AAEpD,SAAgB,6BAA6B,CAAgB,GAAoB;IAC/E,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,eAAe;QACrB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;YACrB,MAAM,IAAA,uBAAe,EAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AATD,sEASC","sourcesContent":["import { Job } from '@expo/eas-build-job';\nimport { BuildFunction } from '@expo/steps';\n\nimport { BuildContext } from '../../context';\nimport { setUpNpmrcAsync } from '../../utils/npmrc';\n\nexport function createSetUpNpmrcBuildFunction<T extends Job>(ctx: BuildContext<T>): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'use_npm_token',\n name: 'Use NPM_TOKEN',\n fn: async (stepsCtx) => {\n await setUpNpmrcAsync(ctx, stepsCtx.logger);\n },\n });\n}\n"]}
|
package/dist/utils/npmrc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Job } from '@expo/eas-build-job';
|
|
2
|
+
import { bunyan } from '@expo/logger';
|
|
2
3
|
import { BuildContext } from '../context';
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function logIfNpmrcExistsAsync(ctx: BuildContext<Job>): Promise<void>;
|
|
4
|
+
export declare function setUpNpmrcAsync(ctx: BuildContext<Job>, logger: bunyan): Promise<void>;
|
package/dist/utils/npmrc.js
CHANGED
|
@@ -3,30 +3,37 @@ 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.setUpNpmrcAsync = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const packageManager_1 = require("./packageManager");
|
|
10
10
|
const NPMRC_TEMPLATE_PATH = path_1.default.join(__dirname, '../../templates/npmrc');
|
|
11
|
-
async function
|
|
12
|
-
ctx.
|
|
11
|
+
async function setUpNpmrcAsync(ctx, logger) {
|
|
12
|
+
if (ctx.env.NPM_TOKEN) {
|
|
13
|
+
await createNpmrcIfNotExistsAsync(ctx, logger);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
await logIfNpmrcExistsAsync(ctx, logger);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.setUpNpmrcAsync = setUpNpmrcAsync;
|
|
20
|
+
async function createNpmrcIfNotExistsAsync(ctx, logger) {
|
|
21
|
+
logger.info('We detected that you set the NPM_TOKEN environment variable');
|
|
13
22
|
const projectNpmrcPath = path_1.default.join(ctx.buildDirectory, '.npmrc');
|
|
14
23
|
if (await fs_extra_1.default.pathExists(projectNpmrcPath)) {
|
|
15
|
-
|
|
24
|
+
logger.info('.npmrc already exists in your project directory, skipping generation');
|
|
16
25
|
}
|
|
17
26
|
else {
|
|
18
27
|
const npmrcContents = await fs_extra_1.default.readFile(NPMRC_TEMPLATE_PATH, 'utf8');
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
logger.info('Creating .npmrc in your project directory with the following contents:');
|
|
29
|
+
logger.info(npmrcContents);
|
|
21
30
|
await fs_extra_1.default.copy(NPMRC_TEMPLATE_PATH, projectNpmrcPath);
|
|
22
31
|
}
|
|
23
32
|
}
|
|
24
|
-
|
|
25
|
-
async function logIfNpmrcExistsAsync(ctx) {
|
|
33
|
+
async function logIfNpmrcExistsAsync(ctx, logger) {
|
|
26
34
|
const projectNpmrcPath = path_1.default.join((0, packageManager_1.findPackagerRootDir)(ctx.getReactNativeProjectDirectory()), '.npmrc');
|
|
27
35
|
if (await fs_extra_1.default.pathExists(projectNpmrcPath)) {
|
|
28
|
-
|
|
36
|
+
logger.info(`.npmrc found at ${path_1.default.relative(ctx.buildDirectory, projectNpmrcPath)}`);
|
|
29
37
|
}
|
|
30
38
|
}
|
|
31
|
-
exports.logIfNpmrcExistsAsync = logIfNpmrcExistsAsync;
|
|
32
39
|
//# sourceMappingURL=npmrc.js.map
|
package/dist/utils/npmrc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npmrc.js","sourceRoot":"","sources":["../../src/utils/npmrc.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;
|
|
1
|
+
{"version":3,"file":"npmrc.js","sourceRoot":"","sources":["../../src/utils/npmrc.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAIxB,wDAA0B;AAI1B,qDAAuD;AAEvD,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;AAEnE,KAAK,UAAU,eAAe,CAAC,GAAsB,EAAE,MAAc;IAC1E,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE;QACrB,MAAM,2BAA2B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;KAChD;SAAM;QACL,MAAM,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;KAC1C;AACH,CAAC;AAND,0CAMC;AAED,KAAK,UAAU,2BAA2B,CAAC,GAAsB,EAAE,MAAc;IAC/E,MAAM,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;IAC3E,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACjE,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QACzC,MAAM,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;KACrF;SAAM;QACL,MAAM,aAAa,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;QACrE,MAAM,CAAC,IAAI,CAAC,wEAAwE,CAAC,CAAC;QACtF,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3B,MAAM,kBAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;KACtD;AACH,CAAC;AAED,KAAK,UAAU,qBAAqB,CAAC,GAAsB,EAAE,MAAc;IACzE,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAChC,IAAA,oCAAmB,EAAC,GAAG,CAAC,8BAA8B,EAAE,CAAC,EACzD,QAAQ,CACT,CAAC;IACF,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QACzC,MAAM,CAAC,IAAI,CAAC,mBAAmB,cAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC;KACvF;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport { Job } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport fs from 'fs-extra';\n\nimport { BuildContext } from '../context';\n\nimport { findPackagerRootDir } from './packageManager';\n\nconst NPMRC_TEMPLATE_PATH = path.join(__dirname, '../../templates/npmrc');\n\nexport async function setUpNpmrcAsync(ctx: BuildContext<Job>, logger: bunyan): Promise<void> {\n if (ctx.env.NPM_TOKEN) {\n await createNpmrcIfNotExistsAsync(ctx, logger);\n } else {\n await logIfNpmrcExistsAsync(ctx, logger);\n }\n}\n\nasync function createNpmrcIfNotExistsAsync(ctx: BuildContext<Job>, logger: bunyan): Promise<void> {\n logger.info('We detected that you set the NPM_TOKEN environment variable');\n const projectNpmrcPath = path.join(ctx.buildDirectory, '.npmrc');\n if (await fs.pathExists(projectNpmrcPath)) {\n logger.info('.npmrc already exists in your project directory, skipping generation');\n } else {\n const npmrcContents = await fs.readFile(NPMRC_TEMPLATE_PATH, 'utf8');\n logger.info('Creating .npmrc in your project directory with the following contents:');\n logger.info(npmrcContents);\n await fs.copy(NPMRC_TEMPLATE_PATH, projectNpmrcPath);\n }\n}\n\nasync function logIfNpmrcExistsAsync(ctx: BuildContext<Job>, logger: bunyan): Promise<void> {\n const projectNpmrcPath = path.join(\n findPackagerRootDir(ctx.getReactNativeProjectDirectory()),\n '.npmrc'\n );\n if (await fs.pathExists(projectNpmrcPath)) {\n logger.info(`.npmrc found at ${path.relative(ctx.buildDirectory, projectNpmrcPath)}`);\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.18",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@expo/logger": "1.0.13",
|
|
28
28
|
"@expo/package-manager": "^0.0.57",
|
|
29
29
|
"@expo/plist": "^0.0.20",
|
|
30
|
-
"@expo/steps": "1.0.
|
|
30
|
+
"@expo/steps": "1.0.17",
|
|
31
31
|
"@expo/template-file": "1.0.13",
|
|
32
32
|
"@expo/turtle-spawn": "1.0.13",
|
|
33
33
|
"@expo/xcpretty": "^4.2.2",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"node": "18.13.0",
|
|
62
62
|
"yarn": "1.22.19"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "0d353d27b1686ee77e115488aefd6ca69ac78c4b"
|
|
65
65
|
}
|