sreichel / composer-plugin-file-copy
Composer 插件 - 大量文件复制
Requires
- php: >=7.4
- composer-plugin-api: ^2.0
- symfony/polyfill-php80: *
Requires (Dev)
- composer/composer: ^2.0|2.0@dev
This package is auto-updated.
Last update: 2024-08-24 12:53:27 UTC
README
这是一个非常简单的 Composer 插件,它利用 post-install-cmd
和 post-update-cmd
事件从源路径复制到目标文件夹。
我创建这个插件是为了避免手动将 bootstrap less 文件复制到临时文件夹中,并覆盖 variables.less 以生成自定义的 bootstrap.css 文件,使用来自 symfony/assetic-bundle 的 less 过滤器。
安装/使用
-
在您的 composer.json 项目文件中添加依赖项
composer require sreichel/composer-plugin-file-copy
{ "require": { "sreichel/composer-plugin-file-copy": "^1.0.0" } }
-
在您的 composer.json 项目文件中 extra 元素中添加配置
composer config --json --merge extra.file-copy '[{"source": "vendor/dir", "target": "lib/vendor", "debug": true}]'
{ "extra": { "file-copy" : [ { "source": "vendor/dir", "target": "lib/vendor", "debug": true } ] } }
或者
{ "extra": { "file-copy" : [ { "source": "vendor/dir", "target": "lib/vendor", "debug": true }, { "source": "src/Some/Bundle/less/bootstrap/*.less", "target": "var/less/bootstrap" }, { "source": "/home/username/Documents/*.{js,css}", "target": "var/test" } ] } }
注意:目标元素必须是一个文件夹。如果目标文件夹不存在,它将使用
mkdir($destination, 0755, true)
递归创建。注意:如果目标文件夹不是绝对路径,将使用 vendorDir 路径计算相对路径 (
$project_path = \realpath($this->composer->getConfig()->get('vendor-dir').'/../').'/'
;注意:使用 php 函数
\glob($source, GLOB_MARK)
评估源元素,并将每个结果递归复制到目标文件夹中
要求
PHP 7.4 或更高版本
作者
Abdelkadeur Seifeddine Salah - seif.salah@gmail.com - http://sasedev.net
许可证
Composer 在 MIT 许可证下授权 - 有关详细信息,请参阅 LICENSE 文件