@expo/build-tools 1.0.199 → 1.0.201
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/ios/pod.js
CHANGED
|
@@ -17,9 +17,6 @@ async function installPods(ctx, { infoCallbackFn }) {
|
|
|
17
17
|
env: {
|
|
18
18
|
...ctx.env,
|
|
19
19
|
LANG: 'en_US.UTF-8',
|
|
20
|
-
...(ctx.env.EAS_BUILD_COCOAPODS_CACHE_URL
|
|
21
|
-
? { NEXUS_COCOAPODS_REPO_URL: ctx.env.EAS_BUILD_COCOAPODS_CACHE_URL }
|
|
22
|
-
: {}),
|
|
23
20
|
},
|
|
24
21
|
lineTransformer: (line) => {
|
|
25
22
|
if (!line ||
|
package/dist/ios/pod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pod.js","sourceRoot":"","sources":["../../src/ios/pod.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,sEAAoF;AAI7E,KAAK,UAAU,WAAW,CAC/B,GAAuB,EACvB,EAAE,cAAc,EAAgB;IAEhC,MAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,EAAE,EAAE,KAAK,CAAC,CAAC;IAEtE,MAAM,WAAW,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,MAAM,uBAAuB,GAAG,GAAG,CAAC,GAAG,CAAC,wBAAwB,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAElG,OAAO;QACL,YAAY,EAAE,IAAA,sBAAK,EAAC,KAAK,EAAE,CAAC,SAAS,EAAE,GAAG,WAAW,EAAE,GAAG,uBAAuB,CAAC,EAAE;YAClF,GAAG,EAAE,MAAM;YACX,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,GAAG,EAAE;gBACH,GAAG,GAAG,CAAC,GAAG;gBACV,IAAI,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"pod.js","sourceRoot":"","sources":["../../src/ios/pod.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,sEAAoF;AAI7E,KAAK,UAAU,WAAW,CAC/B,GAAuB,EACvB,EAAE,cAAc,EAAgB;IAEhC,MAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,EAAE,EAAE,KAAK,CAAC,CAAC;IAEtE,MAAM,WAAW,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,MAAM,uBAAuB,GAAG,GAAG,CAAC,GAAG,CAAC,wBAAwB,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAElG,OAAO;QACL,YAAY,EAAE,IAAA,sBAAK,EAAC,KAAK,EAAE,CAAC,SAAS,EAAE,GAAG,WAAW,EAAE,GAAG,uBAAuB,CAAC,EAAE;YAClF,GAAG,EAAE,MAAM;YACX,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,GAAG,EAAE;gBACH,GAAG,GAAG,CAAC,GAAG;gBACV,IAAI,EAAE,aAAa;aACpB;YACD,eAAe,EAAE,CAAC,IAAa,EAAE,EAAE;gBACjC,IACE,CAAC,IAAI;oBACL,2EAA2E,CAAC,IAAI,CAAC,IAAI,CAAC,EACtF,CAAC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC;qBAAM,CAAC;oBACN,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YACD,cAAc;SACf,CAAC;KACH,CAAC;AACJ,CAAC;AA9BD,kCA8BC","sourcesContent":["import path from 'path';\n\nimport { Ios } from '@expo/eas-build-job';\nimport spawn, { SpawnOptions, SpawnPromise, SpawnResult } from '@expo/turtle-spawn';\n\nimport { BuildContext } from '../context';\n\nexport async function installPods<TJob extends Ios.Job>(\n ctx: BuildContext<TJob>,\n { infoCallbackFn }: SpawnOptions\n): Promise<{ spawnPromise: SpawnPromise<SpawnResult> }> {\n const iosDir = path.join(ctx.getReactNativeProjectDirectory(), 'ios');\n\n const verboseFlag = ctx.env['EAS_VERBOSE'] === '1' ? ['--verbose'] : [];\n const cocoapodsDeploymentFlag = ctx.env['POD_INSTALL_DEPLOYMENT'] === '1' ? ['--deployment'] : [];\n\n return {\n spawnPromise: spawn('pod', ['install', ...verboseFlag, ...cocoapodsDeploymentFlag], {\n cwd: iosDir,\n logger: ctx.logger,\n env: {\n ...ctx.env,\n LANG: 'en_US.UTF-8',\n },\n lineTransformer: (line?: string) => {\n if (\n !line ||\n /\\[!\\] '[\\w-]+' uses the unencrypted 'http' protocol to transfer the Pod\\./.exec(line)\n ) {\n return null;\n } else {\n return line;\n }\n },\n infoCallbackFn,\n }),\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="bunyan" />
|
|
2
2
|
import { bunyan } from '@expo/logger';
|
|
3
|
-
export declare function findMaestroPathsFlowsToExecuteAsync({ workingDirectory, flowPath, includeTags, excludeTags, logger, }: {
|
|
3
|
+
export declare function findMaestroPathsFlowsToExecuteAsync({ workingDirectory, flowPath, includeTags: _includeTags, excludeTags: _excludeTags, logger, }: {
|
|
4
4
|
workingDirectory: string;
|
|
5
5
|
flowPath: string;
|
|
6
6
|
includeTags: string[] | undefined;
|
|
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.findMaestroPathsFlowsToExecuteAsync = void 0;
|
|
27
30
|
const node_fs_1 = require("node:fs");
|
|
@@ -29,12 +32,19 @@ const path = __importStar(require("node:path"));
|
|
|
29
32
|
const yaml = __importStar(require("yaml"));
|
|
30
33
|
const zod_1 = require("zod");
|
|
31
34
|
const results_1 = require("@expo/results");
|
|
35
|
+
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
32
36
|
const FlowConfigSchema = zod_1.z.object({
|
|
33
37
|
name: zod_1.z.string().optional(),
|
|
34
38
|
tags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
35
39
|
});
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
const WorkspaceConfigSchema = zod_1.z.object({
|
|
41
|
+
flows: zod_1.z.array(zod_1.z.string()).optional(),
|
|
42
|
+
executionOrder: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
43
|
+
includeTags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
44
|
+
excludeTags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
45
|
+
});
|
|
46
|
+
async function findMaestroPathsFlowsToExecuteAsync({ workingDirectory, flowPath, includeTags: _includeTags, excludeTags: _excludeTags, logger, }) {
|
|
47
|
+
var _a, _b, _c;
|
|
38
48
|
const absoluteFlowPath = path.resolve(workingDirectory, flowPath);
|
|
39
49
|
// If it's a file, just return it (no validation needed)
|
|
40
50
|
const stat = await node_fs_1.promises.stat(absoluteFlowPath);
|
|
@@ -44,28 +54,42 @@ async function findMaestroPathsFlowsToExecuteAsync({ workingDirectory, flowPath,
|
|
|
44
54
|
}
|
|
45
55
|
// It's a directory - discover flow files
|
|
46
56
|
logger.info(`Found a directory: ${path.relative(workingDirectory, absoluteFlowPath)}`);
|
|
57
|
+
// Check for workspace config
|
|
58
|
+
logger.info(`Searching for workspace config...`);
|
|
59
|
+
const workspaceConfig = await findAndParseWorkspaceConfigAsync({
|
|
60
|
+
dirPath: absoluteFlowPath,
|
|
61
|
+
workingDirectory,
|
|
62
|
+
logger,
|
|
63
|
+
});
|
|
64
|
+
logger.info(`Using workspace config: ${JSON.stringify(workspaceConfig)}`);
|
|
65
|
+
if (workspaceConfig === null || workspaceConfig === void 0 ? void 0 : workspaceConfig.executionOrder) {
|
|
66
|
+
logger.warn(`Execution order is not supported yet. Ignoring.`);
|
|
67
|
+
}
|
|
47
68
|
logger.info(`Searching for flow files...`);
|
|
48
69
|
const { flows } = await findAndParseFlowFilesAsync({
|
|
49
70
|
dirPath: absoluteFlowPath,
|
|
50
71
|
workingDirectory,
|
|
72
|
+
workspaceConfig,
|
|
51
73
|
logger,
|
|
52
74
|
});
|
|
53
75
|
if (flows.length === 0) {
|
|
54
76
|
logger.info(`No valid flow files found in: ${path.relative(workingDirectory, absoluteFlowPath)}`);
|
|
55
77
|
return [];
|
|
56
78
|
}
|
|
57
|
-
|
|
79
|
+
const includeTags = [...(_includeTags !== null && _includeTags !== void 0 ? _includeTags : []), ...((_a = workspaceConfig === null || workspaceConfig === void 0 ? void 0 : workspaceConfig.includeTags) !== null && _a !== void 0 ? _a : [])];
|
|
80
|
+
const excludeTags = [...(_excludeTags !== null && _excludeTags !== void 0 ? _excludeTags : []), ...((_b = workspaceConfig === null || workspaceConfig === void 0 ? void 0 : workspaceConfig.excludeTags) !== null && _b !== void 0 ? _b : [])];
|
|
81
|
+
if (includeTags.length === 0 && excludeTags.length === 0) {
|
|
58
82
|
logger.info(`No tags provided, returning all flows.`);
|
|
59
83
|
return flows.map(({ path }) => path);
|
|
60
84
|
}
|
|
61
|
-
logger.info(`Filtering flows by tags. Tags to include: ${JSON.stringify(includeTags)}. Tags to exclude: ${(
|
|
85
|
+
logger.info(`Filtering flows by tags. Tags to include: ${JSON.stringify(includeTags)}. Tags to exclude: ${(_c = JSON.stringify(excludeTags)) !== null && _c !== void 0 ? _c : 'none'}.`);
|
|
62
86
|
return flows
|
|
63
87
|
.filter(({ config, path: flowPath }) => {
|
|
64
88
|
var _a;
|
|
65
89
|
const shouldInclude = matchesTags({
|
|
66
90
|
flowTags: (_a = config === null || config === void 0 ? void 0 : config.tags) !== null && _a !== void 0 ? _a : [],
|
|
67
|
-
includeTags
|
|
68
|
-
excludeTags
|
|
91
|
+
includeTags,
|
|
92
|
+
excludeTags,
|
|
69
93
|
});
|
|
70
94
|
logger.info(shouldInclude
|
|
71
95
|
? `- ${path.relative(workingDirectory, flowPath)} matches tags, including.`
|
|
@@ -75,35 +99,67 @@ async function findMaestroPathsFlowsToExecuteAsync({ workingDirectory, flowPath,
|
|
|
75
99
|
.map(({ path }) => path);
|
|
76
100
|
}
|
|
77
101
|
exports.findMaestroPathsFlowsToExecuteAsync = findMaestroPathsFlowsToExecuteAsync;
|
|
78
|
-
async function
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
logger.info(`Maestro config files are not supported yet. Skipping Maestro config file: ${path.relative(workingDirectory, fullPath)}`);
|
|
102
|
+
async function findAndParseWorkspaceConfigAsync({ dirPath, workingDirectory, logger, }) {
|
|
103
|
+
const configPaths = await (0, fast_glob_1.default)(['config.yaml', 'config.yml'], {
|
|
104
|
+
cwd: dirPath,
|
|
105
|
+
absolute: true,
|
|
106
|
+
});
|
|
107
|
+
if (configPaths.length === 0) {
|
|
108
|
+
logger.info(`No workspace config found in: ${path.relative(workingDirectory, dirPath)}`);
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
for (const configPath of configPaths) {
|
|
112
|
+
try {
|
|
113
|
+
const content = await node_fs_1.promises.readFile(configPath, 'utf-8');
|
|
114
|
+
const configDoc = yaml.parse(content);
|
|
115
|
+
if (!configDoc) {
|
|
116
|
+
logger.warn(`No content found in workspace config: ${path.relative(workingDirectory, configPath)}`);
|
|
94
117
|
continue;
|
|
95
118
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
119
|
+
logger.info(`Using workspace config from: ${path.relative(workingDirectory, configPath)}`);
|
|
120
|
+
return WorkspaceConfigSchema.parse(configDoc);
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
logger.warn({ err }, `Failed to parse workspace config: ${path.relative(workingDirectory, configPath)}`);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
logger.info(`No valid workspace config found in: ${path.relative(workingDirectory, dirPath)}`);
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
async function findAndParseFlowFilesAsync({ workingDirectory, dirPath, workspaceConfig, logger, }) {
|
|
131
|
+
var _a;
|
|
132
|
+
const flows = [];
|
|
133
|
+
// Determine flow patterns from config or use default
|
|
134
|
+
const flowPatterns = (_a = workspaceConfig === null || workspaceConfig === void 0 ? void 0 : workspaceConfig.flows) !== null && _a !== void 0 ? _a : ['*'];
|
|
135
|
+
logger.info(`Using flow patterns: ${JSON.stringify(flowPatterns)}`);
|
|
136
|
+
logger.info(`Searching for flows with patterns: ${JSON.stringify(flowPatterns)}`, {
|
|
137
|
+
cwd: dirPath,
|
|
138
|
+
fg: flowPatterns,
|
|
139
|
+
});
|
|
140
|
+
// Use fast-glob to find matching files
|
|
141
|
+
const matchedFiles = await (0, fast_glob_1.default)(flowPatterns, {
|
|
142
|
+
cwd: dirPath,
|
|
143
|
+
absolute: true,
|
|
144
|
+
onlyFiles: true,
|
|
145
|
+
ignore: ['*/config.yaml', '*/config.yml'], // Skip workspace config files
|
|
146
|
+
});
|
|
147
|
+
logger.info(`Found ${matchedFiles.length} potential flow files`);
|
|
148
|
+
// Parse each matched file
|
|
149
|
+
for (const filePath of matchedFiles) {
|
|
150
|
+
// Skip non-YAML files
|
|
151
|
+
const ext = path.extname(filePath);
|
|
152
|
+
if (ext !== '.yaml' && ext !== '.yml') {
|
|
153
|
+
logger.info(`Skipping non-YAML file: ${path.relative(workingDirectory, filePath)}`);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const result = await (0, results_1.asyncResult)(parseFlowFile(filePath));
|
|
157
|
+
if (result.ok) {
|
|
158
|
+
logger.info(`Found flow file: ${path.relative(workingDirectory, filePath)}`);
|
|
159
|
+
flows.push({ config: result.value, path: filePath });
|
|
104
160
|
}
|
|
105
|
-
else
|
|
106
|
-
logger.info(
|
|
161
|
+
else {
|
|
162
|
+
logger.info({ err: result.reason }, `Skipping flow file: ${path.relative(workingDirectory, filePath)}`);
|
|
107
163
|
}
|
|
108
164
|
}
|
|
109
165
|
return { flows };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findMaestroPathsFlowsToExecuteAsync.js","sourceRoot":"","sources":["../../src/utils/findMaestroPathsFlowsToExecuteAsync.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyC;AACzC,gDAAkC;AAGlC,2CAA6B;AAC7B,6BAAwB;AACxB,2CAA4C;AAE5C,MAAM,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAII,KAAK,UAAU,mCAAmC,CAAC,EACxD,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,WAAW,EACX,MAAM,GAOP;;IACC,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IAClE,wDAAwD;IACxD,MAAM,IAAI,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAE7C,IAAI,IAAI,CAA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iB,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,QAAQ,EACR,WAAW,EACX,WAAW,GAKZ;IACC,6EAA6E;IAC7E,MAAM,YAAY,GAChB,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAEhF,8EAA8E;IAC9E,MAAM,YAAY,GAChB,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAEjF,OAAO,YAAY,IAAI,YAAY,CAAC;AACtC,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\n\nimport { bunyan } from '@expo/logger';\nimport * as yaml from 'yaml';\nimport { z } from 'zod';\nimport { asyncResult } from '@expo/results';\n\nconst FlowConfigSchema = z.object({\n name: z.string().optional(),\n tags: z.array(z.string()).optional(),\n});\n\ntype FlowConfig = z.infer<typeof FlowConfigSchema>;\n\nexport async function findMaestroPathsFlowsToExecuteAsync({\n workingDirectory,\n flowPath,\n includeTags,\n excludeTags,\n logger,\n}: {\n workingDirectory: string;\n flowPath: string;\n includeTags: string[] | undefined;\n excludeTags: string[] | undefined;\n logger: bunyan;\n}): Promise<string[]> {\n const absoluteFlowPath = path.resolve(workingDirectory, flowPath);\n // If it's a file, just return it (no validation needed)\n const stat = await fs.stat(absoluteFlowPath);\n\n if (stat.isFile()) {\n logger.info(`Found a file: ${path.relative(workingDirectory, absoluteFlowPath)}`);\n return [absoluteFlowPath];\n }\n\n // It's a directory - discover flow files\n logger.info(`Found a directory: ${path.relative(workingDirectory, absoluteFlowPath)}`);\n logger.info(`Searching for flow files...`);\n const { flows } = await findAndParseFlowFilesAsync({\n dirPath: absoluteFlowPath,\n workingDirectory,\n logger,\n });\n\n if (flows.length === 0) {\n logger.info(\n `No valid flow files found in: ${path.relative(workingDirectory, absoluteFlowPath)}`\n );\n return [];\n }\n\n if (!includeTags && !excludeTags) {\n logger.info(`No tags provided, returning all flows.`);\n return flows.map(({ path }) => path);\n }\n\n logger.info(\n `Filtering flows by tags. Tags to include: ${JSON.stringify(includeTags)}. Tags to exclude: ${JSON.stringify(excludeTags) ?? 'none'}.`\n );\n return flows\n .filter(({ config, path: flowPath }) => {\n const shouldInclude = matchesTags({\n flowTags: config?.tags ?? [],\n includeTags: includeTags ?? [],\n excludeTags: excludeTags ?? [],\n });\n\n logger.info(\n shouldInclude\n ? `- ${path.relative(workingDirectory, flowPath)} matches tags, including.`\n : `- ${path.relative(workingDirectory, flowPath)} does not match tags, excluding.`\n );\n\n return shouldInclude;\n })\n .map(({ path }) => path);\n}\n\nasync function findAndParseFlowFilesAsync({\n workingDirectory,\n dirPath,\n logger,\n}: {\n workingDirectory: string;\n dirPath: string;\n logger: bunyan;\n}): Promise<{ flows: { config: FlowConfig; path: string }[] }> {\n const flows: { config: FlowConfig; path: string }[] = [];\n\n const entries = await fs.readdir(dirPath, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dirPath, entry.name);\n\n if (entry.isFile()) {\n // Skip non-YAML files\n const ext = path.extname(fullPath);\n if (ext !== '.yaml' && ext !== '.yml') {\n logger.info(`Skipping non-YAML file: ${path.relative(workingDirectory, fullPath)}`);\n continue;\n }\n\n // Skip Maestro config files\n const basename = path.basename(fullPath, ext);\n if (basename === 'config') {\n logger.info(\n `Maestro config files are not supported yet. Skipping Maestro config file: ${path.relative(workingDirectory, fullPath)}`\n );\n continue;\n }\n\n const result = await asyncResult(parseFlowFile(fullPath));\n if (result.ok) {\n logger.info(`Found flow file: ${path.relative(workingDirectory, fullPath)}`);\n flows.push({ config: result.value, path: fullPath });\n } else {\n logger.info(\n { err: result.reason },\n `Skipping flow file: ${path.relative(workingDirectory, fullPath)}`\n );\n }\n } else if (entry.isDirectory()) {\n logger.info(\n `Default behavior excludes subdirectories. Skipping subdirectory: ${path.relative(workingDirectory, fullPath)}`\n );\n }\n }\n\n return { flows };\n}\n\nasync function parseFlowFile(filePath: string): Promise<FlowConfig> {\n const content = await fs.readFile(filePath, 'utf-8');\n const documents = yaml.parseAllDocuments(content);\n const configDoc = documents[0];\n if (!configDoc) {\n throw new Error(`No config section found in ${filePath}`);\n }\n return FlowConfigSchema.parse(configDoc.toJS());\n}\n\nfunction matchesTags({\n flowTags,\n includeTags,\n excludeTags,\n}: {\n flowTags: string[];\n includeTags: string[];\n excludeTags: string[];\n}): boolean {\n // Include logic: if includeTags is empty OR flow has any of the include tags\n const includeMatch =\n includeTags.length === 0 || includeTags.some((tag) => flowTags.includes(tag));\n\n // Exclude logic: if excludeTags is empty OR flow has none of the exclude tags\n const excludeMatch =\n excludeTags.length === 0 || !excludeTags.some((tag) => flowTags.includes(tag));\n\n return includeMatch && excludeMatch;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"findMaestroPathsFlowsToExecuteAsync.js","sourceRoot":"","sources":["../../src/utils/findMaestroPathsFlowsToExecuteAsync.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyC;AACzC,gDAAkC;AAGlC,2CAA6B;AAC7B,6BAAwB;AACxB,2CAA4C;AAC5C,0DAA2B;AAE3B,MAAM,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,IA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as path from 'node:path';\n\nimport { bunyan } from '@expo/logger';\nimport * as yaml from 'yaml';\nimport { z } from 'zod';\nimport { asyncResult } from '@expo/results';\nimport fg from 'fast-glob';\n\nconst FlowConfigSchema = z.object({\n name: z.string().optional(),\n tags: z.array(z.string()).optional(),\n});\n\nconst WorkspaceConfigSchema = z.object({\n flows: z.array(z.string()).optional(),\n executionOrder: z.record(z.unknown()).optional(),\n includeTags: z.array(z.string()).optional(),\n excludeTags: z.array(z.string()).optional(),\n});\n\ntype FlowConfig = z.infer<typeof FlowConfigSchema>;\ntype WorkspaceConfig = z.infer<typeof WorkspaceConfigSchema>;\n\nexport async function findMaestroPathsFlowsToExecuteAsync({\n workingDirectory,\n flowPath,\n includeTags: _includeTags,\n excludeTags: _excludeTags,\n logger,\n}: {\n workingDirectory: string;\n flowPath: string;\n includeTags: string[] | undefined;\n excludeTags: string[] | undefined;\n logger: bunyan;\n}): Promise<string[]> {\n const absoluteFlowPath = path.resolve(workingDirectory, flowPath);\n // If it's a file, just return it (no validation needed)\n const stat = await fs.stat(absoluteFlowPath);\n\n if (stat.isFile()) {\n logger.info(`Found a file: ${path.relative(workingDirectory, absoluteFlowPath)}`);\n return [absoluteFlowPath];\n }\n\n // It's a directory - discover flow files\n logger.info(`Found a directory: ${path.relative(workingDirectory, absoluteFlowPath)}`);\n\n // Check for workspace config\n logger.info(`Searching for workspace config...`);\n const workspaceConfig = await findAndParseWorkspaceConfigAsync({\n dirPath: absoluteFlowPath,\n workingDirectory,\n logger,\n });\n logger.info(`Using workspace config: ${JSON.stringify(workspaceConfig)}`);\n\n if (workspaceConfig?.executionOrder) {\n logger.warn(`Execution order is not supported yet. Ignoring.`);\n }\n\n logger.info(`Searching for flow files...`);\n const { flows } = await findAndParseFlowFilesAsync({\n dirPath: absoluteFlowPath,\n workingDirectory,\n workspaceConfig,\n logger,\n });\n\n if (flows.length === 0) {\n logger.info(\n `No valid flow files found in: ${path.relative(workingDirectory, absoluteFlowPath)}`\n );\n return [];\n }\n\n const includeTags = [...(_includeTags ?? []), ...(workspaceConfig?.includeTags ?? [])];\n const excludeTags = [...(_excludeTags ?? []), ...(workspaceConfig?.excludeTags ?? [])];\n\n if (includeTags.length === 0 && excludeTags.length === 0) {\n logger.info(`No tags provided, returning all flows.`);\n return flows.map(({ path }) => path);\n }\n\n logger.info(\n `Filtering flows by tags. Tags to include: ${JSON.stringify(includeTags)}. Tags to exclude: ${JSON.stringify(excludeTags) ?? 'none'}.`\n );\n return flows\n .filter(({ config, path: flowPath }) => {\n const shouldInclude = matchesTags({\n flowTags: config?.tags ?? [],\n includeTags,\n excludeTags,\n });\n\n logger.info(\n shouldInclude\n ? `- ${path.relative(workingDirectory, flowPath)} matches tags, including.`\n : `- ${path.relative(workingDirectory, flowPath)} does not match tags, excluding.`\n );\n\n return shouldInclude;\n })\n .map(({ path }) => path);\n}\n\nasync function findAndParseWorkspaceConfigAsync({\n dirPath,\n workingDirectory,\n logger,\n}: {\n dirPath: string;\n workingDirectory: string;\n logger: bunyan;\n}): Promise<WorkspaceConfig | null> {\n const configPaths = await fg(['config.yaml', 'config.yml'], {\n cwd: dirPath,\n absolute: true,\n });\n\n if (configPaths.length === 0) {\n logger.info(`No workspace config found in: ${path.relative(workingDirectory, dirPath)}`);\n return null;\n }\n\n for (const configPath of configPaths) {\n try {\n const content = await fs.readFile(configPath, 'utf-8');\n const configDoc = yaml.parse(content);\n if (!configDoc) {\n logger.warn(\n `No content found in workspace config: ${path.relative(workingDirectory, configPath)}`\n );\n continue;\n }\n logger.info(`Using workspace config from: ${path.relative(workingDirectory, configPath)}`);\n return WorkspaceConfigSchema.parse(configDoc);\n } catch (err) {\n logger.warn(\n { err },\n `Failed to parse workspace config: ${path.relative(workingDirectory, configPath)}`\n );\n continue;\n }\n }\n\n logger.info(`No valid workspace config found in: ${path.relative(workingDirectory, dirPath)}`);\n return null;\n}\n\nasync function findAndParseFlowFilesAsync({\n workingDirectory,\n dirPath,\n workspaceConfig,\n logger,\n}: {\n workingDirectory: string;\n dirPath: string;\n workspaceConfig: WorkspaceConfig | null;\n logger: bunyan;\n}): Promise<{ flows: { config: FlowConfig; path: string }[] }> {\n const flows: { config: FlowConfig; path: string }[] = [];\n\n // Determine flow patterns from config or use default\n const flowPatterns = workspaceConfig?.flows ?? ['*'];\n logger.info(`Using flow patterns: ${JSON.stringify(flowPatterns)}`);\n\n logger.info(`Searching for flows with patterns: ${JSON.stringify(flowPatterns)}`, {\n cwd: dirPath,\n fg: flowPatterns,\n });\n\n // Use fast-glob to find matching files\n const matchedFiles = await fg(flowPatterns, {\n cwd: dirPath,\n absolute: true,\n onlyFiles: true,\n ignore: ['*/config.yaml', '*/config.yml'], // Skip workspace config files\n });\n\n logger.info(`Found ${matchedFiles.length} potential flow files`);\n\n // Parse each matched file\n for (const filePath of matchedFiles) {\n // Skip non-YAML files\n const ext = path.extname(filePath);\n if (ext !== '.yaml' && ext !== '.yml') {\n logger.info(`Skipping non-YAML file: ${path.relative(workingDirectory, filePath)}`);\n continue;\n }\n\n const result = await asyncResult(parseFlowFile(filePath));\n if (result.ok) {\n logger.info(`Found flow file: ${path.relative(workingDirectory, filePath)}`);\n flows.push({ config: result.value, path: filePath });\n } else {\n logger.info(\n { err: result.reason },\n `Skipping flow file: ${path.relative(workingDirectory, filePath)}`\n );\n }\n }\n\n return { flows };\n}\n\nasync function parseFlowFile(filePath: string): Promise<FlowConfig> {\n const content = await fs.readFile(filePath, 'utf-8');\n const documents = yaml.parseAllDocuments(content);\n const configDoc = documents[0];\n if (!configDoc) {\n throw new Error(`No config section found in ${filePath}`);\n }\n return FlowConfigSchema.parse(configDoc.toJS());\n}\n\nfunction matchesTags({\n flowTags,\n includeTags,\n excludeTags,\n}: {\n flowTags: string[];\n includeTags: string[];\n excludeTags: string[];\n}): boolean {\n // Include logic: if includeTags is empty OR flow has any of the include tags\n const includeMatch =\n includeTags.length === 0 || includeTags.some((tag) => flowTags.includes(tag));\n\n // Exclude logic: if excludeTags is empty OR flow has none of the exclude tags\n const excludeMatch =\n excludeTags.length === 0 || !excludeTags.some((tag) => flowTags.includes(tag));\n\n return includeMatch && excludeMatch;\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.201",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"@expo/config": "10.0.6",
|
|
28
28
|
"@expo/config-plugins": "9.0.12",
|
|
29
29
|
"@expo/downloader": "1.0.118",
|
|
30
|
-
"@expo/eas-build-job": "1.0.
|
|
30
|
+
"@expo/eas-build-job": "1.0.201",
|
|
31
31
|
"@expo/env": "^0.4.0",
|
|
32
32
|
"@expo/logger": "1.0.117",
|
|
33
33
|
"@expo/package-manager": "1.7.0",
|
|
34
34
|
"@expo/plist": "^0.2.0",
|
|
35
35
|
"@expo/results": "^1.0.0",
|
|
36
|
-
"@expo/steps": "1.0.
|
|
36
|
+
"@expo/steps": "1.0.201",
|
|
37
37
|
"@expo/template-file": "1.0.117",
|
|
38
38
|
"@expo/turtle-spawn": "1.0.117",
|
|
39
39
|
"@expo/xcpretty": "^4.3.1",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"node": "20.14.0",
|
|
80
80
|
"yarn": "1.22.21"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "e21b7635fbf5b790298aab532f7968f5647718a5"
|
|
83
83
|
}
|