pondermatic / composer-archive-project
使用根项目目录创建composer包的归档。
Requires
- composer-plugin-api: ^2.3
- ext-zip: *
Requires (Dev)
- composer/composer: ^2.4
README
此composer插件添加了一个与composer archive
命令类似的archive-project
命令,不同之处在于它会在归档的根目录中创建一个项目目录。
例如,如果composer.json
中的name
字段是pondermatic/xapi
,那么归档层次结构将是
.
|-- xapi/
| |-- src/
| | |-- main.php
| |-- composer.json
| |-- readme.md
而不是
.
|-- src/
| |-- main.php
|-- composer.json
|-- readme.md
使用方法
可以通过使用Composer,将此包作为开发依赖项来安装
composer require --dev pondermatic/composer-archive-project
当使用Composer 2.2或更高版本时,Composer将请求您的许可以允许此插件执行代码。为了使此插件功能正常,需要授予许可。
当许可被授予时,以下片段将由Composer自动添加到您的composer.json
文件中
{
"config": {
"allow-plugins": {
"pondermatic/composer-archive-project": true
}
}
}
当使用Composer < 2.2时,您可以通过运行以下命令在升级到Composer 2.2之前添加许可标志
composer config allow-plugins.pondermatic/composer-archive-project true
现在Composer有了新的archive-project
命令。以下是使用方法。
$ composer help archive-project
Description:
Creates an archive of this composer package with a root project directory
Usage:
archive-project [options] [--] [<package> [<version>]]
Arguments:
package The package to archive instead of the current project
version A version constraint to find the package to archive
Options:
-f, --format=FORMAT Format of the resulting archive: tar, tar.gz, tar.bz2 or zip (default tar)
--dir=DIR Write the archive to this directory
--file=FILE Write the archive with the given file name. Note that the format will be appended.
--ignore-filters Ignore filters when saving package
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
--no-plugins Whether to disable plugins.
--no-scripts Skips the execution of all scripts defined in composer.json file.
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.
--no-cache Prevent use of the cache
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
The archive-project command creates an archive of the specified format
containing the files and directories of the Composer project or the specified
package in the specified version and writes it to the specified directory.
php composer.phar archive-project [--format=zip] [--dir=/foo] [--file=filename] [package [version]]
Read more at https://getcomposer.org/doc/03-cli.md#archive
兼容性
此插件与以下兼容
- PHP 7.2,7.3,7.4和8.0
- Composer 2.3和2.4
工作原理
项目名称取自您的包的composer.json
文件中的name
属性。例如,如果您的包名称是pondermatic/xapi
,则项目名称是xapi
。
变更日志
1.0.0 (2022-09-29)
- 初始版本。
许可协议
版权所有 (c) 2022 Pondermatic LLC
特此授予,免费,任何获得本软件和相关文档文件(“软件”)副本的个人(“用户”),在软件上不受限制地处理软件的权利,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本的权利,并允许获得软件的个人这样做,前提是遵守以下条件
上述版权声明和本许可声明(包括下一段)应包含在软件的所有副本或主要部分中。
软件按“现状”提供,不提供任何明示或暗示的保证,包括但不限于适销性、适用于特定用途和非侵权性保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论该责任是基于合同、侵权或其他方式,是否因软件或其使用或其他交易而产生。