简体   繁体   English

作曲家未解析composer.json

[英]composer not parsing composer.json

i have created a bundle. 我创建了一个捆绑包。 in bundle i am creating two tables in database. 在捆绑中,我正在数据库中创建两个表。 this is following my composer.json. 这是在我的composer.json之后。

{
    "name": "xxxx/xxx-designer",
    "description": "XXXX",
    "license": "MIT",
    "homepage": "https://github.com/giturl",
    "autoload": {
        "psr-0": {
            "": "src/"
        }
    },
    "authors": [
        {
            "name": "xxxx",
            "email": "xxxx@gmail.com"
        }
    ],
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.3.0",
    },
    "scripts": {
        "post-install-cmd": [
            "Acme\\Bundle\\DemoBundle\\Composer\\AcmeHandler::InstallTabs"
        ],
        "post-update-cmd": [
            "Acme\\Bundle\\DemoBundle\\Composer\\AcmeHandler::InstallTabs"
        ]
    },
    "extra": {
        "branch-alias": {
            "dev-master": "1.0.x-dev"
        }
    }
}

Now problem is this when i perform php composer.phar update then composer not execute post-update-cmd or post-install-cmd but if add following line into main composer.json 现在的问题是,当我执行php composer.phar update composer不会执行post-update-cmd或post-install-cmd,但是如果将以下行添加到主composer.json中

"scripts": {
    "post-install-cmd": [
        "Acme\\Bundle\\DemoBundle\\Composer\\AcmeHandler::InstallTabs"
    ],
    "post-update-cmd": [
        "Acme\\Bundle\\DemoBundle\\Composer\\AcmeHandler::InstallTabs"
    ]
},

then php composer.phar update execute this command and my tables will be created i am wondering why composer not execute commands from my bundle's composer.json. 然后php composer.phar update执行此命令,我的表将被创建,我想知道为什么composer不执行我捆绑包的composer.json中的命令。 please help why composer not execute script from bundle's composer.json 请帮助为什么作曲家不执行捆绑软件的composer.json中的脚本

Unfortunately, you can not do that with a vendor post-instal/update-scripts. 不幸的是,您无法使用供应商的后安装/更新脚本来执行此操作。

BUT

See how it is resolved in BraincraftedBootstrapBundle: 查看如何在BraincraftedBootstrapBundle中解决该问题:

They have a separate command to copy the icons 他们有一个单独的命令来复制图标

I show that it can be added to composer.json. 我表明可以将其添加到composer.json中。 BraincraftedBootstrapBundle -> Installing Glyphicons BraincraftedBootstrapBundle->安装Glyphicons

Taken from the docs 取自文档

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.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM