Open nickwesselman opened 1 year ago
@nickwesselman Are you thinking of exposing something like this:
// This is the result of function-runner
interface Result {
name: string;
size: number;
memoryUsage: number;
instructions: number;
logs: string;
output: OutputType;
}
export function run<InputType, OutputType>(modulePath: string, input: InputType): Result<OutputType> {
// ...
}
Yes that looks right! I fixed the link to potential usage in the issue description.
Do we need to solve or account for the 'first download' issue that I had to workaround here?
I don't believe so since we'll be building this directly in @shopify/function-runner
. We can modify the code so that it doesn't print that.
In addition to facilitating execution via
npx
, would be great if this library allowed you to programmatically invoke the function-runner in test scripts, and even automated integration tests.Example of such usage
A good validation case for this would be adding an integration test to samples in
function-examples
.