hussainweb / drupal-composer-init
初始化 Drupal Composer 项目配置
Requires
- php: >=5.5.9
- composer-plugin-api: ^1.1
Requires (Dev)
- composer/composer: ~1.0
- squizlabs/php_codesniffer: ~2.3
This package is auto-updated.
Last update: 2024-09-07 02:18:32 UTC
README
此插件提供了一个新的 composer 命令(drupal-init
),该命令有助于基于 composer 创建新的 Drupal 安装。大多数选项与默认的 composer init
命令非常相似。还有额外的选项来指定要使用的 Drupal 核心或发行版以及 docroot。
此插件也支持 Drupal 7 安装,但此选项需要从命令行传入。
此插件生成的 composer.json 设置受到 drupal-composer/drupal-project(D7 和 D8 版本)的启发。一个重要区别是,此命令生成的 composer.json 不需要 drupal-composer 项目中的几个脚本。所有功能都移动到了 hussainweb/drupal-composer-helper。还有额外的优势,如更简单的 extra
部分,以及更易于维护的安装。有关更多详细信息,请参阅 drupal-composer-helper 插件。
安装
由于此插件提供了一个新的 composer 命令,应在空目录(或至少是没有任何 composer.json 设置的目录)中使用,因此必须全局安装。
composer global require hussainweb/drupal-composer-init:~1.0
更新
composer global update hussainweb/drupal-composer-init --with-dependencies
用法
在全新目录中运行此命令开始。
composer drupal-init
要初始化 Drupal 7 网站,请运行以下命令
composer drupal-init --drupal-7
指定扩展(模块、主题、配置文件)
可以在 composer.json 架构的常规 require
或 require-dev
部分中指定 Drupal 扩展(如模块、主题和配置文件)。
所有 Drupal 扩展都可以在常规包部分中指定,其 drupal.org 名称以 'drupal/
' 前缀。例如,如果您想要求 panels 模块,指定 drupal/panels
。
Define your dependencies.
Would you like to define your dependencies (require) now [yes]?
Search for a package: drupal/panels
Enter the version constraint to require (or leave blank to use the latest version):
Using version ^4.2 for drupal/panels
Search for a package: drupal/redirect
Enter the version constraint to require (or leave blank to use the latest version):
Using version ^1.0@beta for drupal/redirect
Search for a package:
额外帮助
运行 composer help drupal-init
了解更多选项。
Usage:
drupal-init [options]
Options:
--name=NAME Name of the package
--description=DESCRIPTION Description of package
--author=AUTHOR Author name of package
--type[=TYPE] Type of package (e.g. library, project, metapackage, composer-plugin) [default: "project"]
--homepage=HOMEPAGE Homepage of package
--require=REQUIRE Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0" (multiple values allowed)
--require-dev=REQUIRE-DEV Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0" (multiple values allowed)
-c, --core=CORE Drupal Core or distribution, e.g. drupal/core or acquia/lightning [default: "drupal/core"]
-s, --stability=STABILITY Minimum stability (empty or one of: stable, RC, beta, alpha, dev)
-l, --license=LICENSE License of package
--repository=REPOSITORY Add custom repositories, either by URL or using JSON arrays (multiple values allowed)
-w, --web-dir=WEB-DIR Specify the docroot (defaults to web) [default: "web"]
--drupal-7 Use Drupal 7 packagist instead of Drupal 8
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
--no-plugins Whether to disable plugins.
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
The drupal-init command creates a composer.json file
usable for Drupal projects in the current directory.
php composer.phar drupal-init
贡献
欢迎贡献。请使用问题队列来描述问题。欢迎提交拉取请求。