Skip to content

Templates

A Template defines a group of Presets that can be chosen between by a user.

Templates are the highest level of grouping in create projects. CLI APIs like npx create *-app will work by pointing to a Template and asking the user to choose between their presets.

For example, this Template groups several levels of tooling from a create-typescript-app-like generator:

import { createTemplate } from "create";
import { presetCommon } from "./presetCommon";
import { presetEverything } from "./presetEverything";
import { presetMinimal } from "./presetMinimal";
export const templateTypeScriptApp = createTemplate({
about: {
name: "TypeScript App",
},
default: "common",
presets: [
{ label: "minimal", preset: presetMinimal },
{ label: "common", preset: presetCommon },
{ label: "everything", preset: presetEverything },
],
});

A CLI like npx create can then work with that Template to prompt the user for choosing a Preset:

Terminal window
$ npx create typescript-app
create
Welcome to create: a delightful repository templating engine.
Learn more about create on:
https://create.bingo
Running with mode --create for a new repository using the template:
create-typescript-app
|
Made with 💝 in Boston by Josh Goldberg.