|
| 1 | +# Instructions |
| 2 | + |
| 3 | +These instructions will work for new installs on a Vanilla Drupal site as well as for updating an existing Webspark site. We are consolidating the Webspark profile into a single package to simplify maintenance and updates going forward. This means that some small adjustments may be necessary to bring your codebase into compliance with these changes. |
| 4 | + |
| 5 | +## Delete the existing webspark profile (if it exists) |
| 6 | + |
| 7 | +Delete the existing webspark profile folder located at `docroot/profiles/webspark`. You can do this with `rm -rf docroot/profiles/webspark` from your terminal. |
| 8 | + |
| 9 | +## Delete the existing webspark modules and theme (if they exist) |
| 10 | + |
| 11 | +Delete the existing webspark modules and theme folders: |
| 12 | + |
| 13 | +- `rm -rf docroot/modules/webspark` |
| 14 | +- `rm -rf docroot/themes/webspark` |
| 15 | + |
| 16 | +## Temporarily remove root required dependencies |
| 17 | + |
| 18 | +- In order to properly install the consolidated webspark profile, you will need to TEMPORARILY remove all of the required packages from your root `composer.json` file. |
| 19 | +- We recommend copying the entire `require` section from your root `composer.json` file and pasting it into a temporary text file for safekeeping. You will need to reference this later when moving non-Webspark packages to the `custom-dependencies` folder. |
| 20 | +- After you have removed the `require` section from your root `composer.json` file, save the file. |
| 21 | + |
| 22 | +## Delete the composer.lock file |
| 23 | + |
| 24 | +To avoid dependency clashes, remove the root-level composer.lock file. |
| 25 | + |
| 26 | +## Temporarily remove patches |
| 27 | + |
| 28 | +- The `composer.patches.json` file at the root of your repository needs to be adjusted. Compare it with the version located in `docroot/profiles/contrib/webspark/sample-webspark-dependencies/patches.webspark.json` and remove any of the items that exist in that file from the root `composer.patches.json` file. |
| 29 | +- Then, take what is remaining, copy it, and paste it into a temporary text file. |
| 30 | +- Your root `composer.patches.json` file should basically be empty now, leaving only the following content: |
| 31 | + |
| 32 | +```json |
| 33 | +{ |
| 34 | + "patches": {} |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +## Get the required composer packages |
| 39 | + |
| 40 | +Install the necessary composer packages by running the following command in your terminal: |
| 41 | + |
| 42 | +``` |
| 43 | +ddev composer require asuwebplatforms/webspark:^2.16.4 wikimedia/composer-merge-plugin:^2.1.0 |
| 44 | +``` |
| 45 | + |
| 46 | +## Add custom-dependencies directory (if it doesn't exist) |
| 47 | + |
| 48 | +- If your repository does not already have a `custom-dependencies` directory at the root level, you will need to create it. You can do so by copying the `sample-custom-dependencies` directory from this profile and pasting it into the root of your repository. Then, rename the copied directory from `sample-custom-dependencies` to `custom-dependencies`. |
| 49 | +- If you already have a `custom-dependencies` directory, you should ensure that its contents include everything that is in the `sample-custom-dependencies` directory, making adjustments as necessary. |
| 50 | + - If you have a `scripts` directory in your existing `custom-dependencies` folder, please delete it. |
| 51 | + - If you have a `patches` directory in your existing `custom-dependencies` folder, you can keep it, if it has local patch files that you need for your site. |
| 52 | + |
| 53 | +For more information about the `custom-dependencies` folder and its purpose, please refer to the README file located within that directory. |
| 54 | + |
| 55 | +## Add webspark-dependencies directory |
| 56 | + |
| 57 | +- If your repository contains an `upstream-configuration` directory at the root level, you will need to delete it. This directory is no longer needed with the newly consolidated webspark profile (as of Webspark 2.16.4). |
| 58 | +- Copy the `sample-webspark-dependencies` directory from this profile and paste it into the root of your repository. |
| 59 | +- Rename the copied directory from `sample-webspark-dependencies` to `webspark-dependencies`. |
| 60 | +- Edit the namespace declarations in the two PHP files within the `scripts` directory to be `WebsparkCustomScripts` instead of `SampleWebsparkCustomScripts` and save them. |
| 61 | + |
| 62 | +For more information about the `webspark-dependencies` folder and its purpose, please refer to the README file located within that directory. |
| 63 | + |
| 64 | +## Re-add patches |
| 65 | + |
| 66 | +Compare what you saved into a temporary text file with what exists in `custom-dependencies/patches.custom.json`, making sure that the `custom-dependencies/patches.custom.json` file contains all of the patches unique to your site. |
| 67 | + |
| 68 | +From this point on, the root `composer.patches.json` file will be dynamically populated via a composer script that combines the patches in your custom-dependencies `patches.custom.json` file and the webspark profile's `patches.webspark.json` file when you run `composer update` or `composer install`. |
| 69 | + |
| 70 | +## Adjust your composer.json |
| 71 | + |
| 72 | +You will need to adjust your root `composer.json` file to ONLY have three items in its `require` section, as seen below. To accomplish this, you will need to move some items to the new `custom-dependencies` folder as described in the next section. |
| 73 | + |
| 74 | +```json |
| 75 | + "require": { |
| 76 | + "asu/custom-dependencies": "*", |
| 77 | + "asuwebplatforms/webspark": "^2.16.4", |
| 78 | + "wikimedia/composer-merge-plugin": "^2.1.0", |
| 79 | + }, |
| 80 | +``` |
| 81 | + |
| 82 | +## Move non-Webspark composer packages to the custom-dependencies composer.json file |
| 83 | + |
| 84 | +- Compare the `require` items you pasted into a temporary text file from the root composer.json file with composer.json file located in `docroot/profiles/contrib/webspark/composer.json` and remove any items in your temporary file that duplicate what is in the profile. |
| 85 | +- Any remaining items, other than the three indicated above in the `require` section, will need to be moved into the appropriate `composer.json` file in the `custom-dependencies` folder. |
| 86 | + |
| 87 | +## Update your root composer.json's extra, autoload, scripts, repositories and require-dev sections |
| 88 | + |
| 89 | +For the Webspark profile to work properly, you will need to ensure that the following sections in your root `composer.json` file include the following items, at a minimum: |
| 90 | + |
| 91 | +```json |
| 92 | + "extra": { |
| 93 | + "merge-plugin": { |
| 94 | + "require": [ |
| 95 | + "docroot/modules/contrib/webform/composer.libraries.json" |
| 96 | + ], |
| 97 | + "recurse": true, |
| 98 | + "replace": false, |
| 99 | + "ignore-duplicates": false, |
| 100 | + "merge-dev": true, |
| 101 | + "merge-extra": false, |
| 102 | + "merge-extra-deep": false, |
| 103 | + "merge-replace": true, |
| 104 | + "merge-scripts": true |
| 105 | + }, |
| 106 | + "drupal-scaffold": { |
| 107 | + "allowed-packages": [ |
| 108 | + "drupal/core" |
| 109 | + ], |
| 110 | + "locations": { |
| 111 | + "web-root": "./docroot" |
| 112 | + }, |
| 113 | + "file-mapping": { |
| 114 | + "[web-root]/.htaccess": false, |
| 115 | + "[web-root]/robots.txt": false, |
| 116 | + "[profile-root]/.editorconfig": false, |
| 117 | + "[profile-root]/.gitattributes": false, |
| 118 | + "[profile-root]/.coveralls.yml": false, |
| 119 | + "[profile-root]/.travis.yml": false, |
| 120 | + "[profile-root]/.gitignore": false, |
| 121 | + "[profile-root]/acquia-pipelines.yml": false, |
| 122 | + "[profile-root]/grumphp.yml": false |
| 123 | + }, |
| 124 | + "gitignore": true, |
| 125 | + "excludes": [ |
| 126 | + ".htaccess" |
| 127 | + ] |
| 128 | + }, |
| 129 | + "enable-patching": true, |
| 130 | + "patches-file": "composer.patches.json", |
| 131 | + "installer-paths": { |
| 132 | + "docroot/core": [ |
| 133 | + "type:drupal-core" |
| 134 | + ], |
| 135 | + "docroot/libraries/{$name}": [ |
| 136 | + "type:drupal-library", |
| 137 | + "type:bower-asset", |
| 138 | + "type:npm-asset" |
| 139 | + ], |
| 140 | + "docroot/modules/contrib/{$name}": [ |
| 141 | + "type:drupal-module" |
| 142 | + ], |
| 143 | + "docroot/profiles/contrib/{$name}": [ |
| 144 | + "type:drupal-profile" |
| 145 | + ], |
| 146 | + "docroot/themes/contrib/{$name}": [ |
| 147 | + "type:drupal-theme" |
| 148 | + ], |
| 149 | + "docroot/modules/custom/{$name}": [ |
| 150 | + "type:drupal-custom-module" |
| 151 | + ], |
| 152 | + "docroot/profiles/custom/{$name}": [ |
| 153 | + "type:drupal-custom-profile" |
| 154 | + ], |
| 155 | + "docroot/themes/custom/{$name}": [ |
| 156 | + "type:drupal-custom-theme" |
| 157 | + ], |
| 158 | + "drush/Commands/contrib/{$name}": [ |
| 159 | + "type:drupal-drush" |
| 160 | + ], |
| 161 | + "docroot/libraries/ckeditor/plugins/{$name}": [ |
| 162 | + "vendor:ckeditor-plugin" |
| 163 | + ] |
| 164 | + }, |
| 165 | + "installer-types": [ |
| 166 | + "bower-asset", |
| 167 | + "npm-asset" |
| 168 | + ], |
| 169 | + "patchLevel": { |
| 170 | + "drupal/core": "-p2" |
| 171 | + } |
| 172 | + }, |
| 173 | + "autoload": { |
| 174 | + "classmap": [ |
| 175 | + "webspark-dependencies/scripts/ComposerScripts.php", |
| 176 | + "webspark-dependencies/scripts/CustomComposerScripts.php" |
| 177 | + ] |
| 178 | + }, |
| 179 | + "scripts": { |
| 180 | + "pre-autoload-dump": [ |
| 181 | + "bash webspark-dependencies/scripts/pre-autoload-check" |
| 182 | + ], |
| 183 | + "pre-command-run": [ |
| 184 | + "WebsparkCustomScripts\\CustomComposerScripts::checkCommand", |
| 185 | + "WebsparkCustomScripts\\ComposerScripts::writeComposerPatchFile" |
| 186 | + ], |
| 187 | + "pre-update-cmd": [ |
| 188 | + "WebsparkCustomScripts\\ComposerScripts::preUpdate" |
| 189 | + ], |
| 190 | + "post-update-cmd": [ |
| 191 | + "bash docroot/profiles/contrib/webspark/sync-dependencies", |
| 192 | + "WebsparkCustomScripts\\ComposerScripts::postUpdate" |
| 193 | + ], |
| 194 | + "post-install-cmd": [ |
| 195 | + "bash docroot/profiles/contrib/webspark/sync-dependencies" |
| 196 | + ], |
| 197 | + "custom-require": [ |
| 198 | + "WebsparkCustomScripts\\CustomComposerScripts::customRequire" |
| 199 | + ], |
| 200 | + "custom-remove": [ |
| 201 | + "WebsparkCustomScripts\\CustomComposerScripts::customRemove" |
| 202 | + ] |
| 203 | + }, |
| 204 | + "repositories": [ |
| 205 | + { |
| 206 | + "type": "composer", |
| 207 | + "url": "https://packages.drupal.org/8" |
| 208 | + }, |
| 209 | + { |
| 210 | + "type": "composer", |
| 211 | + "url": "https://asset-packagist.org" |
| 212 | + }, |
| 213 | + { |
| 214 | + "type": "path", |
| 215 | + "url": "custom-dependencies" |
| 216 | + }, |
| 217 | + { |
| 218 | + "type": "package", |
| 219 | + "package": { |
| 220 | + "name": "fontawesome/fontawesome", |
| 221 | + "version": "6.4.2", |
| 222 | + "type": "drupal-library", |
| 223 | + "extra": { |
| 224 | + "installer-name": "fontawesome" |
| 225 | + }, |
| 226 | + "dist": { |
| 227 | + "url": "https://use.fontawesome.com/releases/v6.4.2/fontawesome-free-6.4.2-web.zip", |
| 228 | + "type": "zip" |
| 229 | + } |
| 230 | + } |
| 231 | + }, |
| 232 | + { |
| 233 | + "type": "package", |
| 234 | + "package": { |
| 235 | + "name": "northernco/ckeditor5-anchor-drupal", |
| 236 | + "version": "0.4.0", |
| 237 | + "type": "drupal-library", |
| 238 | + "dist": { |
| 239 | + "url": "https://registry.npmjs.org/@northernco/ckeditor5-anchor-drupal/-/ckeditor5-anchor-drupal-0.4.0.tgz", |
| 240 | + "type": "tar" |
| 241 | + } |
| 242 | + } |
| 243 | + } |
| 244 | + ], |
| 245 | + "require-dev": { |
| 246 | + "drupal/core-dev": "10.5.8" |
| 247 | + } |
| 248 | +``` |
| 249 | + |
| 250 | +## Update composer |
| 251 | + |
| 252 | +Run `ddev composer update` to ensure all dependencies are correctly installed and updated. |
| 253 | + |
| 254 | +## Verify the update |
| 255 | + |
| 256 | +During the update process, pay close attention to the output in your terminal. You should see something like the following (truncated for brevity): |
| 257 | + |
| 258 | +``` |
| 259 | +> WebsparkCustomScripts\CustomComposerScripts::checkCommand |
| 260 | +> WebsparkCustomScripts\ComposerScripts::writeComposerPatchFile |
| 261 | +Gathering patches from patch file. |
| 262 | +Removing package drupal/cas so that it can be re-installed and re-patched. |
| 263 | + - Removing drupal/cas (2.3.2) |
| 264 | +... |
| 265 | +Deleting /var/www/html/docroot/modules/contrib/cas - deleted |
| 266 | +> WebsparkCustomScripts\ComposerScripts::preUpdate |
| 267 | +Using version 'dev-main' for path repositories. |
| 268 | +Loading composer repositories with package information |
| 269 | +Updating dependencies |
| 270 | +Lock file operations: 26 installs, 1 update, 1 removal |
| 271 | +... |
| 272 | +Writing lock file |
| 273 | +Installing dependencies from lock file (including require-dev) |
| 274 | +Package operations: 34 installs, 1 update, 1 removal |
| 275 | + - Downloading asuwebplatforms/webspark (dev-main 02fa4b5) |
| 276 | +... |
| 277 | +Gathering patches from patch file. |
| 278 | +Gathering patches for dependencies. This might take a minute. |
| 279 | + - Installing algolia/places (1.19.0): Extracting archive |
| 280 | + - Installing asu/custom-dependencies (dev-main): Symlinking from custom-dependencies |
| 281 | + - Installing drupal/core (10.3.14): Extracting archive |
| 282 | +... |
| 283 | + - Applying patches for drupal/core |
| 284 | + https://www.drupal.org/files/issues/2022-07-13/f245f21ea664f22c81d8d28c6f0f4a42fb9a5890.patch (#2951547: Fix issue with layout overflow) |
| 285 | + https://www.drupal.org/files/issues/2024-05-16/core-10.2.3-xss-refactor_filter_attributes-3109650-74.patch (#3109650: Refactor Xss::attributes() to allow filtering of style attribute values) |
| 286 | + https://www.drupal.org/files/issues/2024-02-15/3415961.patch (#3415961: Fix issue with focus after inserting media via the modal dialog) |
| 287 | + https://www.drupal.org/files/issues/2024-08-14/3386605-9-add-ckeditor5-support-for-webp.patch (#3386605: Add CKEditor 5 support for WebP images) |
| 288 | +... |
| 289 | +Package doctrine/annotations is abandoned, you should avoid using it. No replacement was suggested. |
| 290 | +Generating autoload files |
| 291 | +... |
| 292 | +> WebsparkCustomScripts\ComposerScripts::postUpdate |
| 293 | +Successfully combined ASUAwesome and Font Awesome icons |
| 294 | +``` |
| 295 | + |
| 296 | +Open the `composer.patches.json` file at the root of your project and verify that it has been populated with the patches from both the webspark profile and your custom-dependencies. |
| 297 | + |
| 298 | +If you encountered no issues or errors during the update process, you have successfully updated your project to use the consolidated webspark profile! |
0 commit comments