@expo/build-tools 0.1.182 → 0.1.183

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.
@@ -8,46 +8,22 @@ const path_1 = __importDefault(require("path"));
8
8
  const eas_build_job_1 = require("@expo/eas-build-job");
9
9
  const steps_1 = require("@expo/steps");
10
10
  const nullthrows_1 = __importDefault(require("nullthrows"));
11
- const context_1 = require("../context");
12
11
  const projectSources_1 = require("../common/projectSources");
12
+ const easFunctions_1 = require("../steps/easFunctions");
13
13
  async function runCustomBuildAsync(ctx) {
14
14
  var _a;
15
15
  await (0, projectSources_1.prepareProjectSourcesAsync)(ctx);
16
16
  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');
17
17
  const configPath = path_1.default.join(ctx.reactNativeProjectDirectory, relativeConfigPath);
18
18
  const buildStepContext = new steps_1.BuildStepContext(ctx.env.EAS_BUILD_ID, ctx.logger.child({ phase: eas_build_job_1.BuildPhase.CUSTOM }), false, ctx.reactNativeProjectDirectory);
19
- const parser = new steps_1.BuildConfigParser(buildStepContext, { configPath });
19
+ const easFunctions = (0, easFunctions_1.getEasFunctions)(ctx);
20
+ const parser = new steps_1.BuildConfigParser(buildStepContext, {
21
+ configPath,
22
+ externalFunctions: easFunctions,
23
+ });
20
24
  const workflow = await parser.parseAsync();
21
25
  try {
22
- try {
23
- await workflow.executeAsync(ctx.env);
24
- }
25
- finally {
26
- await ctx.runBuildPhase(eas_build_job_1.BuildPhase.UPLOAD_BUILD_ARTIFACTS, async () => {
27
- var _a;
28
- try {
29
- const artifacts = await workflow.collectArtifactsAsync();
30
- for (const buildArtifactType of Object.keys(artifacts)) {
31
- const type = buildArtifactType === steps_1.BuildArtifactType.APPLICATION_ARCHIVE
32
- ? context_1.ArtifactType.APPLICATION_ARCHIVE
33
- : context_1.ArtifactType.BUILD_ARTIFACTS;
34
- const filePaths = (_a = artifacts[buildArtifactType]) !== null && _a !== void 0 ? _a : [];
35
- if (filePaths.length > 0) {
36
- await ctx.uploadArtifacts(type, filePaths);
37
- }
38
- }
39
- }
40
- catch (err) {
41
- ctx.logger.error({ err }, 'Failed to upload artifacts');
42
- }
43
- });
44
- try {
45
- await workflow.cleanUpAsync();
46
- }
47
- catch (err) {
48
- ctx.logger.error({ err }, 'Failed to clean up custom build temporary files');
49
- }
50
- }
26
+ await workflow.executeAsync(ctx.env);
51
27
  }
52
28
  catch (err) {
53
29
  err.artifacts = ctx.artifacts;
@@ -1 +1 @@
1
- {"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/builders/custom.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAAsD;AACtD,uCAAqF;AACrF,4DAAoC;AAEpC,wCAAmE;AACnE,6DAAsE;AAE/D,KAAK,UAAU,mBAAmB,CAAgB,GAAoB;;IAC3E,MAAM,IAAA,2CAA0B,EAAC,GAAG,CAAC,CAAC;IAEtC,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,CAAC,GAAG,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAAC;IAElF,MAAM,gBAAgB,GAAG,IAAI,wBAAgB,CAC3C,GAAG,CAAC,GAAG,CAAC,YAAY,EACpB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,0BAAU,CAAC,MAAM,EAAE,CAAC,EAC9C,KAAK,EACL,GAAG,CAAC,2BAA2B,CAChC,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,yBAAiB,CAAC,gBAAgB,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IACvE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAC3C,IAAI;QACF,IAAI;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as-build-job';\nimport { BuildArtifactType, BuildConfigParser, BuildStepContext } from '@expo/steps';\nimport nullthrows from 'nullthrows';\n\nimport { Artifacts, ArtifactType, BuildContext } from '../context';\nimport { prepareProjectSourcesAsync } from '../common/projectSources';\n\nexport async function runCustomBuildAsync<T extends Job>(ctx: BuildContext<T>): Promise<Artifacts> {\n await prepareProjectSourcesAsync(ctx);\n\n const relativeConfigPath = nullthrows(\n ctx.job.customBuildConfig?.path,\n 'Custom build config must be defined for custom builds'\n );\n const configPath = path.join(ctx.reactNativeProjectDirectory, relativeConfigPath);\n\n const buildStepContext = new BuildStepContext(\n ctx.env.EAS_BUILD_ID,\n ctx.logger.child({ phase: BuildPhase.CUSTOM }),\n false,\n ctx.reactNativeProjectDirectory\n );\n const parser = new BuildConfigParser(buildStepContext, { configPath });\n const workflow = await parser.parseAsync();\n try {\n try {\n await workflow.executeAsync(ctx.env);\n } finally {\n await ctx.runBuildPhase(BuildPhase.UPLOAD_BUILD_ARTIFACTS, async () => {\n try {\n const artifacts = await workflow.collectArtifactsAsync();\n for (const buildArtifactType of Object.keys(artifacts)) {\n const type: ArtifactType =\n buildArtifactType === BuildArtifactType.APPLICATION_ARCHIVE\n ? ArtifactType.APPLICATION_ARCHIVE\n : ArtifactType.BUILD_ARTIFACTS;\n const filePaths = artifacts[buildArtifactType as BuildArtifactType] ?? [];\n if (filePaths.length > 0) {\n await ctx.uploadArtifacts(type, filePaths);\n }\n }\n } catch (err: any) {\n ctx.logger.error({ err }, 'Failed to upload artifacts');\n }\n });\n\n try {\n await workflow.cleanUpAsync();\n } catch (err: any) {\n ctx.logger.error({ err }, 'Failed to clean up custom build temporary files');\n }\n }\n } catch (err: any) {\n err.artifacts = ctx.artifacts;\n throw err;\n }\n\n return ctx.artifacts;\n}\n"]}
1
+ {"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/builders/custom.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAAsD;AACtD,uCAAkE;AAClE,4DAAoC;AAGpC,6DAAsE;AACtE,wDAAwD;AAEjD,KAAK,UAAU,mBAAmB,CAAgB,GAAoB;;IAC3E,MAAM,IAAA,2CAA0B,EAAC,GAAG,CAAC,CAAC;IAEtC,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,CAAC,GAAG,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAAC;IAElF,MAAM,gBAAgB,GAAG,IAAI,wBAAgB,CAC3C,GAAG,CAAC,GAAG,CAAC,YAAY,EACpB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,0BAAU,CAAC,MAAM,EAAE,CAAC,EAC9C,KAAK,EACL,GAAG,CAAC,2BAA2B,CAChC,CAAC;IACF,MAAM,YAAY,GAAG,IAAA,8BAAe,EAAC,GAAG,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,MAAM,CAAC,UAAU,EAAE,CAAC;IAC3C,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;AA7BD,kDA6BC","sourcesContent":["import path from 'path';\n\nimport { BuildPhase, Job } from '@expo/eas-build-job';\nimport { BuildConfigParser, BuildStepContext } from '@expo/steps';\nimport nullthrows from 'nullthrows';\n\nimport { Artifacts, BuildContext } from '../context';\nimport { prepareProjectSourcesAsync } from '../common/projectSources';\nimport { getEasFunctions } from '../steps/easFunctions';\n\nexport async function runCustomBuildAsync<T extends Job>(ctx: BuildContext<T>): Promise<Artifacts> {\n await prepareProjectSourcesAsync(ctx);\n\n const relativeConfigPath = nullthrows(\n ctx.job.customBuildConfig?.path,\n 'Custom build config must be defined for custom builds'\n );\n const configPath = path.join(ctx.reactNativeProjectDirectory, relativeConfigPath);\n\n const buildStepContext = new BuildStepContext(\n ctx.env.EAS_BUILD_ID,\n ctx.logger.child({ phase: BuildPhase.CUSTOM }),\n false,\n ctx.reactNativeProjectDirectory\n );\n const easFunctions = getEasFunctions(ctx);\n const parser = new BuildConfigParser(buildStepContext, {\n configPath,\n externalFunctions: easFunctions,\n });\n const workflow = await parser.parseAsync();\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"]}
@@ -0,0 +1,4 @@
1
+ import { Job } from '@expo/eas-build-job';
2
+ import { BuildFunction } from '@expo/steps';
3
+ import { BuildContext } from '../context';
4
+ export declare function getEasFunctions<T extends Job>(ctx: BuildContext<T>): BuildFunction[];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEasFunctions = void 0;
4
+ const uploadArtifact_1 = require("./functions/uploadArtifact");
5
+ function getEasFunctions(ctx) {
6
+ return [(0, uploadArtifact_1.createUploadArtifactStepsFunction)(ctx)];
7
+ }
8
+ exports.getEasFunctions = getEasFunctions;
9
+ //# sourceMappingURL=easFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"easFunctions.js","sourceRoot":"","sources":["../../src/steps/easFunctions.ts"],"names":[],"mappings":";;;AAKA,+DAA+E;AAE/E,SAAgB,eAAe,CAAgB,GAAoB;IACjE,OAAO,CAAC,IAAA,kDAAiC,EAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;AAFD,0CAEC","sourcesContent":["import { Job } from '@expo/eas-build-job';\nimport { BuildFunction } from '@expo/steps';\n\nimport { BuildContext } from '../context';\n\nimport { createUploadArtifactStepsFunction } from './functions/uploadArtifact';\n\nexport function getEasFunctions<T extends Job>(ctx: BuildContext<T>): BuildFunction[] {\n return [createUploadArtifactStepsFunction(ctx)];\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import { Job } from '@expo/eas-build-job';
2
+ import { BuildFunction } from '@expo/steps';
3
+ import { BuildContext } from '../../context';
4
+ export declare function createUploadArtifactStepsFunction<T extends Job>(ctx: BuildContext<T>): BuildFunction;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createUploadArtifactStepsFunction = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const steps_1 = require("@expo/steps");
9
+ const nullthrows_1 = __importDefault(require("nullthrows"));
10
+ const context_1 = require("../../context");
11
+ var BuildArtifactType;
12
+ (function (BuildArtifactType) {
13
+ BuildArtifactType["APPLICATION_ARCHIVE"] = "application-archive";
14
+ BuildArtifactType["BUILD_ARTIFACT"] = "build-artifact";
15
+ })(BuildArtifactType || (BuildArtifactType = {}));
16
+ function createUploadArtifactStepsFunction(ctx) {
17
+ return new steps_1.BuildFunction({
18
+ namespace: 'eas',
19
+ id: 'upload_artifact',
20
+ name: 'Upload artifact',
21
+ inputProviders: [
22
+ // TODO: refactor when BuildStepInput supports "allowedValues" option
23
+ // either "application-archive" or "build-artifact"
24
+ steps_1.BuildStepInput.createProvider({
25
+ id: 'type',
26
+ defaultValue: BuildArtifactType.APPLICATION_ARCHIVE,
27
+ }),
28
+ steps_1.BuildStepInput.createProvider({ id: 'path', required: true }),
29
+ ],
30
+ fn: async (stepsCtx, { inputs }) => {
31
+ const artifactType = validateAndConvertBuildArtifactType((0, nullthrows_1.default)(inputs.type.value));
32
+ const filePath = path_1.default.resolve(stepsCtx.workingDirectory, (0, nullthrows_1.default)(inputs.path.value));
33
+ await ctx.uploadArtifacts(artifactType, [filePath], stepsCtx.logger);
34
+ },
35
+ });
36
+ }
37
+ exports.createUploadArtifactStepsFunction = createUploadArtifactStepsFunction;
38
+ function validateAndConvertBuildArtifactType(input) {
39
+ const allowedValues = Object.values(BuildArtifactType);
40
+ if (!allowedValues.includes(input)) {
41
+ throw new Error(`"${input}" is not allowed artifact type, allowed values: ${allowedValues
42
+ .map((i) => `"${i}"`)
43
+ .join(', ')}`);
44
+ }
45
+ return input === BuildArtifactType.APPLICATION_ARCHIVE
46
+ ? context_1.ArtifactType.APPLICATION_ARCHIVE
47
+ : context_1.ArtifactType.BUILD_ARTIFACTS;
48
+ }
49
+ //# sourceMappingURL=uploadArtifact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadArtifact.js","sourceRoot":"","sources":["../../../src/steps/functions/uploadArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,uCAA4D;AAC5D,4DAAoC;AAEpC,2CAA2D;AAE3D,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,gEAA2C,CAAA;IAC3C,sDAAiC,CAAA;AACnC,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,SAAgB,iCAAiC,CAC/C,GAAoB;IAEpB,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iBAAiB;QACvB,cAAc,EAAE;YACd,qEAAqE;YACrE,mDAAmD;YACnD,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,MAAM;gBACV,YAAY,EAAE,iBAAiB,CAAC,mBAAmB;aACpD,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC9D;QACD,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACjC,MAAM,YAAY,GAAG,mCAAmC,CAAC,IAAA,oBAAU,EAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACxF,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAA,oBAAU,EAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACxF,MAAM,GAAG,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACvE,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAtBD,8EAsBC;AAED,SAAS,mCAAmC,CAAC,KAAa;IACxD,MAAM,aAAa,GAAa,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACjE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAClC,MAAM,IAAI,KAAK,CACb,IAAI,KAAK,mDAAmD,aAAa;aACtE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;aACpB,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;KACH;IACD,OAAO,KAAK,KAAK,iBAAiB,CAAC,mBAAmB;QACpD,CAAC,CAAC,sBAAY,CAAC,mBAAmB;QAClC,CAAC,CAAC,sBAAY,CAAC,eAAe,CAAC;AACnC,CAAC","sourcesContent":["import path from 'path';\n\nimport { Job } from '@expo/eas-build-job';\nimport { BuildFunction, BuildStepInput } from '@expo/steps';\nimport nullthrows from 'nullthrows';\n\nimport { ArtifactType, BuildContext } from '../../context';\n\nenum BuildArtifactType {\n APPLICATION_ARCHIVE = 'application-archive',\n BUILD_ARTIFACT = 'build-artifact',\n}\n\nexport function createUploadArtifactStepsFunction<T extends Job>(\n ctx: BuildContext<T>\n): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'upload_artifact',\n name: 'Upload artifact',\n inputProviders: [\n // TODO: refactor when BuildStepInput supports \"allowedValues\" option\n // either \"application-archive\" or \"build-artifact\"\n BuildStepInput.createProvider({\n id: 'type',\n defaultValue: BuildArtifactType.APPLICATION_ARCHIVE,\n }),\n BuildStepInput.createProvider({ id: 'path', required: true }),\n ],\n fn: async (stepsCtx, { inputs }) => {\n const artifactType = validateAndConvertBuildArtifactType(nullthrows(inputs.type.value));\n const filePath = path.resolve(stepsCtx.workingDirectory, nullthrows(inputs.path.value));\n await ctx.uploadArtifacts(artifactType, [filePath], stepsCtx.logger);\n },\n });\n}\n\nfunction validateAndConvertBuildArtifactType(input: string): ArtifactType {\n const allowedValues: string[] = Object.values(BuildArtifactType);\n if (!allowedValues.includes(input)) {\n throw new Error(\n `\"${input}\" is not allowed artifact type, allowed values: ${allowedValues\n .map((i) => `\"${i}\"`)\n .join(', ')}`\n );\n }\n return input === BuildArtifactType.APPLICATION_ARCHIVE\n ? ArtifactType.APPLICATION_ARCHIVE\n : ArtifactType.BUILD_ARTIFACTS;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/build-tools",
3
- "version": "0.1.182",
3
+ "version": "0.1.183",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -27,7 +27,7 @@
27
27
  "@expo/logger": "0.0.27",
28
28
  "@expo/package-manager": "^0.0.57",
29
29
  "@expo/plist": "^0.0.20",
30
- "@expo/steps": "0.0.8",
30
+ "@expo/steps": "0.0.9",
31
31
  "@expo/template-file": "0.1.25",
32
32
  "@expo/turtle-spawn": "0.0.28",
33
33
  "@expo/xcpretty": "^4.2.2",