Skip to content

Inputs

An Input is how template options can use external resources such as the file system. Each input defines:

  • Any number of arguments that it takes in
  • A production method that reads from system resources

Inputs are created using APIs > createInput().

For example, this Input defines a required path string to read from a file on disk:

import { createInput } from "bingo";
import { z } from "zod";
export const inputFromFile = createInput({
args: {
path: z.string(),
},
async produce({ args, fs }) {
return await fs.readFile(args.path);
},
});

Using take and Inputs to access external resources allows for straightforward mocking of those resources during unit tests. See Templating FAQs > Why should we use take and Inputs in prepare()?.

Provided Inputs

Bingo manages a small set of commonly useful Inputs:

See those individual packages for their documentation.

Made with 💝 in Boston by Josh Goldberg.