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.js
configuration file thatexport default
s 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
The exported createConfig
function takes in an object containing any options
and/or settings
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@beta
in a repository with that create-typescript-app.config.js
would be the equivalent of running npx create-typescript-app@beta --preset everything
.
settings
Any custom settings 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({ options: { preset: "everything", }, settings: { blocks: { remove: [blockCSpell], }, },});
Running npx create-typescript-app@beta
in a repository with that create-typescript-app.config.js
would be the equivalent of running npx create-typescript-app@beta --preset everything
, except all CSpell-related files and scripts would be skipped.