嵌套包的Composer运行脚本 [英] Composer run-script of nested packages

查看:95
本文介绍了嵌套包的Composer运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有没有代码的composer项目,但是有依赖项列表。我想运行 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"
	}
}

问题在于运行个脚本嵌套程序包序列,所有脚本都被作曲家忽略。

The problem is in running scripts sequence of nested packages, all scripts are ignored by composer.

谢谢!

推荐答案

不幸的是,无法执行任何非ROOT脚本(在这种情况下,根 composer.json ),如文档


注意:仅执行在根包的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.

这篇关于嵌套包的Composer运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