Configuration
Most options for Bingo templates can be specified on the CLI. However, for describing complex options and/or keeping them persist over time, you may want to create a configuration file. Bingo configuration files are useful if you:
- Have rich customizations to the template that should be applied to the repository
- Keep your repository updating to the latest template versions using Execution > Transition Mode
Bingo templates each:
- Provide a
createConfig()function that creates a configuration object. - Support reading a
*.config.*configuration file thatexport defaults that object.
For example, this configuration keeps a repository up-to-date with create-example:
import { createConfig } from "create-example";
export default createConfig({ options: { title: "Hello, world!", },});Running npx create-example in a repository with that create-example.config.js would be the equivalent of running npx create-example --title "Hello, world!".
createConfig
Each template’s exported createConfig function takes in an object containing any options and/or refinements to be passed to the template.
options
Any type-safe options the template has declared.
For example, this configuration keeps a repository up-to-date with create-typescript-app, which requires a preset option to be specified:
import { createConfig } from "create-typescript-app";
export default createConfig({ options: { preset: "everything", },});Running npx create-typescript-app in a repository with that configuration file would be the equivalent of running npx create-typescript-app --preset everything.
refinements
Any custom customizations specified by the template.
For example, this configuration customizes the preset list of blocks in create-typescript-app’s Everything preset:
import { blockCSpell, createConfig } from "create-typescript-app";
export default createConfig({ refinements: { blocks: { exclude: [blockCSpell], }, },});Running npx create-typescript-app in a repository with that configuration file would be the equivalent of running npx create-typescript-app --preset everything, except it would not apply any CSpell-related files or scripts.