首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >composer将git存储库设置为类型组件。

composer将git存储库设置为类型组件。
EN

Stack Overflow用户
提问于 2014-11-14 16:04:16
回答 3查看 365关注 0票数 1

我正在尝试安装一些外部JS库,这些库位于SF2项目中的composer.json中。

composer.json:

代码语言:javascript
复制
{
"name": "myproject",
"license": "my project",
"type": "project",
"description": "my project",
"autoload": {
    "psr-0": { "": "src/" }
},
"repositories": {
    "medium-editor" : {
        "type": "package",
        "package": {
            "name": "daviferreira/medium-editor",
            "type": "component",
            "version": "master",
            "source": {
                "url": "git://github.com/daviferreira/medium-editor.git",
                "type": "git",
                "reference": "master"
            },
            "extra": {
                "component": {
                    "scripts": [
                        "dist/js/medium-editor.min.js"
                    ],
                    "styles": [
                        "dist/css/medium-editor.min.css",
                        "dist/css/themes/*.min.css"
                    ]
                }
            },
            "require": {
                "robloach/component-installer": "*"
            }
        }
    },
    "classList" : {
        "type": "package",
        "package": {
            "name": "eligrey/classList.js",
            "type": "component",
            "version": "master",
            "source": {
                "url": "git://github.com/eligrey/classList.js.git",
                "type": "git",
                "reference": "master"
            },
            "extra": {
                "component": {
                    "scripts": [
                        "classList.min.js"
                    ]
                }
            },
            "require": {
                "robloach/component-installer": "*"
            }
        }
    }
},
"require": {
    ...

    "daviferreira/medium-editor" : "dev-master",
    "eligrey/classList.js" : "dev-master"
},
"require-dev": {
    "phpunit/phpunit": "3.7.*"
},    
"scripts": {
    "post-install-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],
    "post-update-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
},
"config": {
    "bin-dir": "bin",
    "component-dir": "web/components"
},
"minimum-stability": "stable",
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "symlink",
    "incenteev-parameters": {
        "file": "app/config/parameters.yml"
    },
    "branch-alias": {
        "dev-master": "2.3-dev"
    }
}
}

图书馆被下载了但是..。我希望composer将使用"robloach/component-installer“依赖项创建一个文件副本,该文件在"component”类型包的“附加”中指定到"web/component“目录,但没有。

我的配置怎么了?谢谢!

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-12-29 14:26:48

在更仔细地阅读了robloach插件文档之后,我再次尝试并最终找到了解决方案。问题是,我可能已经做了许多“作曲家更新”与不同的信任,并有义务删除/重新安装包使其工作!所以问题中最初的配置帖子是good one.

我再说一遍是为了确定!

代码语言:javascript
复制
    "medium-editor" : {
        "type": "package",
        "package": {
            "require": {
                "robloach/component-installer": "*"
            },
            "name": "daviferreira/medium-editor",
            "type": "component",
            "version": "master",
            "source": {
                "url": "git://github.com/daviferreira/medium-editor.git",
                "type": "git",
                "reference": "master"
            },                
            "extra": {
                "component": {
                    "scripts": [
                        "dist/js/medium-editor.min.js"
                    ],
                    "styles": [
                        "dist/css/medium-editor.min.css",
                        "dist/css/themes/*.min.css"
                    ]
                }
            }
        }
    },

当然,不要忘记在"require“库中添加Robloach组件:

代码语言:javascript
复制
        "robloach/component-installer": "dev-master",
票数 3
EN

Stack Overflow用户

发布于 2014-11-14 21:44:41

我建议使用bower来获取前端库。Composer是为管理php依赖关系而创建的。分离这些层非常重要,因为这是最容易实现的解决方案。

票数 1
EN

Stack Overflow用户

发布于 2014-12-28 22:12:45

使用composer尝试资产管理器包,如果问题仍然存在,我认为您应该手动执行命令:

应用程序/控制台资产:安装。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26934071

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档