Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer: prevent a lock file from being created #828

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Nov 8, 2024

Composer 1.10.0 introduced a lock config option, which, when set to false will prevent a composer.lock file from being created and will ignore it when one exists.

This is a useful option for libraries such as this where the lock file has no meaning.

It also makes life easier for contributors as they don't have to remember that for this repo they should use composer update instead of composer install. Both will now work the same.

Refs:
https://getcomposer.org/doc/06-config.md#lock

Composer 1.10.0 introduced a `lock` config option, which, when set to `false` will prevent a `composer.lock` file from being created and will ignore it when one exists.

This is a useful option for libraries such as this where the `lock` file has no meaning.

It also makes life easier for contributors as they don't have to remember that for this repo they should use `composer update` instead of `composer install`. Both will now work the same.

Refs:
https://getcomposer.org/doc/06-config.md#lock
@jrfnl jrfnl added this to the 3.x milestone Nov 8, 2024
@jrfnl jrfnl requested a review from a team as a code owner November 8, 2024 11:18
@GaryJones
Copy link
Contributor

Why does the CI/CD unset the lock value (allowing the composer.lock to be created)?

@jrfnl
Copy link
Collaborator Author

jrfnl commented Nov 8, 2024

Why does the CI/CD unset the lock value (allowing the composer.lock to be created)?

The reason is that we first use ramsey/composer-install to install & cache the dependencies and then only for builds with matrix.dependencies == 'lowest' runs a selective composer update --prefer-lowest ... for only the CS dependencies.

Without the lock file, that second command would run into the following Composer error:

Cannot update only a partial set of packages without a lock file present. Run `composer update` to generate a lock file.

@GaryJones Does that answer your question ?

@GaryJones
Copy link
Contributor

It does (and it's what I suspected) - thanks!

@GaryJones GaryJones merged commit 6e53ed0 into develop Nov 8, 2024
40 checks passed
@GaryJones GaryJones deleted the feature/composer-no-lock branch November 8, 2024 12:48
@jrfnl jrfnl modified the milestones: 3.x, 3.x Next Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants