Skip to content

Stratum Block Creations

Recap: Bingo creations may specify two areas of repositories:

Block Productions may produce any properties from standard Bingo creations. They may also produce a new extensions property to add Props to other Blocks.

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:

.gitignore
/lib
/node_modules

See also: