At a Glance
Language
YAML
Tags
Drupal Ops
Summary

Learn how to use the Drupal Composer Scaffolding plugin - both customizing it in your site and creating new data sources for it to standardize and improve your site builds. Presented at DrupalCon 2023 Pittsburgh

Prerequisites
  • Some composer knowledge
  • Drupal 8.8+ (10+ recommended because it is awesome)

# Introduction

Drupal Composer Scaffold, is a composer plugin maintained as part of Drupal Core (although separate composer package). It allows other packages to provide compose metadata to make composer install specific files in specific places. This can be overriden in your root composer.json for any file - disable or change the location, or patch/append/prepend.

# Recorded Session from DrupalCon Pittsburgh

# Details

For those that don't like listening to sessions or would rather just read/use text, continue on. First, here are the slides:

The slides above provide example code for both using scaffolding in your end projects and for creating your own Scaffold data sources - see also, longer form example code.

To put it as briefly as possible, to use scaffolding:

  • Add allowed project(s) to extra config
  • Set webroot in extra config
  • Adjust any files as needed
  • run composer install/require/update and scaffolding will automatically happen.

To make a datasource:

  • Create a new project with just a readme, and basic composer.json.
  • Add files as desired to /assets/ and define where they go in your composer.json
  • Make sure to version your repo
  • Add to projects whether through private packagist, repo link or locally.