MCPcopy Create free account
hub / github.com/expo/eas-cli / createCustomFunctionCall

Function createCustomFunctionCall

packages/steps/src/utils/customFunction.ts:43–82  ·  view source on GitHub ↗
(rawCustomFunctionModulePath: string)

Source from the content-addressed store, hash-verified

41}
42
43export function createCustomFunctionCall(rawCustomFunctionModulePath: string): BuildStepFunction {
44 return async (ctx, { env, inputs, outputs }) => {
45 let customFunctionModulePath = rawCustomFunctionModulePath;
46 if (!(await fs.exists(ctx.global.projectSourceDirectory))) {
47 const relative = path.relative(
48 path.resolve(ctx.global.projectSourceDirectory),
49 customFunctionModulePath
50 );
51 customFunctionModulePath = path.resolve(
52 path.join(ctx.global.projectTargetDirectory, relative)
53 );
54 }
55 const serializedArguments: SerializedCustomBuildFunctionArguments = {
56 env,
57 inputs: serializeInputs(inputs),
58 outputs: Object.fromEntries(
59 Object.entries(outputs).map(([id, output]) => [id, output.serialize()])
60 ),
61 ctx: ctx.serialize(),
62 };
63 try {
64 await spawnAsync(
65 'node',
66 [
67 path.join(SCRIPTS_PATH, 'runCustomFunction.js'),
68 customFunctionModulePath,
69 JSON.stringify(serializedArguments),
70 ],
71 {
72 logger: ctx.logger,
73 cwd: ctx.workingDirectory,
74 env,
75 stdio: 'pipe',
76 }
77 );
78 } catch {
79 throw new Error(`Custom function exited with non-zero exit code.`);
80 }
81 };
82}

Calls 3

spawnAsyncFunction · 0.90
serializeInputsFunction · 0.85
serializeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…