In the composer file, what does the "link" refer to?

In my composer.lock

file, I noticed that some packages are relevant reference

:

"dist": {
    "type": "zip",
    "url": "https://ftp.drupal.org/files/projects/paragraphs-8.x-1.1.zip",
    "reference": "8.x-1.1",
    "shasum": "c678e5704a98c6a0549e415412da081cfeb03a00"
},

      

And some just have null

:

"dist": {
    "type": "zip",
    "url": "https://ftp.drupal.org/files/projects/redirect-8.x-1.0-alpha5.zip",
    "reference": null,
    "shasum": "927aa4c8d8b40b0cd2442bee86f2f386d25e53ca"
},

      

What does meaning refer to? I thought it was about committing, but both are packages zip

where 1 has reference

and the other does not.

+3


source to share


1 answer


I checked the code of both modules and read several articles. After a bit of research and discussion with the JS developers, I figured out that a "link" in a linker file stands for a library library tag, branch, or zip file. So, for example, if I say the link to my package is from "reference":"master"

, then this will pull the code from that repository every time I run the composer update command. Defining a link is a way to omit the requirement to add the composite file to the library. But if your library already supports composer using the composer.json file in its own directory, you won't need to define the package in the composer file.

Now let's come to both of these modules. First check the source tree of the paragraph module at http://cgit.drupalcode.org/paragraphs/tree/?h=8.x-1.x and you will notice that there is no composer.json file, so we need to define the referenced an option in the composer file to tell the application to select the correct source files. But on the other hand, if you see the source tree of the redirection module code at http://cgit.drupalcode.org/redirect/tree/ , you will find the composer .json at the root of the file. This file will allow you to omit the reference parameter from your application composer.json file.



Also, I think that if we don't define this parameter, the latter will be pulled in and based on the above criteria, the composer.lock file will be updated after running the linker command.

Hope this clears your doubts!

+3


source







All Articles