/toolkit-template

Template used to create new components

Primary LanguageJavaScriptMIT LicenseMIT

Toolkit Template

Repository template for creating a new Web Component, specifically tailored to be part of the Web at Illinois Web Implementation Guidelines Group (WIGG) Toolkit.

How To Use

Important

Follow the steps in the toolkit-management documentation to contribute a component to the toolkit.

How this template works

The content that will be in the resulting repository is templated under the template directory. The templating is configured in index.js, and uses a simple scaffolding tool called CAZ.

There is a templating GitHub Workflow in this repository that's configured to run only once when the template is used. That workflow executes CAZ to scaffold the repository to the proper contents with the naming determined by the new repository's name.

CAZ accepts input using "prompts", which can be specified in the command line invocation of the tool. The workflow specifies the values to those prompts, and CAZ takes care of the rest.

Finally, the workflow commits the changes to the new repository. This usually takes less than 10 seconds. Once done, the repository is ready to be worked on.

Developing this template

Adding files

New files can be added to the template directory, and they are automatically picked up.

  • Substitutions in file names happen with curly braces, {variable}
  • Inside files, lodash templates are used, which uses <%= variable %> as delimiters.

Note

GitHub Workflows cannot be templated, and so must be entirely dynamic and contained in the main .github/workflows directory.

Adding Variables

If additional variables are needed, they must be added in two locations:

  1. In index.js as prompts.
  2. In the workflow, they need to be given values as arguments for the caz command.