@expo/build-tools 18.2.0 → 18.5.0

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.
Files changed (65) hide show
  1. package/dist/android/gradle.js +1 -1
  2. package/dist/buildErrors/detectError.d.ts +1 -1
  3. package/dist/buildErrors/detectError.js +8 -12
  4. package/dist/buildErrors/userErrorHandlers.d.ts +2 -2
  5. package/dist/buildErrors/userErrorHandlers.js +20 -20
  6. package/dist/builders/android.js +25 -3
  7. package/dist/builders/custom.js +1 -0
  8. package/dist/builders/ios.js +1 -1
  9. package/dist/common/setup.js +8 -9
  10. package/dist/context.d.ts +3 -1
  11. package/dist/context.js +3 -1
  12. package/dist/customBuildContext.d.ts +5 -1
  13. package/dist/customBuildContext.js +22 -0
  14. package/dist/generic.d.ts +1 -3
  15. package/dist/generic.js +13 -15
  16. package/dist/ios/credentials/provisioningProfile.d.ts +2 -1
  17. package/dist/ios/credentials/provisioningProfile.js +10 -11
  18. package/dist/steps/easFunctions.js +0 -2
  19. package/dist/steps/functionGroups/maestroTest.js +0 -3
  20. package/dist/steps/functions/calculateEASUpdateRuntimeVersion.js +2 -2
  21. package/dist/steps/functions/configureEASUpdateIfInstalled.js +2 -2
  22. package/dist/steps/functions/downloadArtifact.js +3 -3
  23. package/dist/steps/functions/downloadBuild.js +2 -2
  24. package/dist/steps/functions/maestroResultParser.js +134 -80
  25. package/dist/steps/functions/readIpaInfo.js +9 -9
  26. package/dist/steps/functions/repack.js +20 -3
  27. package/dist/steps/functions/reportMaestroTestResults.js +14 -7
  28. package/dist/steps/functions/restoreBuildCache.d.ts +8 -0
  29. package/dist/steps/functions/restoreBuildCache.js +85 -0
  30. package/dist/steps/functions/saveBuildCache.d.ts +8 -0
  31. package/dist/steps/functions/saveBuildCache.js +57 -0
  32. package/dist/steps/functions/startAndroidEmulator.js +19 -0
  33. package/dist/steps/functions/uploadToAsc.d.ts +3 -0
  34. package/dist/steps/functions/uploadToAsc.js +28 -5
  35. package/dist/steps/utils/android/gradle.js +1 -1
  36. package/dist/steps/utils/android/gradleConfig.d.ts +3 -0
  37. package/dist/steps/utils/android/gradleConfig.js +15 -1
  38. package/dist/steps/utils/ios/AscApiClient.d.ts +1 -1
  39. package/dist/steps/utils/ios/AscApiUtils.d.ts +5 -0
  40. package/dist/steps/utils/ios/AscApiUtils.js +19 -16
  41. package/dist/steps/utils/ios/credentials/provisioningProfile.d.ts +2 -1
  42. package/dist/steps/utils/ios/credentials/provisioningProfile.js +10 -11
  43. package/dist/utils/AndroidEmulatorUtils.d.ts +5 -0
  44. package/dist/utils/AndroidEmulatorUtils.js +17 -0
  45. package/dist/utils/appConfig.d.ts +4 -2
  46. package/dist/utils/appConfig.js +36 -5
  47. package/dist/utils/expoCli.d.ts +4 -0
  48. package/dist/utils/expoCli.js +37 -0
  49. package/dist/utils/expoUpdates.d.ts +1 -1
  50. package/dist/utils/expoUpdates.js +4 -4
  51. package/dist/utils/gradleCacheKey.d.ts +2 -0
  52. package/dist/utils/gradleCacheKey.js +56 -0
  53. package/dist/utils/packageManager.d.ts +10 -0
  54. package/dist/utils/packageManager.js +21 -0
  55. package/dist/utils/stepMetrics.d.ts +2 -2
  56. package/dist/utils/stepMetrics.js +4 -10
  57. package/package.json +14 -13
  58. package/dist/android/gradleConfig.d.ts +0 -3
  59. package/dist/android/gradleConfig.js +0 -47
  60. package/dist/steps/functions/internalMaestroTest.d.ts +0 -9
  61. package/dist/steps/functions/internalMaestroTest.js +0 -538
  62. package/dist/templates/EasBuildGradle.d.ts +0 -1
  63. package/dist/templates/EasBuildGradle.js +0 -57
  64. package/dist/utils/findMaestroPathsFlowsToExecuteAsync.d.ts +0 -8
  65. package/dist/utils/findMaestroPathsFlowsToExecuteAsync.js +0 -184
