Symfony Flex 配方是如何知道要安装哪些包的?

huangapple go评论64阅读模式
英文:

How do Symfony Flex recipes know what packages to install?

问题

我正在尝试理解Symfony食谱如何知道要在途中安装哪些包。

阅读源代码,我觉得当我运行

composer require twig

Composer,作为一个插件,执行以下步骤:

  1. 查找名为 twig 的别名
  2. 发现它注册了 symfony/twig-pack 食谱
  3. 下载食谱并读取其 manifest.json
  4. 执行 manifest.json 中定义的所有操作,如创建额外的文件或附加内容到文件中

但我在 manifest.json 中没有看到安装 实际包 symfony/twig-pack 的地方。

这是否暗示着 所有 食谱必须与它们安装的包共享名称,这是Composer知道要安装哪个包的方式?

也就是说,开发人员不能只创建一个食谱 invented_company/nonexisting_package,只是在这里添加一些文件并在那里附加一些行,但实际上与Packagist上的包不对应?

英文:

I am trying to understand how Symfony recipes know what packages to install along the way.

Reading the source code, it seems to me that when I run

composer require twig

the composer, having flex as a plugin,

  1. looks for an alias called twig
  2. sees that it is registered for the recipe symfony/twig-pack
  3. downloads the recipe and reads its manifest.json
  4. executes all the actions defined in manifest.json, like creating extra files or appending stuff to files

But nowhere do I see in the manifest.json to install the actual package symfony/twig-pack.

Is it just implicit that all recipes have to share their name with the package they are installing and that this is the way how composer knows what package to install?

I.e. a developer can not just create a recipe invented_company/nonexisting_package that just adds a few files here and appends a few lines there, but not actually corresponds to a package on packagist?

答案1

得分: 1

有一个有关创建食谱的描述。

它说:

食谱必须存储在它们自己的存储库中,不得存储在您的Composer包存储库之内。它们必须遵循vendor/package/version/目录结构,其中version是食谱支持的最低版本。

https://github.com/symfony/recipes/blob/master/README.rst

英文:

There is a description of the creation of recipes.

It says

> Recipes must be stored on their own repositories, outside of your Composer package repository. They must follow the vendor/package/version/ directory structure, where version is the minimum version supported by the recipe.

https://github.com/symfony/recipes/blob/master/README.rst

huangapple
  • 本文由 发表于 2020年1月6日 18:40:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/59610625.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定