Skip to main content
Ungathered Thoughts

Testing a fork of Sector distribution

This is my notes on how to test a fork of Sector. This is tricky because we are using composer create-project and Composer needs to recursively resolve package dependencies, and we're testing a change in a required package.


We want to test that running composer create-project sparksinteractive/sector-project will do the right thing with a patch which we've submitted to a dependency, sparksinteractive/sector-distribution. Our change will be that we are modifying composer.json in the distribution project to use an updated patch to another contrib module.



If Composer appears to not notice your changes, clear your Composer cache with composer clearcache. This can add ~5min to your next download run.


Identify your working directory

I'm going to do this in /tmp so all paths are short.

Clone both projects there

cd /tmp
git clone sector-distribution
git clone sector-project

Modify sector-project to reference the local copy of sector-distribution

In /tmp/sector-project, modify composer.json to add a new local repository entry in the repositories key.

commit ee8af146a1643f3cfce4de6fafe00af77ab227a2 (HEAD -> local-distro)
Author: Chris Burgess <>
Date: Tue Aug 3 23:44:53 2021 +1200

Use local copy of sector-distribution

diff --git a/composer.json b/composer.json
index d594d36..20e3bf0 100644
--- a/composer.json
+++ b/composer.json
@@ -39,6 +39,16 @@
"repositories": {
+ "sector-distribution-local": {
+ "type": "path",
+ "url": "/tmp/sector-distribution",
+ "options": {
+ "symlink": false,
+ "versions": {
+ "sparksinteractive/sector-distribution": "9.1.4"
+ }
+ }
+ },
"packagist.drupal": {
"type": "composer",
"url": ""
key value description
type path use the current state of this local directory
url /tmp/sector-distribution the local path to your modified distribution codebase
options.symlink false copy the files into place
options.versions sparksinteractive/sector-distribution: 9.1.4 increment above the current release

Modify sector-distribution to reference the upstream patch we want

In /tmp/sector-distribution, modify composer.json to update the patch URL we want to change. (This could be any other change to the local distro codebase.)

commit a5dd78ffbb61667f5a191467f6d767d980b6f01c (HEAD -> patch-updates)
Author: Chris Burgess <>
Date: Tue Aug 3 23:47:49 2021 +1200

Update patch for Menu Block

diff --git a/composer.json b/composer.json
index be7ab2e..aa931e4 100644
--- a/composer.json
+++ b/composer.json
@@ -103,7 +103,7 @@
"patches": {
"drupal/menu_block": {
"No contextual link to edit menu": "",
- "Hide menu block title if empty": ""
+ "Hide menu block title if empty": ""
"drupal/entity_usage": {
"Better tracking per entity": ""

Run create-project with the additional args required

Switch back to the parent directory, and run composer create-project with a --repository parameter which will instruct Composer to discover the local copy of sector-project and create the templated site in subdirectory sector-test.

cd /tmp
composer create-project --prefer-dist --repository='{"type":"path", "url":"/tmp/sector-project","options":{"symlink":false, "versions":{"sparksinteractive/sector-project":"9.1.4"}}}' sparksinteractive/sector-project sector-test

Keys and values here are much as documented in the changes for sector-project.

Verify that the output contains the correct applied patch

  - Applying patches for drupal/menu_block (No contextual link to edit menu) (Hide menu block title if empty)