• [composer] duplicate vendor

    From paul@21:1/5 to All on Sat Nov 12 11:38:44 2022
    I state that my question is not mainly about php, but composer.

    Here's the question ...

    + cat .config/composer/config.json
    {
    "repositories": {
    "b": {
    "type": "path",
    "url": "$PWD/b"
    },
    "c": {
    "type": "path",
    "url": "$PWD/c"
    }
    }
    }

    + cat a/composer.json
    {
    "require": {
    "test/b": "^1.0"
    }
    }

    + cat b/composer.json
    {
    "name": "test/b",
    "version": "1",
    "require": {
    "test/c": "^1.0"
    }
    }

    + cat c/composer.json
    {
    "name": "test/c",
    "version": "1"
    }

    As you can see, only the *test/b* package requires the *test/c* package. However, as you will see below, the *vendor/test/c* directory I find it
    both under directory *b*, and under the directory *a*.

    + composer update --working-dir=b
    + composer update --working-dir=a
    + find | grep vendor/test/c
    ./b/vendor/test/c
    ./a/vendor/test/c

    Can the directory *a* contains *vendor/test/c* be prevented?

    -----BEGIN PGP MESSAGE-----

    hQGMAyHa6HqE1N3qAQv+KYYFpZIEv8f+2NW2oSuvaVwYTJNGpU/w4sQNTVjrMkS7 gaqXzeyhD25Hgcgw844fWr4E0rW9OOrVu25/qz9QefpJUpzE+UQfwU0oDbWh/YvK EEP61Nq0pFLrTojuA0rd0vVIRlQvbw4NdmLZlolUtdqaeqJNOe5HTW00gSL3g3GJ LgwQpcixqZfvRvPeB5sMNzmgYKQsgQ3SNRgO2vFFavZNa/IBTcwIHTuh/WW/1+tc NU1uNMUZyGPR6PM6MXTKWoRdS+L32WzrIaYd+zv92j9HnYM4zK/4ZzVO+Bfii0ni XrnBF1RAn6XwzoUf1R9GncpVHJnkFw1HZ1naypcmbb/uX2wCyei35GZa6/QKQPWb rxC5EG6o+Ry0+xaK9TZVWc5iFJ/WezufzoaAIL4yo8iXdcV/frD8252RKoDnx5qY TMZKG1e181NYDqAIJRPQlwdGF3mMukyD7R7pDm+1RaUG9r0az4hQ7pt+OUyU0A70 IE5mnbr6G90nmfVRp/sK0oEBUKTvqP16qewTm9O+bxUA3jvgg8Mg93/6lTKLfOmC K4wJ9+Op0fsBjMY1dbz/hrTIyYdiMPC5wYpvSmW8gN3O+AeFIs3DeRC2TanFS6Hw +SZAIQFGLCz9aEZ4tLSZWioCFZsvWVTVJCv5E+1NEcgBIy7czVw0QaWhlHZsH+Nt
    RB4=
    =plmD
    -----END PGP MESSAGE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Sun Nov 13 14:56:30 2022
    paul, 2022-11-12 11:38:

    I state that my question is not mainly about php, but composer.

    Here's the question ...

    + cat .config/composer/config.json
    [...]
    + cat a/composer.json
    [...]
    + cat b/composer.json
    [...]
    + cat c/composer.json
    [...]
    As you can see, only the *test/b* package requires the *test/c* package. However, as you will see below, the *vendor/test/c* directory I find it
    both under directory *b*, and under the directory *a*.

    Composer is not intended to be used this way. Usually you have exactly
    *one* composer.json in your project and not multiple ones.

    [...]
    -----BEGIN PGP MESSAGE-----

    Why do you add PGP encrypted messages to your posts?


    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From paul@21:1/5 to All on Tue Nov 15 09:29:15 2022
    Il 13/11/22 14:56, Arno Welzel ha scritto:
    Composer is not intended to be used this way. Usually you have exactly
    *one* composer.json in your project and not multiple ones.

    A, B, and C would be three distinct projects (packages) IHMO, each with
    their respective composer.json
    What do you mean?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Tue Nov 15 12:51:14 2022
    paul, 2022-11-15 09:29:

    Il 13/11/22 14:56, Arno Welzel ha scritto:
    Composer is not intended to be used this way. Usually you have exactly
    *one* composer.json in your project and not multiple ones.

    A, B, and C would be three distinct projects (packages) IHMO, each with
    their respective composer.json

    In that case your question makes no sense:

    "Can the directory *a* contains *vendor/test/c* be prevented?"

    If a, b and c are independent projects they won't influence each other.
    However if they are part of one single project then there must not be a
    "local" composer.json, because Composer is not intended to be used as a
    "local" package manager inside a package.

    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From paul@21:1/5 to All on Tue Nov 15 13:19:41 2022
    Il 15/11/22 12:51, Arno Welzel ha scritto:
    "local" composer.json

    ????

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Tue Nov 15 14:05:03 2022
    paul, 2022-11-15 13:19:

    Il 15/11/22 12:51, Arno Welzel ha scritto:
    "local" composer.json

    ????

    From your original post:

    + cat a/composer.json
    + cat b/composer.json
    + cat c/composer.json

    So either you have three separate projects "a", "b" and "c" which each
    use Composer *or* you have one project with the packages "a", "b" and
    "c" - but then you should also only have *one* composer.json for your
    project and treat a, b and c just as parts of your project.


    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From paul@21:1/5 to All on Tue Nov 15 15:30:02 2022
    Il 15/11/22 14:05, Arno Welzel ha scritto:
    paul, 2022-11-15 13:19:

    Il 15/11/22 12:51, Arno Welzel ha scritto:
    "local" composer.json

    ????

    From your original post:

    + cat a/composer.json
    + cat b/composer.json
    + cat c/composer.json

    So either you have three separate projects "a", "b" and "c" which each
    use Composer *or* you have one project with the packages "a", "b" and
    "c" - but then you should also only have *one* composer.json for your
    project and treat a, b and c just as parts of your project.

    Bah... it will be like you say... maybe...
    Anyway look a little what I did


    Il 12/11/22 11:38, paul ha scritto:
    + cat b/composer.json
    {
    "name": "test/b",
    "version": "1",
    "require": {
    "test/c": "^1.0"
    }
    }

    $ cat new-composer.json
    {
    "config": {
    "vendor-dir": "internal-vendor"
    },
    "name": "test/b",
    "version": "1",
    "require": {
    "test/c": "^1.0"
    }
    }
    $ mv new-composer.json b/composer.json
    $ find b -name *vendor*
    b/vendor
    $ composer update --working-dir=b
    $ find b -name *vendor*
    b/vendor
    b/internal-vendor
    $ rm -rf b/vendor
    $ find b -name *vendor*
    b/internal-vendor

    OK!!!!!!

    Il 12/11/22 11:38, paul ha scritto:
    + find | grep vendor/test/c
    ./b/vendor/test/c
    ./a/vendor/test/c

    $ find | grep vendor/test/c
    ./b/internal-vendor/test/c
    ./a/vendor/test/c
    $ find | grep vendor/test/c | grep -v internal-vendor
    ./a/vendor/test/c

    It seems that it is fine.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From paul@21:1/5 to All on Mon Nov 21 09:56:59 2022
    Il 15/11/22 15:30, paul ha scritto:
    ...

    Any comments?
    Like, do not like?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)