@@ -1,184 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.findMaestroPathsFlowsToExecuteAsync = findMaestroPathsFlowsToExecuteAsync;
40
- const results_1 = require("@expo/results");
41
- const fast_glob_1 = __importDefault(require("fast-glob"));
42
- const node_fs_1 = require("node:fs");
43
- const path = __importStar(require("node:path"));
44
- const yaml = __importStar(require("yaml"));
45
- const zod_1 = require("zod");
46
- const FlowConfigSchema = zod_1.z.object({
47
- name: zod_1.z.string().optional(),
48
- tags: zod_1.z.array(zod_1.z.string()).optional(),
49
- });
50
- const WorkspaceConfigSchema = zod_1.z.object({
51
- flows: zod_1.z.array(zod_1.z.string()).optional(),
52
- executionOrder: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
53
- includeTags: zod_1.z.array(zod_1.z.string()).optional(),
54
- excludeTags: zod_1.z.array(zod_1.z.string()).optional(),
55
- });
56
- async function findMaestroPathsFlowsToExecuteAsync({ workingDirectory, flowPath, includeTags: _includeTags, excludeTags: _excludeTags, logger, }) {
57
- const absoluteFlowPath = path.resolve(workingDirectory, flowPath);
58
- // If it's a file, just return it (no validation needed)
59
- const stat = await node_fs_1.promises.stat(absoluteFlowPath);
60
- if (stat.isFile()) {
61
- logger.info(`Found a file: ${path.relative(workingDirectory, absoluteFlowPath)}`);
62
- return [absoluteFlowPath];
63
- }
64
- // It's a directory - discover flow files
65
- logger.info(`Found a directory: ${path.relative(workingDirectory, absoluteFlowPath)}`);
66
- // Check for workspace config
67
- logger.info(`Searching for workspace config...`);
68
- const workspaceConfig = await findAndParseWorkspaceConfigAsync({
69
- dirPath: absoluteFlowPath,
70
- workingDirectory,
71
- logger,
72
- });
73
- logger.info(`Using workspace config: ${JSON.stringify(workspaceConfig)}`);
74
- if (workspaceConfig?.executionOrder) {
75
- logger.warn(`Execution order is not supported yet. Ignoring.`);
76
- }
77
- logger.info(`Searching for flow files...`);
78
- const { flows } = await findAndParseFlowFilesAsync({
79
- dirPath: absoluteFlowPath,
80
- workingDirectory,
81
- workspaceConfig,
82
- logger,
83
- });
84
- if (flows.length === 0) {
85
- logger.info(`No valid flow files found in: ${path.relative(workingDirectory, absoluteFlowPath)}`);
86
- return [];
87
- }
88
- const includeTags = [...(_includeTags ?? []), ...(workspaceConfig?.includeTags ?? [])];
89
- const excludeTags = [...(_excludeTags ?? []), ...(workspaceConfig?.excludeTags ?? [])];
90
- if (includeTags.length === 0 && excludeTags.length === 0) {
91
- logger.info(`No tags provided, returning all flows.`);
92
- return flows.map(({ path }) => path);
93
- }
94
- logger.info(`Filtering flows by tags. Tags to include: ${JSON.stringify(includeTags)}. Tags to exclude: ${JSON.stringify(excludeTags) ?? 'none'}.`);
95
- return flows
96
- .filter(({ config, path: flowPath }) => {
97
- const shouldInclude = matchesTags({
98
- flowTags: config?.tags ?? [],
99
- includeTags,
100
- excludeTags,
101
- });
102
- logger.info(shouldInclude
103
- ? `- ${path.relative(workingDirectory, flowPath)} matches tags, including.`
104
- : `- ${path.relative(workingDirectory, flowPath)} does not match tags, excluding.`);
105
- return shouldInclude;
106
- })
107
- .map(({ path }) => path);
108
- }
109
- async function findAndParseWorkspaceConfigAsync({ dirPath, workingDirectory, logger, }) {
110
- const configPaths = await (0, fast_glob_1.default)(['config.yaml', 'config.yml'], {
111
- cwd: dirPath,
112
- absolute: true,
113
- });
114
- if (configPaths.length === 0) {
115
- logger.info(`No workspace config found in: ${path.relative(workingDirectory, dirPath)}`);
116
- return null;
117
- }
118
- for (const configPath of configPaths) {
119
- try {
120
- const content = await node_fs_1.promises.readFile(configPath, 'utf-8');
121
- const configDoc = yaml.parse(content);
122
- if (!configDoc) {
123
- logger.warn(`No content found in workspace config: ${path.relative(workingDirectory, configPath)}`);
124
- continue;
125
- }
126
- logger.info(`Using workspace config from: ${path.relative(workingDirectory, configPath)}`);
127
- return WorkspaceConfigSchema.parse(configDoc);
128
- }
129
- catch (err) {
130
- logger.warn({ err }, `Failed to parse workspace config: ${path.relative(workingDirectory, configPath)}`);
131
- continue;
132
- }
133
- }
134
- logger.info(`No valid workspace config found in: ${path.relative(workingDirectory, dirPath)}`);
135
- return null;
136
- }
137
- async function findAndParseFlowFilesAsync({ workingDirectory, dirPath, workspaceConfig, logger, }) {
138
- const flows = [];
139
- // Determine flow patterns from config or use default
140
- const flowPatterns = workspaceConfig?.flows ?? ['*'];
141
- logger.info(`Using flow patterns: ${JSON.stringify(flowPatterns)}`);
142
- // Use fast-glob to find matching files
143
- const matchedFiles = await (0, fast_glob_1.default)(flowPatterns, {
144
- cwd: dirPath,
145
- absolute: true,
146
- onlyFiles: true,
147
- ignore: ['*/config.yaml', '*/config.yml'], // Skip workspace config files
148
- });
149
- logger.info(`Found ${matchedFiles.length} potential flow files`);
150
- // Parse each matched file
151
- for (const filePath of matchedFiles) {
152
- // Skip non-YAML files
153
- const ext = path.extname(filePath);
154
- if (ext !== '.yaml' && ext !== '.yml') {
155
- logger.info(`Skipping non-YAML file: ${path.relative(workingDirectory, filePath)}`);
156
- continue;
157
- }
158
- const result = await (0, results_1.asyncResult)(parseFlowFile(filePath));
159
- if (result.ok) {
160
- logger.info(`Found flow file: ${path.relative(workingDirectory, filePath)}`);
161
- flows.push({ config: result.value, path: filePath });
162
- }
163
- else {
164
- logger.info({ err: result.reason }, `Skipping flow file: ${path.relative(workingDirectory, filePath)}`);
165
- }
166
- }
167
- return { flows };
168
- }
169
- async function parseFlowFile(filePath) {
170
- const content = await node_fs_1.promises.readFile(filePath, 'utf-8');
171
- const documents = yaml.parseAllDocuments(content);
172
- const configDoc = documents[0];
173
- if (!configDoc) {
174
- throw new Error(`No config section found in ${filePath}`);
175
- }
176
- return FlowConfigSchema.parse(configDoc.toJS());
177
- }
178
- function matchesTags({ flowTags, includeTags, excludeTags, }) {
179
- // Include logic: if includeTags is empty OR flow has any of the include tags
180
- const includeMatch = includeTags.length === 0 || includeTags.some(tag => flowTags.includes(tag));
181
- // Exclude logic: if excludeTags is empty OR flow has none of the exclude tags
182
- const excludeMatch = excludeTags.length === 0 || !excludeTags.some(tag => flowTags.includes(tag));
183
- return includeMatch && excludeMatch;
184
- }