Bases
A Base defines an object of option types and default values that will be used to scaffold a repository. Bases are used to generate Blocks and Presets that rely on user-specified values for those options.
Options
Each Base is associated with a set of options represented by Zod schemas. Each property of those options represents a configurable value that can be provided by a user. Those options carry through to Blocks and Presets associated with the base.
For example, this minimal Base stores only a name
string:
import { createBase } from "bingo-stratum";import { z } from "zod";
export const base = createBase({ options: { name: z.string(), },});
Blocks and Presets made with that base
will have access to the name
option of type string
.
options
on a Base works the same ascreateTemplate
>options
.
Disallowed Option Names
The only option name that may not be used is preset
.
That option is set automatically per Templates > Options.
Preparation
Bases can optionally define a prepare()
function that provides default fallback values for options.
For example, this Base defaults its value
option to "default"
if not provided:
import { createBase } from "bingo-stratum";import { z } from "zod";
export const base = createBase({ options: { value: z.string().optional(), }, prepare() { return { value: "default", }; },});
prepare()
on a Base works the same ascreateTemplate
>prepare
.