Composer嵌套包的运行脚本

时间:2017-10-16 11:27:55

标签: git composer-php

我有没有代码的作曲家项目,但有依赖项列表。我想运行composer install来下载所有依赖包并在其后运行一些bash命令。

我的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序列,编辑器会忽略所有脚本。

谢谢!

1 个答案:

答案 0 :(得分:3)

不幸的是,无法执行任何非ROOT 脚本(意思是非根composer.json),如documentation中所述:

  

注意:只执行根包的composer.json中定义的脚本。如果根包的依赖关系指定了自己的脚本,则Composer不会执行这些其他脚本。