composer: (Maybe bug?) "build" folder is not copied when mirroring
My composer.json:
{
"name": "graphql-api/graphql-api-for-wp",
"type": "wordpress-plugin",
"require": {
"php": "^7.4|^8.0",
"graphql-by-pop/graphql-clients-for-wp": "dev-master"
},
"repositories": [
{
"type": "path",
"url": "../../../../layers/GraphQLByPoP/packages/graphql-clients-for-wp",
"options": {
"symlink": false
}
}
]
}
Output of composer diagnose:
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.0.8
PHP version: 7.4.13
PHP binary path: /usr/local/Cellar/php@7.4/7.4.13_1/bin/php
OpenSSL version: OpenSSL 1.1.1h 22 Sep 2020
cURL version: 7.73.0 libz 1.2.11 ssl (SecureTransport) OpenSSL/1.1.1h
zip: extension present, unzip present
When I run this command:
composer install
It installs my packages. I’m using mirroring since all packages are hosted in a monorepo.
The mirrored package graphql-by-pop/graphql-clients-for-wp (using symlink => false) was successfully copied over, so far everything is OK.
However, the package contains a build folder (this one) that was NOT copied over.
Checking the content of build for the source, produces:
$ ls -l ../../../../layers/GraphQLByPoP/packages/graphql-clients-for-wp/clients/graphiql-with-explorer/build
total 32
-rw-r--r--@ 1 mac staff 1116 Nov 20 22:38 asset-manifest.json
-rw-r--r--@ 1 mac staff 420 Nov 20 22:38 index.html
-rw-r--r--@ 1 mac staff 1253 Nov 20 22:38 precache-manifest.68954ae21e420d7bd929958591027434.js
-rw-r--r--@ 1 mac staff 1039 Nov 20 22:38 service-worker.js
drwxr-xr-x@ 5 mac staff 160 Nov 20 22:38 static
Checking the content of build for the mirrored package produces:
$ ls -l vendor/graphql-by-pop/graphql-clients-for-wp/clients/graphiql-with-explorer/build
ls: vendor/graphql-by-pop/graphql-clients-for-wp/clients/graphiql-with-explorer/build: No such file or directory
That build folder contains the output of compiling an application with React, which expects it to be called build, so I can’t rename it.
Is the build folder always being skipped? Is this a bug? Or can I configure this somewhere?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (9 by maintainers)
Alright, thanks @rtm-ctrlz for the research work here. I merged #9465 which I hope resolves this conclusively. You can try it with
composer self-update --snapshot, or it’ll be in a release later this week.Sorry for so long response.
I make some tests and found the reason for your problem:
buildpattern without/at the beginningIn your setup, you want to exclude only “‘top level’
builddirectory”, but you wrote rule to exclude “any directory or file (no ending slash), that is namedbuildand located near.gitignorefile or any level below”.@leoloso, so you can update your packages/graphql-clients-for-wp/.gitignore to have line
/build/insteadbuildand it will resolve the problem for you right now without any changes in composer (tested with 2.0.8). May be there are some more packages inside your repository having same issue, sorry I’m way to lazy to check 😉.In a perfect this would be the very end, but there is other issue:
.gitignorefiles at any level for repository.gitignoreAnd here comes the tricky part in current setup (PoP repository):
buildbuilddirectory to git and excludes some file (.mapsand so on).As the result
builddirectory (with.html / .js / .css), root of this issue:vendordirectory after mirroring@Seldaek I think composer should use all
.gitignorefiles in repo, not just root one, but I’m not sure if it could be made so easy as it sounds.It would be good if you could try to run composer with #9465 to see if it fixes the issue for you. If not I’ll try and repro later… But anyway yes definitely should be fixed on our side.