rjtownsend/romelloskuggs-installer

Drupal 8 开发者入门网站

8.x-dev 2020-03-15 09:34 UTC

This package is auto-updated.

Last update: 2024-09-15 18:47:05 UTC


README

Drupal 8 开发者入门网站

Optional Drupal installer used for the Romello Skuggs Drupal 8 Installation Profile. The project goal of Romello Skuggs is to provide a starter website for developers and site-builders similar to a starter theme for front-end developers. This installer provides the base composer.json file required to build any Drupal site.

This installer was heavily borrowed from Composer template for Drupal projects.

用法

composer create-project rjtownsend/romelloskuggs-installer:8.x-dev some-dir --no-interaction

# Navigate to http://website.local/core/install.php and install as usual
#
# Export site config to the config/sync directory
cd some-dir
drush cex -y
#
# Enabling settings.local.php is recommended during development, 
# Uncomment on web/sites/default/settings.php to enable
# Alternatively, use the command drupal site:mode dev
#
# Optional: create a bootstrap_sass subtheme using the subtheme installation script
# Full instructions for installing can be found here: https://www.drupal.org/project/bootstrap_sass
cd web/themes/contrib/bootstrap_sass
./scripts/create_subtheme.sh
#
# Subtheme will need to be enabled through the Drupal UI

Romello Skuggs Installer 做了什么?

使用 Romello Skuggs Installer 安装时,以下任务将被处理

  • Drupal 将安装在 web 目录中。
  • 实现了自动加载器,使用 vendor/autoload.php 中的生成的 composer 自动加载器,而不是 Drupal 提供的(web/vendor/autoload.php)。
  • 模块(类型为 drupal-module 的包)将放置在 web/modules/contrib/
  • 主题(类型为 drupal-theme 的包)将放置在 web/themes/contrib/
  • 配置文件(类型为 drupal-profile 的包)将放置在 web/profiles/contrib/
  • 自定义模块(类型为 drupal-custom-module 的包)将放置在 web/modules/custom/
  • 自定义主题(类型为 drupal-custom-theme 的包)将放置在 web/themes/custom/
  • 创建默认的可写版本的 settings.phpservices.yml
  • 创建 settings.local.php; 这需要在 settings.php 中取消注释才能启用。
  • 创建 web/sites/default/files 目录。
  • 安装最新版本的 drush 以在 vendor/bin/drush 中使用。
  • 安装最新版本的 DrupalConsole 以在 vendor/bin/drupal 中使用。
  • 为 Drupal 配置 yml 文件创建 config/sync 目录。
  • bootstrap_sass 子主题安装脚本设置为可执行。
  • 根据您的 .env 文件创建环境变量。请参阅 .env.example

如何更新 Drupal 核心版本

composer.json 中将尝试保持所有 Drupal 核心文件的最新状态;项目 drupal-composer/drupal-scaffold 用于确保每次 drupal/core 更新时,您的模板文件都会更新。如果您自定义了任何 "scaffolding" 文件(通常是 .htaccess),那么在 Drupal 核心的新版本中更新您修改的文件时,您可能需要解决冲突。

按照以下步骤更新您的 Drupal 核心。

  1. 运行 composer update drupal/core webflo/drupal-core-require-dev "symfony/*" --with-dependencies 以更新 Drupal 核心和其依赖项。
  2. 运行 git diff 以确定是否有任何模板文件已更改。检查文件以查看任何更改,并将任何自定义设置恢复到 .htaccessrobots.txt

使用 Git

包含的 .gitignore 文件排除了核心、贡献模块、贡献主题等。如果您希望包含这些文件,则需要更新 .gitignore。请注意,Composer 不建议将依赖项提交到 Git,但同时也提供了 解决方案,如果您仍然决定这样做。

如果您没有自定义脚手架文件(如index.php、updated.php等),您可以选择不将这些文件提交到版本控制系统(例如git)。如果您的项目是这样的,那么在每次安装或更新项目后自动运行drupal-scaffold插件可能很方便。您可以通过在composer.json中注册@composer drupal:scaffold作为安装后和更新后的命令来实现。

"scripts": {
    "post-install-cmd": [
        "@composer drupal:scaffold",
        "..."
    ],
    "post-update-cmd": [
        "@composer drupal:scaffold",
        "..."
    ]
},

我该如何将补丁应用到下载的模块中?

composer.json使用composer-patches插件应用补丁。要将补丁添加到drupal模块foobar中,请在composer.json的extra部分插入patches节。

"extra": {
    "patches": {
        "drupal/foobar": {
            "Patch description": "URL or local path to patch"
        }
    }
}