Skip to content

Commit

Permalink
Merge pull request #545 from UN-OCHA/deploy-20240917
Browse files Browse the repository at this point in the history
Deploy 17-09-2024
  • Loading branch information
attiks authored Sep 17, 2024
2 parents 6306848 + 7e63c11 commit 6feb2d4
Show file tree
Hide file tree
Showing 47 changed files with 2,475 additions and 580 deletions.
11 changes: 11 additions & 0 deletions .changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

return [
'ignoreTypes' => ['build', 'ci', 'docs', 'refactor', 'revert', 'style', 'test'],
'tagPrefix' => 'v',
'tagSuffix' => '',
'commitUrlFormat' => '{{host}}/{{owner}}/{{repository}}/commit/{{hash}}',
'compareUrlFormat' => '{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}',
'issueUrlFormat' => 'https://humanitarian.atlassian.net/browse/{{id}}',
'hiddenVersionSeparator' => true,
];
4 changes: 3 additions & 1 deletion .github/workflows/composer-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ jobs:
id: update-action
uses: UN-OCHA/actions/composer-update@main
with:
aws_access_key_id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
github_access_token: ${{ secrets.PAT }}
patch_branch: 'develop'
patch_branch: ${{ github.head_ref || github.ref_name }}
patch_maintainers: ${{ secrets.DRUPAL_MAINTAINERS }}
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
slack_channel_name: ${{ vars.SLACK_CHANNEL }}
13 changes: 13 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ jobs:
run: |
docker compose -f tests/docker-compose.yml exec -T drupal drush watchdog:show
- name: PHP Logs
id: phplog
if: failure()
uses: cafuego/command-output@main
with:
run: |
docker compose -f tests/docker-compose.yml exec -T drupal grep -i fatal /var/log/php/error.log
- name: Find Comment
uses: peter-evans/find-comment@v3
if: ${{ !env.ACT }}
Expand Down Expand Up @@ -259,10 +267,15 @@ jobs:
<details><summary>Software Versions</summary>
<code>${{ steps.versions.outputs.stdout }}</code>
</details>
<details><summary>Drupal Logs</summary>
<code>${{ steps.dblog.outputs.stdout }}</code>
</details>
<details><summary>PHP Logs</summary>
<code>${{ steps.phplog.outputs.stdout }}</code>
</details>
*Pusher: @${{ github.actor }}, Action: `${{ github.event_name }}`, Workflow: `${{ github.workflow }}`*
edit-mode: replace

Expand Down
808 changes: 808 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions PATCHES/core_js_optimizer.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php b/core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php
index 647a2c36a017f890c0e43bbdb350084989b1a7f1..3912afe5a9feeaae235c640cd89816091c7e97be 100644
--- a/core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php
+++ b/core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php
@@ -155,24 +155,32 @@ public function deleteAll() {
public function optimizeGroup(array $group): string {
$data = '';
$current_license = FALSE;
- foreach ($group['items'] as $js_asset) {
- // Ensure license information is available as a comment after
- // optimization.
- if ($js_asset['license'] !== $current_license) {
- $data .= "/* @license " . $js_asset['license']['name'] . " " . $js_asset['license']['url'] . " */\n";
- }
- $current_license = $js_asset['license'];
- // Optimize this JS file, but only if it's not yet minified.
- if (isset($js_asset['minified']) && $js_asset['minified']) {
- $data .= file_get_contents($js_asset['data']);
- }
- else {
- $data .= $this->optimizer->optimize($js_asset);
+
+ // No preprocessing, single JS asset: just use the existing URI.
+ if ($group['type'] === 'file' && !$group['preprocess']) {
+ $data = file_get_contents($group['items'][0]['data']);
+ }
+ else {
+ foreach ($group['items'] as $js_asset) {
+ // Ensure license information is available as a comment after
+ // optimization.
+ if ($js_asset['license'] !== $current_license) {
+ $data .= "/* @license " . $js_asset['license']['name'] . " " . $js_asset['license']['url'] . " */\n";
+ }
+ $current_license = $js_asset['license'];
+ // Optimize this JS file, but only if it's not yet minified.
+ if (isset($js_asset['minified']) && $js_asset['minified']) {
+ $data .= file_get_contents($js_asset['data']);
+ }
+ else {
+ $data .= $this->optimizer->optimize($js_asset);
+ }
+ // Append a ';' and a newline after each JS file to prevent them from
+ // running together.
+ $data .= ";\n";
}
- // Append a ';' and a newline after each JS file to prevent them from
- // running together.
- $data .= ";\n";
}
+
// Remove unwanted JS code that causes issues.
return $this->optimizer->clean($data);
}
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,15 @@
"webflo/drupal-finder": "^1.2.2"
},
"require-dev": {
"davidrjonas/composer-lock-diff": "*",
"drupal/coder": "^8.3",
"drupal/config_filter": "^2.4",
"drupal/config_inspector": "^2.1",
"drupal/dev_mode": "^2.3",
"drupal/devel": "^5.0",
"drupal/devel_php": "^1.3",
"kint-php/kint": "^5.0",
"marcocesarato/php-conventional-changelog": "^1.16",
"marcocesarato/php-conventional-changelog": "*",
"mglaman/drupal-check": "^1.4",
"palantirnet/drupal-rector": "^0.20",
"phpcompatibility/php-compatibility": "^9.3",
Expand Down Expand Up @@ -186,7 +187,7 @@
},
"[web-root]/robots.txt": {
"append": "assets/robots.txt.append"
}
}
},
"locations": {
"web-root": "html/"
Expand All @@ -207,7 +208,7 @@
],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, you\u2019ve installed the Drupal codebase </>",
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/recommended-project template! </>",
"<bg=blue;fg=white> </>",
"",
Expand Down Expand Up @@ -262,5 +263,6 @@
"pre-pool-create": [
"scripts\\composer\\DrupalLenientRequirement::changeVersionConstraint"
]
}
}
},
"version": "2.1.0"
}
Loading

0 comments on commit 6feb2d4

Please sign in to comment.