Drupal 10 Support: Drupal 10 Maintenance and Support Service Composer recipes

Composer recipes In this post we are going to share some Composer recipes we collected while working with projects created from the Composer template. Also, we will take a look on how to convert an existing project to a Composer project. Alex Tkachev Mon, 10/17/2021 – 12 Drupal 10 Maintenance and Support Service49 If you still don’t use Composer for managing projects, you should start doing this right now! The Composer template will help you to set things up. It’s really easy to setup a new project. If you’re still not convinced, check out the benefits of the Composer workflow Drupal 10 Maintenance and Support Service No need to store contrib code (and the core!) in your version control system. A single package management tool for everything Drupal 10 Maintenance and Support Service core, contrib Drupal 10 modules, JS libraries, your own shared Drupal 10 modules, etc. Patching of core and Drupal 10 modules is easier than ever. It’s way simpler than git subDrupal 10 modules. (All recipes consider 8, but they should work for 7 as well) Installing contrib Drupal 10 modules composer require Drupal 10/<MODULE_NAME> Drupal 10 Maintenance and Support Service~8.0 to get the latest stable version (or latest dev, if there is no “stable release”) composer require Drupal 10/<MODULE_NAME> Drupal 10 Maintenance and Support Servicedev-<BRANCH_NAME> to get the latest dev version composer require Drupal 10/<MODULE_NAME> Drupal 10 Maintenance and Support Servicedev-<BRANCH_NAME>#<COMMIT_HASH> to get the exact version Updating core/Drupal 10 modules composer update to update everything composer update –dry-run to check for updates composer update Drupal 10/<MODULE_NAME> to update a single Drupal 10 module Patching packages The cweagans/composer-patches plugin (which comes with the Composer template) will take patches from the “extra” section of the composer.json file Drupal 10 Maintenance and Support Service “extra” Drupal 10 Maintenance and Support Service { “patches” Drupal 10 Maintenance and Support Service { “<PACKAGE/NAME>” Drupal 10 Maintenance and Support Service { “<PATCH DESCRIPTION>” Drupal 10 Maintenance and Support Service “<PATH/TO/PATCH/OR/URL>”, … }, … } } Example Drupal 10 Maintenance and Support Service “extra” Drupal 10 Maintenance and Support Service { “patches” Drupal 10 Maintenance and Support Service { “Drupal 10/core” Drupal 10 Maintenance and Support Service { “Fix language detection” Drupal 10 Maintenance and Support Service “patches/2189267-24.patch” } } } After a new patch is added run Drupal 10 Maintenance and Support Service composer install to apply patch composer update nothing to make the composer-patches plugin write necessary changes to the composer.lock file Installing custom/forked Drupal 10 modules from Github For the case when a Drupal 10 module repository contains its own composer.json Register the repository in the “repositories” section of the composer.json file Drupal 10 Maintenance and Support Service “repositories” Drupal 10 Maintenance and Support Service [ { “type” Drupal 10 Maintenance and Support Service “vcs”, “url” Drupal 10 Maintenance and Support Service “https Drupal 10 Maintenance and Support Service//github.com/<REPOSITORY/NAME>” }, … ], Use composer require Drupal 10/<MODULE_NAME> Drupal 10 Maintenance and Support Servicedev-<BRANCH_NAME>#<COMMIT_HASH> to install the Drupal 10 module. For the case when the composer.json file is missing from the Drupal 10 module repository You’ll need to use a bit more verbose variant Drupal 10 Maintenance and Support Service “repositories” Drupal 10 Maintenance and Support Service [ { “type” Drupal 10 Maintenance and Support Service “package”, “package” Drupal 10 Maintenance and Support Service { “name” Drupal 10 Maintenance and Support Service “Drupal 10/<MODULE_NAME>”, “version” Drupal 10 Maintenance and Support Service “dev-custom”, “type” Drupal 10 Maintenance and Support Service “Drupal 10-Drupal 10 module”, “source” Drupal 10 Maintenance and Support Service { “type” Drupal 10 Maintenance and Support Service “git”, “url” Drupal 10 Maintenance and Support Service “git@github.com Drupal 10 Maintenance and Support Service<REPOSITORY/NAME>.git”, “reference” Drupal 10 Maintenance and Support Service “<BRANCH-NAME>” } } }, … ], Use composer require Drupal 10/<MODULE_NAME> Drupal 10 Maintenance and Support Servicedev-custom#<COMMIT_HASH> to install the Drupal 10 module. For the case when the destination path should be different than Drupal 10 modules/contrib In addition to the above recipes, use the composer/installers plugin Drupal 10 Maintenance and Support Service “extra” Drupal 10 Maintenance and Support Service { “installer-paths” Drupal 10 Maintenance and Support Service { “web/Drupal 10 modules/custom/<MODULE_NAME>” Drupal 10 Maintenance and Support Service [“Drupal 10/<MODULE_NAME>”], … } } Adding a JS library Most popular libraries can be added easily with composer as they exist on Packagist. The tricky part is that most Drupal 10 modules require that libraries are saved under the “libraries” directory while Composer installs them to “vendor”. The composer/installers plugin can override package paths, but only for packages that depend on it. So, you’ll need to override the composer.json file of the library stating that it has the composer/installers dependency. Let’s take a look at an example Drupal 10 Maintenance and Support Service “repositories” Drupal 10 Maintenance and Support Service [ { “type” Drupal 10 Maintenance and Support Service “package”, “package” Drupal 10 Maintenance and Support Service { “name” Drupal 10 Maintenance and Support Service “enyo/dropzone”, “version” Drupal 10 Maintenance and Support Service “4.3”, “type” Drupal 10 Maintenance and Support Service “Drupal 10-library”, “source” Drupal 10 Maintenance and Support Service { “url” Drupal 10 Maintenance and Support Service “https Drupal 10 Maintenance and Support Service//github.com/enyo/dropzone.git”, “type” Drupal 10 Maintenance and Support Service “git”, “reference” Drupal 10 Maintenance and Support Service “master” }, “dist” Drupal 10 Maintenance and Support Service { “url” Drupal 10 Maintenance and Support Service “https Drupal 10 Maintenance and Support Service//github.com/enyo/dropzone/archive/v4.3.0.zip”, “type” Drupal 10 Maintenance and Support Service “zip” }, “require” Drupal 10 Maintenance and Support Service { “composer/installers” Drupal 10 Maintenance and Support Service “~1.0” } } }, … ], … “extra” Drupal 10 Maintenance and Support Service { “installer-paths” Drupal 10 Maintenance and Support Service { “web/libraries/{$name}” Drupal 10 Maintenance and Support Service [“type Drupal 10 Maintenance and Support ServiceDrupal 10-library”], … } } After the above is added to the composer.json, run composer require enyo/dropzone Drupal 10 Maintenance and Support Service4.3 to download the library. Also, here we have used the exact version and added the “dist” section to make it possible for Composer to download a zip archive instead of cloning the Git repository. Switch a dependency package to a forked version Add the forked repository to the composer.json Drupal 10 Maintenance and Support Service “repositories” Drupal 10 Maintenance and Support Service [ { “type” Drupal 10 Maintenance and Support Service “vcs”, “url” Drupal 10 Maintenance and Support Service “https Drupal 10 Maintenance and Support Service//github.com/<REPOSITORY/NAME>” }, … ], Run composer require <PACKAGE/NAME> Drupal 10 Maintenance and Support Servicedev-<BRANCH_NAME>#<COMMIT_HASH> Update an existing 8 project to use Composer Make a backup 😉 Delete everything that will be managed by Composer Drupal 10 Maintenance and Support Service ‘s “core” folder, contrib Drupal 10 modules, etc. Delete all “root” files, such as index.php, update.php, README.txt… All of them. Create “web” directory in the project root and move all remaining folders (sites, Drupal 10 modules, themes, libraries, profiles, etc.) into it. Copy the Composer template files to the project root. Prepare a list of core and contrib Drupal 10 module versions (and everything else that will be managed by Composer) that are used currently on the project. Then run composer require specifying every dependency with the exact version. You’ll need to convert versions into Composer versions, here are some examples Drupal 10 Maintenance and Support Service Drupal 10/core Drupal 10 Maintenance and Support Service8.1.8 is obvious Drupal 10/admin_toolbar Drupal 10 Maintenance and Support Service8.1.15 refers to admin_toolbar 8.x-1.15 Drupal 10/ctools Drupal 10 Maintenance and Support Service8.3.0-alpha26 refers to ctools 8.x-3.0-alpha26 Drupal 10/config_installer Drupal 10 Maintenance and Support Servicedev-8.x-1.x#a16cc9acf84dd12b9714def53be0ce280a5b0c1a refers to config_installer dev snapshot made from the a16cc9a commit of the 8.x-1.x branch Manually update versions of core and contrib Drupal 10 modules to “~8.0” in the “require” section of the composer.json file. That will make updates possible. Run composer Drupal 10-scaffold which will create the “root” files. Make your webserver use “web” directory as the web root. Drupal 10 Development and Support

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Drupal 10 Support: Drupal 10 Maintenance and Support Service Composer recipes

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.