diff --git a/.ddev/commands/web/generate-static-site b/.ddev/commands/web/generate-static-site new file mode 100755 index 0000000..7e1fa8c --- /dev/null +++ b/.ddev/commands/web/generate-static-site @@ -0,0 +1,9 @@ +#!/bin/bash + +rm -rf /var/www/html/static-site + +GENERATE_STATIC_SITE=1 drush tome:static --uri=https://frees.au + +# Need this one to make search api lunr works. +# Make sure Drupal site is fully index first. +cp -R "/var/www/html/web/sites/default/files/search-api-js" "/var/www/html/static-site/sites/default/files" diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 6465d3a..02d29b2 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -4,7 +4,8 @@ docroot: web php_version: "8.3" webserver_type: nginx-fpm xdebug_enabled: false -additional_hostnames: [] +additional_hostnames: + - fs-web-static-site additional_fqdns: [] database: type: mariadb diff --git a/composer.json b/composer.json index 8a53bf5..ea5a8df 100644 --- a/composer.json +++ b/composer.json @@ -56,6 +56,7 @@ "require-dev": { "drupal/coder": "^8.3", "drupal/core-dev": "^10.1", + "drupal/tome": "^1.12", "mglaman/phpstan-drupal": "^1.2", "palantirnet/drupal-rector": "^0.20.1", "phpstan/extension-installer": "^1.3", diff --git a/composer.lock b/composer.lock index d86bbe6..363b329 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "76e5e39bc7c37f1d77398a1eebc1969c", + "content-hash": "d872899d457165e778f2a79f6eaa824f", "packages": [ { "name": "asm89/stack-cors", @@ -10589,6 +10589,187 @@ }, "time": "2024-07-04T10:19:29+00:00" }, + { + "name": "drupal/tome", + "version": "1.12.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/tome.git", + "reference": "8.x-1.12" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/tome-8.x-1.12.zip", + "reference": "8.x-1.12", + "shasum": "7be3325d6d241b49c8fdd0f673f7ad580fd19b7c" + }, + "require": { + "drupal/core": "^9 || ^10", + "drupal/tome_static": "*", + "drupal/tome_sync": "*" + }, + "conflict": { + "drush/drush": "<11.6" + }, + "require-dev": { + "drupal/ctools": "*", + "drupal/pathauto": "*", + "drupal/redirect": "*", + "drupal/token": "*", + "drupal/tome_base": "*", + "drupal/tome_static": "*", + "drupal/tome_sync": "*" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.12", + "datestamp": "1701628903", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Samuel Mortenson", + "homepage": "https://www.drupal.org/u/samuelmortenson", + "role": "Maintainer" + }, + { + "name": "Lee Rowlands", + "homepage": "https://www.drupal.org/u/larowlan", + "role": "Maintainer" + } + ], + "description": "Everything you need to do everything statically.", + "homepage": "http://drupal.org/project/tome", + "support": { + "source": "https://git.drupalcode.org/project/tome", + "issues": "https://www.drupal.org/project/issues/tome" + } + }, + { + "name": "drupal/tome_base", + "version": "1.12.0", + "require": { + "drupal/core": "^8 || ^9 || ^10", + "drupal/tome": "^1" + }, + "type": "metapackage", + "extra": { + "drupal": { + "version": "8.x-1.12", + "datestamp": "1701628903", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "larowlan", + "homepage": "https://www.drupal.org/user/395439" + }, + { + "name": "samuel.mortenson", + "homepage": "https://www.drupal.org/user/2582268" + } + ], + "description": "Contains shared services and traits between Tome Sync and Tome Static.", + "homepage": "https://www.drupal.org/project/tome", + "support": { + "source": "https://git.drupalcode.org/project/tome" + } + }, + { + "name": "drupal/tome_static", + "version": "1.12.0", + "require": { + "drupal/core": "^8 || ^9 || ^10", + "drupal/tome": "^1", + "drupal/tome_base": "*" + }, + "type": "metapackage", + "extra": { + "drupal": { + "version": "8.x-1.12", + "datestamp": "1701628903", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "larowlan", + "homepage": "https://www.drupal.org/user/395439" + }, + { + "name": "samuel.mortenson", + "homepage": "https://www.drupal.org/user/2582268" + } + ], + "description": "Exports an entire Drupal site to static HTML.", + "homepage": "https://www.drupal.org/project/tome", + "support": { + "source": "https://git.drupalcode.org/project/tome" + } + }, + { + "name": "drupal/tome_sync", + "version": "1.12.0", + "require": { + "drupal/core": "^8 || ^9 || ^10", + "drupal/tome": "^1", + "drupal/tome_base": "*" + }, + "type": "metapackage", + "extra": { + "drupal": { + "version": "8.x-1.12", + "datestamp": "1701628903", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "larowlan", + "homepage": "https://www.drupal.org/user/395439" + }, + { + "name": "samuel.mortenson", + "homepage": "https://www.drupal.org/user/2582268" + } + ], + "description": "Allows Drupal to installed from flat files and keeps content in sync.", + "homepage": "https://www.drupal.org/project/tome", + "support": { + "source": "https://git.drupalcode.org/project/tome" + } + }, { "name": "google/protobuf", "version": "v3.25.4", diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 3b8dc7d..4cc81a2 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -63,6 +63,8 @@ module: taxonomy: 0 text: 0 token: 0 + tome_base: 0 + tome_static: 0 toolbar: 0 twig_remove_html_comments: 0 update: 0 diff --git a/web/sites/default/settings.php b/web/sites/default/settings.php index 8f3d76d..d385b13 100755 --- a/web/sites/default/settings.php +++ b/web/sites/default/settings.php @@ -47,3 +47,7 @@ if (file_exists($app_root . '/' . $site_path . '/local.settings.php')) { include_once $app_root . '/' . $site_path . '/local.settings.php'; } + +if (getenv('GENERATE_STATIC_SITE')) { + include_once $app_root . '/' . $site_path . '/tome.settings.php'; +} diff --git a/web/sites/default/tome.services.yml b/web/sites/default/tome.services.yml new file mode 100644 index 0000000..5563271 --- /dev/null +++ b/web/sites/default/tome.services.yml @@ -0,0 +1,6 @@ +parameters: + http.response.debug_cacheability_headers: false + twig.config: + debug: false + auto_reload: false + cache: true diff --git a/web/sites/default/tome.settings.php b/web/sites/default/tome.settings.php new file mode 100644 index 0000000..3c465cb --- /dev/null +++ b/web/sites/default/tome.settings.php @@ -0,0 +1,15 @@ +