我有没有代码但有依赖列表的作曲家项目.我想运行 composer install
来下载所有依赖包,然后在每个包中运行一些 bash 命令.
I have composer project without code but with list of dependencies. I want to run composer install
for download all dependent packages and run some bash commands into each one after it.
我的 composer.json:
My composer.json:
{
"name": "testmain/testmain",
"description": "testmain",
"minimum-stability": "dev",
"repositories": [{
"type": "package",
"package": {
"name": "testsub/testsub1",
"description": "testsub/testsub1",
"version": "master",
"source": {
"url": "https://github.com/testsub/testsub1",
"type": "git",
"reference": "master"
},
"scripts": {
"post-install-cmd": [
"make",
"make install"
]
}
}
},
{
"type": "package",
"package": {
"name": "testsub/testsub2",
"description": "testsub/testsub2",
"version": "master",
"source": {
"url": "https://github.com/testsub/testsub2",
"type": "git",
"reference": "master"
},
"scripts": {
"post-install-cmd": [
"make",
"make install"
]
}
}
}
],
"require": {
"testsub/testsub1": "master",
"testsub/testsub2": "master"
}
}
问题在于运行嵌套包的scripts
序列,所有脚本都被composer忽略了.
The problem is in running scripts
sequence of nested packages, all scripts are ignored by composer.
谢谢!
很遗憾,无法执行任何非ROOT脚本(即非root composer.json
),如 文档中所述:
Unfortunately, it is not possible to execute any non-ROOT scripts (in meaning non-root composer.json
), as mentioned in documentation:
注意:仅执行根包的 composer.json 中定义的脚本.如果根包的依赖项指定了它自己的脚本,Composer 不会执行那些额外的脚本.
Note: Only scripts defined in the root package's composer.json are executed. If a dependency of the root package specifies its own scripts, Composer does not execute those additional scripts.