dof-dss/maestro-shell

用于处理 Maestro 项目的 Shell。

10.1.2 2024-03-20 16:06 UTC

README

Maestro 是一个用于管理多站点的命令行工具。

要求

  • PHP 8.1+ CLI
  • Composer 2.1+

PHP

要查看您已安装的 PHP 版本,从 Mac Shell 运行

php --version

如果您没有安装 PHP 或使用的是较旧版本,我建议使用 Brew (https://brew.sh.cn)
安装 Brew 后运行

brew install php

Composer

要查看您已安装的 Composer 版本,从 Mac Shell 运行

composer --version

如果您没有安装 Composer,使用 brew run

brew install composer

如果您已安装 Composer,运行

composer self-update

安装

将 Maestro Shell 和托管包添加到项目的开发依赖中

composer require --dev dof-dss/maestro-shell dof-dss/maestro-hosting 

为了允许在项目根目录中使用 Maestro 命令而不直接引用 Maestro 可执行文件(例如 vendor/bin/maestro),我建议将 vendor/bin 目录添加到您的 shell $PATH。
例如,我正在使用 zsh,它是 MacOS 的默认 Shell。

编辑您主目录中的 .zshrc 并添加以下行

# Maestro Shell (allow vendor bin execution from project root)
export PATH="vendor/bin:${COMPOSER_HOME}/vendor/bin:${PATH}"

保存后,您需要运行

source ~/.zshrc

Drupal composer 文件要求

当使用 Maestro Shell 时,您必须确保以下脚本包含在项目的 composer 文件中。

"scripts": {
        "post-package-update": [
            "Maestro\\Shell\\Events\\ComposerEventListener::postPackageUpdate"
        ]
    }