Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #19154 > unrolled thread

[composer] duplicate vendor

Started bypaul <sk@i.p>
First post2022-11-12 11:38 +0100
Last post2022-11-21 09:56 +0100
Articles 8 — 2 participants

Back to article view | Back to comp.lang.php


Contents

  [composer] duplicate vendor paul <sk@i.p> - 2022-11-12 11:38 +0100
    Re: [composer] duplicate vendor Arno Welzel <usenet@arnowelzel.de> - 2022-11-13 14:56 +0100
      Re: [composer] duplicate vendor paul <sk@i.p> - 2022-11-15 09:29 +0100
        Re: [composer] duplicate vendor Arno Welzel <usenet@arnowelzel.de> - 2022-11-15 12:51 +0100
          Re: [composer] duplicate vendor paul <sk@i.p> - 2022-11-15 13:19 +0100
            Re: [composer] duplicate vendor Arno Welzel <usenet@arnowelzel.de> - 2022-11-15 14:05 +0100
              Re: [composer] duplicate vendor paul <sk@i.p> - 2022-11-15 15:30 +0100
                Re: [composer] duplicate vendor paul <sk@i.p> - 2022-11-21 09:56 +0100

#19154 — [composer] duplicate vendor

Frompaul <sk@i.p>
Date2022-11-12 11:38 +0100
Subject[composer] duplicate vendor
Message-ID<tknt3k$1bj$2@gioia.aioe.org>
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-----

[toc] | [next] | [standalone]


#19155

FromArno Welzel <usenet@arnowelzel.de>
Date2022-11-13 14:56 +0100
Message-ID<jtcbceFaq6aU1@mid.individual.net>
In reply to#19154
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

[toc] | [prev] | [next] | [standalone]


#19156

Frompaul <sk@i.p>
Date2022-11-15 09:29 +0100
Message-ID<tkviks$be6$1@gioia.aioe.org>
In reply to#19155
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?

[toc] | [prev] | [next] | [standalone]


#19157

FromArno Welzel <usenet@arnowelzel.de>
Date2022-11-15 12:51 +0100
Message-ID<jthcphF5hp8U1@mid.individual.net>
In reply to#19156
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

[toc] | [prev] | [next] | [standalone]


#19158

Frompaul <sk@i.p>
Date2022-11-15 13:19 +0100
Message-ID<tl004t$pmi$1@gioia.aioe.org>
In reply to#19157
Il 15/11/22 12:51, Arno Welzel ha scritto:
> "local" composer.json

????

[toc] | [prev] | [next] | [standalone]


#19159

FromArno Welzel <usenet@arnowelzel.de>
Date2022-11-15 14:05 +0100
Message-ID<jthh3tF630dU3@mid.individual.net>
In reply to#19158
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

[toc] | [prev] | [next] | [standalone]


#19160

Frompaul <sk@i.p>
Date2022-11-15 15:30 +0100
Message-ID<tl07pa$f6k$1@gioia.aioe.org>
In reply to#19159
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.

[toc] | [prev] | [next] | [standalone]


#19174

Frompaul <sk@i.p>
Date2022-11-21 09:56 +0100
Message-ID<tlfegr$123s$1@gioia.aioe.org>
In reply to#19160
Il 15/11/22 15:30, paul ha scritto:
> ...

Any comments?
Like, do not like?

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web