Stratum Block Creations
Recap: Bingo creations may specify two areas of repositories:
- “Direct” creations: that always cause changes to the repository
- “Indirect” creations: to hint to the Bingo CLI
Block Productions may produce any properties from standard Bingo creations.
They may also produce a new extensions property to add Props to other Blocks.
extensions
Section titled “extensions”Any Props for other blocks, that this Block wants to be included in the created repository.
For example, given the following blockGitignore with an ignores Prop, a blockTypeScript could signal to ignore the /lib directory:
import { z } from 'zod';
import { base } from './base';
export const blockGitignore = base.createBlock({ props: { ignores: z.array(z.string()).default([]), }, produce({ props }) { return { files: { '.gitignore': [...props.ignores, '/node_modules'].join('\n'), }, }; },});
export const blockTypeScript = base.createBlock({ produce() { return { extensions: [ blockGitignore({ ignores: ['/lib'], }), ], files: { 'tsconfig.json': JSON.stringify({ compilerOptions: { outDir: 'lib', strict: true, }, }), }, }; },});Producing a template with those two Blocks would result in a .gitignore with two ignored directories:
/lib/node_modulesSee also:
- Concepts > Blocks > Merging for how Props are merged
- Details > Execution for how Stratum templates execute their Blocks