diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..392ab78 --- /dev/null +++ b/.env.example @@ -0,0 +1,28 @@ +# +# Copy and rename this file to .env at root of this project. +# + +# A common use case is to supply database credentials via the environment. Edit settings.php +# like so: +# +# $databases['default']['default'] = [ +# 'database' => $_ENV['MYSQL_DATABASE'], +# 'driver' => 'mysql', +# 'host' => $_ENV['MYSQL_HOSTNAME'], +# 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', +# 'password' => $_ENV['MYSQL_PASSWORD'], +# 'port' => $_ENV['MYSQL_PORT'], +# 'prefix' => '', +# 'username' => $_ENV['MYSQL_USER'], +# ]; +# +# Uncomment and populate as needed. +# MYSQL_DATABASE= +# MYSQL_HOSTNAME= +# MYSQL_PASSWORD= +# MYSQL_PORT= +# MYSQL_USER= + +# Another common use case is to set Drush's --uri via environment. +# DRUSH_OPTIONS_URI=http://example.com + diff --git a/.gitignore b/.gitignore index 84a77eb..e63532b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /web/modules/contrib/ /web/themes/contrib/ /web/profiles/contrib/ +/web/libraries/ # Ignore sensitive information /web/sites/*/settings.php @@ -19,5 +20,10 @@ # Ignore files generated by PhpStorm /.idea/ +/.vscode/ /.editorconfig -/.gitattributes \ No newline at end of file +/.gitattributes + +# Ignore .env files as they are personal +/.env + diff --git a/composer.json b/composer.json index eda00b9..f82cdc3 100644 --- a/composer.json +++ b/composer.json @@ -28,25 +28,25 @@ "sort-packages": true }, "require": { - "php": ">=7.1", + "php": ">=7.3", "ext-curl": "*", - "composer/installers": "^1.2", - "cweagans/composer-patches": "^1.6.5", - "drupal/core": "^8.9.0", - "drupal/core-composer-scaffold": "^8.9.0", - "drupal/commerce": "^2.0", - "drupal/search_api": "^1.0", + "composer/installers": "^1.9", + "cweagans/composer-patches": "^1.7", + "drupal/core": "^9.1", + "drupal/core-composer-scaffold": "^9.1", + "drupal/commerce": "^2.24", + "drupal/search_api": "^1.19", "drupal/swiftmailer": "^2.0", - "drupal/token": "^1.0", - "drupalcommerce/commerce_base": "dev-8.x-1.x", - "drush/drush": "^9.7.1 | ^10.0.0", - "oomphinc/composer-installers-extender": "^2.0", - "webflo/drupal-finder": "^1.0.0", + "drupal/token": "^1.9", + "drupalcommerce/commerce_base": "9.x-dev", + "drush/drush": "^10.3", + "vlucas/phpdotenv": "^5.1", + "webflo/drupal-finder": "^1.2", "webmozart/path-util": "^2.3" }, "require-dev": { - "drupal/core-dev": "^8.9.0", - "zaporylie/composer-drupal-optimizations": "^1.1" + "drupal/core-dev": "^9.1", + "zaporylie/composer-drupal-optimizations": "^1.2" }, "conflict": { "drupal/drupal": "*" @@ -56,7 +56,8 @@ "autoload": { "classmap": [ "scripts/composer/ScriptHandler.php" - ] + ], + "files": ["load.environment.php"] }, "scripts": { "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold", @@ -88,9 +89,7 @@ "npm-asset" ], "installer-paths": { - "web/core": [ - "type:drupal-core" - ], + "web/core": ["type:drupal-core"], "web/libraries/{$name}": [ "type:drupal-library", "type:bower-asset", diff --git a/load.environment.php b/load.environment.php new file mode 100644 index 0000000..1bec62e --- /dev/null +++ b/load.environment.php @@ -0,0 +1,18 @@ +safeLoad(); + diff --git a/scripts/composer/ScriptHandler.php b/scripts/composer/ScriptHandler.php index 4a344f5..51026d3 100644 --- a/scripts/composer/ScriptHandler.php +++ b/scripts/composer/ScriptHandler.php @@ -9,6 +9,7 @@ use Composer\Script\Event; use Composer\Semver\Comparator; +use Drupal\Core\Site\Settings; use DrupalFinder\DrupalFinder; use Symfony\Component\Filesystem\Filesystem; use Webmozart\PathUtil\Path; @@ -40,11 +41,10 @@ public static function createRequiredFiles(Event $event) { $fs->copy($drupalRoot . '/sites/default/default.settings.php', $drupalRoot . '/sites/default/settings.php'); require_once $drupalRoot . '/core/includes/bootstrap.inc'; require_once $drupalRoot . '/core/includes/install.inc'; - $settings['config_directories'] = [ - CONFIG_SYNC_DIRECTORY => (object) [ - 'value' => Path::makeRelative($drupalFinder->getComposerRoot() . '/config/sync', $drupalRoot), - 'required' => TRUE, - ], + new Settings([]); + $settings['settings']['config_sync_directory'] = (object) [ + 'value' => Path::makeRelative($drupalFinder->getComposerRoot() . '/config/sync', $drupalRoot), + 'required' => TRUE, ]; drupal_rewrite_settings($settings, $drupalRoot . '/sites/default/settings.php'); $fs->chmod($drupalRoot . '/sites/default/settings.php', 0666);