sergeant / drupal-project
SGT Project template for Drupal 10 projects with Composer
Requires
- php: >=8.1.6
- composer/installers: ^2.1
- cweagans/composer-patches: ^1.7
- drupal/core: ^10
- drupal/core-composer-scaffold: ^10.0.0
- drupal/core-recommended: ^10.0.0
- drush/drush: ^12.4.3
- harvesthq/chosen: ^1.8
- sergeant/sgt_core: >=4.0.4
- sergeant/sgt_drupal_project_update: ~4.0
- sergeant/sgt_ignite: ~5.0
- sergeant/sgt_installation_profile: >=7.1
- vlucas/phpdotenv: ^5.1
- webflo/drupal-finder: ^1.2
- zaporylie/composer-drupal-optimizations: ^1.0
Requires (Dev)
- drupal/core-dev: ^10.0.0
Provides
Conflicts
- dev-8.x-sgt
- dev-10.x-sgt
- 8.x-dev
- 7.x-dev
- 7.1.0
- 7.0.7
- 7.0.5
- 7.0.4
- 7.0.3
- 7.0.2
- 7.0.1
- 7.0.0
- 6.0.2
- 6.0.1
- 6.0.0
- 5.0.9
- 5.0.8
- 5.0.7
- 5.0.6
- 5.0.5
- 5.0.4
- 5.0.3
- 5.0.2
- 5.0.1
- 5.0.0
- 4.0.17
- 4.0.16
- 4.0.15
- 4.0.14
- 4.0.13
- 4.0.12
- 4.0.11
- 4.0.10
- 4.0.9
- 4.0.8
- 4.0.7
- 4.0.6
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.1
- 4.0.0
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.1
- 3.0.0
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.12
- 2.0.11
- 2.0.10
- 2.0.9
- 2.0.8
- dev-9.x-sgt
- dev-hash-salt
This package is auto-updated.
Last update: 2024-11-30 15:45:42 UTC
README
This is the fork of Composer template for Drupal projects. All documentation regarding this project is available on given url. The notes bellow are addition/override of the source documentation. The updates from forked project has to be implemented manually.
Lead maintainer: Zan Vidmar (contact)
Maintainer: Aljosa Furlanic (contact)
Usage
Access
For successful installation of Sergeant modules, read access to Sergeant private repositories is needed.
Sergeant workflow
Sergeant drupal project init article (private)
Installation (!)
Initialize project with command line generator
Initialize project just with composer
First you need to install composer.
- After that you can create the project:
composer create-project sergeant/drupal-project:dev-10.x-sgt some-directory --stability dev --no-interaction
Change the some-directory
with your directory where the project will be.
In case if something is not installed correctly try to clear composer cache first (composer clear-cache
), and than report an issue.
-
Install Drupal with the Installation Profile (everything is handled by sgt_installation_profile module).
-
Create new checklist
/admin/config/sergeant/sgt_checklist
and go trough all checklist items.
Settings
- For global setting use
/web/sites/*/settings.php
- For environment settings use
/web/sites/*/settings.local.php
- For development services use
/web/sites/default/local.services.yml
(do not use this on production!)
Development local.services.yml example:
parameters:
session.storage.options: { gc_probability: 1, gc_divisor: 100, gc_maxlifetime: 200000, cookie_lifetime: 2000000 }
twig.config: { debug: true, auto_reload: true, cache: true }
renderer.config: { required_cache_contexts: ['languages:language_interface', theme, user.permissions], auto_placeholder_conditions: { max-age: 0, contexts: [session, user], tags: { } } }
http.response.debug_cacheability_headers: true
factory.keyvalue: { }
factory.keyvalue.expirable: { }
filter_protocols: [http, https, ftp, news, nntp, tel, telnet, mailto, irc, ssh, sftp, webcal, rtsp]
cors.config: { enabled: false, allowedHeaders: { }, allowedMethods: { }, allowedOrigins: ['*'], exposedHeaders: false, maxAge: false, supportsCredentials: false }
Updating Drupal project itself
That will update some settings in composer.json file and also some other Drupal project related files.
Updates are handled by sergeant/sgt_drupal_project_update
;
To update drupal project to last version:
composer update_sgt_drupal_project
or to update it to specific project version:
composer update_sgt_drupal_project v3.0.5
Keep local "repositories" in composer.json file as they are
In case you would not like to update "repositories" data (for example: if you change library version for given project only) use:
add keep-local-repositories-data=true
flag.
Example
composer update_sgt_drupal_project keep-local-repositories-data=true
Updates (!)
Every time when Drupal core is updated, we have to update Drupal module Sergeant core (sgt_installation_profile). Sergeant Installation Profile holds all currently active patches for Drupal core and modules required by Sergeant Installation Profile. All other patches has to be handled on project level.
What does this template adds to forked drupal-composer/drupal-project
Packages required by default (wiht its dependency tree)
All modules listed below in dependency tree are required by default. sergeant/sgt_installation_profille module handles all other required contributed Drupal modules.
Sergeant Drupal project (composer project)
- sgt_core (module)
- sgt_checklist
- entity_creator_api
- sgt_handbook
- sgt_paragraphs
- sgt_field_paragraph_settings
- sgt_checklist
- sgt_ignite (theme)
- sgt_ignite_components
- sgt_ignite_features
- sgt_installation_profille (profile)
- all required Drupal modules
Included repositories
This only include package sources, the installation is optional and always made by developer.
- sergeant/sgt_devel
- sergeant/sgt_filter_query_api
- sergeant/sgt_media_colorbox_field_formatter
- sergeant/sgt_media_crop
- sergeant/sgt_tiles
Included Sergeant private repositories:
- sergeant/entity_creator_api (repo)
- sergeant/sgt_checklist (repo)
- sergeant/sgt_core (repo)
- sergeant/devel (repo)
- sergeant/sgt_drupal_project_update (repo)
- sergeant/sgt_field_paragraph_settings (repo)
- sergeant/sgt_filter_query_api (repo)
- sergeant/sgt_handbook (repo)
- sergeant/sgt_ignite (repo)
- sergeant/sgt_ignite_components (repo)
- sergeant/sgt_ignite_features (repo)
- sergeant/sgt_installation_profile (repo)
- sergeant/sgt_media_colorbox_field_formatter (repo)
- sergeant/sgt_media_crop (repo)
- sergeant/sgt_paragraphs (repo)
- sergeant/sgt_tiles (repo)
Required contrib packages (JS libraries)
- harvesthq/chosen is required via sgt_installation_profille => drupal/chosen. Drupal project composer.json file includes requrements mentioned in drupal/chosen readme file. (repo, docs)
Included contrib packages (JS libraries)
- gfranko/jquery.tocify.js
composer require gfranko/jquery.tocify.js
(repo, docs) - jackmoore/colorbox
composer require jackmoore/colorbox
(repo, docs)
Composer file modifications
Installer paths
Installer paths are changed to a non standard paths, to met the Sergeant workflow with Sergeant modules and Sergeant Ignite theme.
All Sergeant modules are placed in web/modules/sgt/
directory.
"web/modules/sgt/{$name}": [
"sergeant/sgt_checklist",
"sergeant/sgt_core",
"sergeant/sgt_devel",
"sergeant/sgt_field_paragraph_settings",
"sergeant/sgt_filter_query_api",
"sergeant/sgt_handbook",
"sergeant/sgt_ignite_components",
"sergeant/sgt_ignite_features",
"sergeant/sgt_media_colorbox_field_formatter",
"sergeant/sgt_media_crop",
"sergeant/sgt_paragraphs",
"sergeant/sgt_tiles"
],
The structure of module folder:
- contrib
web/modules/contrib/
(for Drupal contrib modules, git ignored, managed by composer) - custom
web/modules/custom/
(for Drupal custom modules per project, git managed) - sgt
web/modules/sgt/
(for Sergeant Drupal contrib modules, git ignored, managed by composer)
Sergeant Ignite theme is placed in web/themes/sgt_ignite/
directory.
"web/themes/sgt_ignite/ignite_core": [
"sergeant/sgt_ignite"
],
Sergeant installation profile is placed in in web/profiles/sgt/
directory.
"web/profiles/sgt/{$name}": [
"sergeant/sgt_installation_profile"
]
Other modifications
- Custom folders ("private", "tmp") are added into $dir array in
scripts/composer/ScriptHandler.php
file. - to accept patches from dependencies
"enable-patching": true
was added toextra
section (source: composer-patches) - Create the files directory with chmod 0775 instead of 0777
- ScriptHandler (with related json autoload => classmap) has additional function that copy all configuration files from Drupal standard profile to Sergeant Installation Profile.
PHP version
This template by default requires at least PHP 8.1
DDEV setup
Troubleshooting
In case of denied acces to private repos add keys to ddev container by ddev auth ssh
command