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

查看:21
本文介绍了嵌套包的 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"
	}
}

问题在于运行嵌套包的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.

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

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