Add option to disable the lock file

When the `lock` option is set to false, composer will not write a
`composer.lock` file to disk. This signals that the package is meant
to be developed with unlocked and always updated dependencies. At the
moment, both `install` and `update` are allowed to install the
dependencies for such a package. If #6822 is implemented, only `update`
should be used for packages without a lockfile.

https://github.com/composer/composer/issues/8354
main
Arnout Boks 5 years ago
parent f753c15664
commit 7c5e5e3ede

@ -296,4 +296,9 @@ Example:
Defaults to `true`. If set to `false`, Composer will not create `.htaccess` files
in the composer home, cache, and data directories.
## lock
Defaults to `true`. If set to `false`, Composer will not create a `composer.lock`
file.
← [Repositories](05-repositories.md) | [Community](07-community.md) →

@ -290,6 +290,10 @@
"sort-packages": {
"type": "boolean",
"description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
},
"lock": {
"type": "boolean",
"description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
}
}
},

@ -412,6 +412,7 @@ EOT
),
'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
'lock' => array($booleanValidator, $booleanNormalizer),
);
$multiConfigValues = array(
'github-protocols' => array(

@ -63,6 +63,7 @@ class Config
'archive-dir' => '.',
'htaccess-protect' => true,
'use-github-api' => true,
'lock' => true,
// valid keys without defaults (auth config stuff):
// bitbucket-oauth
// github-oauth
@ -329,6 +330,8 @@ class Config
return $this->config[$key] !== 'false' && (bool) $this->config[$key];
case 'use-github-api':
return $this->config[$key] !== 'false' && (bool) $this->config[$key];
case 'lock':
return $this->config[$key] !== 'false' && (bool) $this->config[$key];
default:
if (!isset($this->config[$key])) {
return null;

@ -118,7 +118,7 @@ class Installer
protected $preferStable = false;
protected $preferLowest = false;
protected $skipSuggest = false;
protected $writeLock = true;
protected $writeLock;
protected $executeOperations = true;
/**
@ -164,6 +164,8 @@ class Installer
$this->installationManager = $installationManager;
$this->eventDispatcher = $eventDispatcher;
$this->autoloadGenerator = $autoloadGenerator;
$this->writeLock = $config->get('lock');
}
/**

Loading…
Cancel
Save