Edit in GitHubLog an issue

Custom project templates

The PWA Studio scaffolding tool uses the venia-concept package as the default template for new storefront projects, but you can use your own custom project template if it contains the necessary instructions.

Buildpack folder#

The presence of a create.js file inside a _buildpack directory indicates that a project can be used as a template for the scaffolding command. You can see an example of this directory in the venia-concept package.

The create.js file#

The create.js file defines a function that returns an object with ignores, before, visitor, and after properties. These properties are functions that provide instructions for the buildpack create-project command.

The function defined in create.js is passed in an object with the following properties:

  • fs - An instance of the fs-extra library, which provides utilities for most of the common copy operations.
  • tasks - An object which provides common handlers that template developers can use for globs.
  • options - An object that contains the parameters used in the buildpack create-project command.

When the create project command executes, it walks the template project's directory tree and applies the instructions provided by the returned object's properties.


The ignores property is an array of glob patterns. Files that match these patterns are not processed by the create project command.

Use this property to prevent the create command from processing project-specific or unimportant files.


The before property defines a function that runs before the command walks the directory tree. Use this property to add pre-processing logic during project creation.


The visitor property is a mapping object that maps a glob pattern to a file handler function. The glob pattern is the map key, and the file handler function is the value associated with that key.

When the project creation tool walks the directory tree, it looks for files that match each glob pattern and runs the visitor function associated with that pattern.

Use this property to perform custom transformation logic on a file before copying it to the new project.

Copied to your clipboard
2 visitor: {
3 'package.json': ({ path, targetPath, options }) => {
4 const pkg = fs.readJsonSync(path);
5 pkg.name = options.name;
6 fs.writeJsonSync(targetPath, JSON.stringify(pkg, null, 4));
7 }
8 }

This is an example of a visitor property that targets the template project's package.json file and modifies its name before writing it out to the targetPath.


The after property defines a function that runs after the command walks the directory tree. Use this property to add post-processing logic during project creation.

  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.