Skip to content

Commit f07e154

Browse files
authored
Merge pull request #528 from itk-dev/feature/drupal-composer-cleanup
Aligned composer.json with https://github.com/drupal-composer/drupal-project/tree/10.x
2 parents f1c76e2 + 3de87eb commit f07e154

7 files changed

Lines changed: 90 additions & 4 deletions

File tree

.markdownlintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ web/*.md
1010
web/core/
1111
web/libraries/
1212
web/*/contrib/
13+
14+
# Drupal specific
15+
drush

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
88

99
## [4.11.0] - 2025-07-01
1010

11+
* [PR-528](https://github.com/itk-dev/deltag.aarhus.dk/pull/528)
12+
Aligned `composer.json` with <https://github.com/drupal-composer/drupal-project/blob/10.x/composer.json>
1113
* [PR-526](https://github.com/itk-dev/deltag.aarhus.dk/pull/526)
1214
* Updated docker compose setup
1315
* Linted YAML

composer.json

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
},
105105
"asset-packagist": {
106106
"type": "composer",
107-
"url": "https://asset-packagist.org/"
107+
"url": "https://asset-packagist.org"
108108
},
109109
"drupal/hoeringsportal_data": {
110110
"type": "path",
@@ -200,6 +200,14 @@
200200
},
201201
"minimum-stability": "dev",
202202
"prefer-stable": true,
203+
"autoload": {
204+
"classmap": [
205+
"scripts/composer/ScriptHandler.php"
206+
],
207+
"files": [
208+
"load.environment.php"
209+
]
210+
},
203211
"config": {
204212
"allow-plugins": {
205213
"chx/drupal-issue-fork": true,
@@ -215,11 +223,17 @@
215223
"phpstan/extension-installer": true,
216224
"tbachert/spi": true
217225
},
226+
"discard-changes": true,
218227
"sort-packages": true
219228
},
220229
"extra": {
221230
"composer-exit-on-patch-failure": true,
222231
"drupal-scaffold": {
232+
"file-mapping": {
233+
"[project-root]/.gitignore": false,
234+
"[web-root]/INSTALL.txt": false,
235+
"[web-root]/README.txt": false
236+
},
223237
"locations": {
224238
"web-root": "web/"
225239
}
@@ -231,8 +245,8 @@
231245
],
232246
"web/libraries/{$name}": [
233247
"type:drupal-library",
234-
"type:npm-asset",
235-
"type:bower-asset"
248+
"type:bower-asset",
249+
"type:npm-asset"
236250
],
237251
"web/modules/contrib/{$name}": [
238252
"type:drupal-module"
@@ -249,6 +263,9 @@
249263
"web/modules/custom/{$name}": [
250264
"type:drupal-custom-module"
251265
],
266+
"web/profiles/custom/{$name}": [
267+
"type:drupal-custom-profile"
268+
],
252269
"web/themes/custom/{$name}": [
253270
"type:drupal-custom-theme"
254271
]
@@ -257,6 +274,9 @@
257274
"npm-asset",
258275
"bower-asset"
259276
],
277+
"patchLevel": {
278+
"drupal/core": "-p2"
279+
},
260280
"patches": {
261281
"drupal/better_exposed_filters": {
262282
"Add option to hide exposed filter field labels (https://www.drupal.org/project/better_exposed_filters/issues/3282228)": "https://www.drupal.org/files/issues/2022-09-08/bef-visually_hidden.3282228.8.patch",
@@ -265,6 +285,20 @@
265285
"drupal/core": {
266286
"Text format wrapper does not take description_display into account (https://www.drupal.org/project/drupal/issues/2421445#comment-14328645)": "https://www.drupal.org/files/issues/2021-12-03/2421445-18_0.patch"
267287
}
288+
},
289+
"scripts": {
290+
"post-install-cmd": [
291+
"DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
292+
],
293+
"post-update-cmd": [
294+
"DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
295+
],
296+
"pre-install-cmd": [
297+
"DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
298+
],
299+
"pre-update-cmd": [
300+
"DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
301+
]
268302
}
269303
}
270304
}

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

drush/Commands/PolicyCommands.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace Drush\Commands;
4+
5+
use Consolidation\AnnotatedCommand\CommandData;
6+
use Consolidation\AnnotatedCommand\Hooks\HookManager;
7+
use Drush\Attributes\Hook;
8+
use Drush\Commands\core\RsyncCommands;
9+
use Drush\Commands\sql\SqlSyncCommands;
10+
11+
/**
12+
* Edit this file to reflect your organization's needs.
13+
*/
14+
class PolicyCommands extends DrushCommands {
15+
16+
/**
17+
* Prevent catastrophic braino. Note that this file has to be local to the
18+
* machine that initiates the sql:sync command.
19+
*
20+
* @throws \Exception
21+
*/
22+
#[Hook(type: HookManager::ARGUMENT_VALIDATOR, target: SqlSyncCommands::SYNC)]
23+
public function sqlSyncValidate(CommandData $commandData) {
24+
if ($commandData->input()->getArgument('target') == '@prod') {
25+
throw new \Exception(dt('Per !file, you may never overwrite the production database.', ['!file' => __FILE__]));
26+
}
27+
}
28+
29+
/**
30+
* Limit rsync operations to production site.
31+
*
32+
* @throws \Exception
33+
*/
34+
#[Hook(type: HookManager::ARGUMENT_VALIDATOR, target: RsyncCommands::RSYNC)]
35+
public function rsyncValidate(CommandData $commandData) {
36+
if (preg_match("/^@prod/", $commandData->input()->getArgument('target'))) {
37+
throw new \Exception(dt('Per !file, you may never rsync to the production site.', ['!file' => __FILE__]));
38+
}
39+
}
40+
}

drush/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This directory contains commands, configuration and site aliases for Drush. See https://packagist.org/search/?type=drupal-drush for a directory of Drush commands installable via Composer.

drush/drush.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# A Drush configuration file
3+
#
4+
# Docs at https://github.com/drush-ops/drush/blob/master/examples/example.drush.yml
5+
#
6+
# Edit or remove this file as needed.

0 commit comments

Comments
 (0)