Skip to content

Commit

Permalink
feat(config): add package lock commit setting
Browse files Browse the repository at this point in the history
Ref: #11
  • Loading branch information
Marco Cesarato committed Apr 15, 2021
1 parent 7ffd952 commit 2fc8247
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,9 @@ public function generate(InputInterface $input, SymfonyStyle $output): int
$bumper->setVersion($newVersion);
$bumper->save();
$filesToCommit[] = $bumper->getFilePath();
$filesToCommit = array_merge($filesToCommit, $bumper->getExistingLockFiles());
if ($this->config->isPackageLockCommit()) {
$filesToCommit = array_merge($filesToCommit, $bumper->getExistingLockFiles());
}
}
} catch (Exception $e) {
$output->error('An error occurred bumping package version: ' . $e->getMessage());
Expand Down
23 changes: 22 additions & 1 deletion src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ class Configuration
*/
protected $packageBump = true;

/**
* Commit package lock file.
*
* @var bool
*/
protected $packageLockCommit = true;

/**
* Ignore message commit patterns.
*
Expand Down Expand Up @@ -271,6 +278,7 @@ public function fromArray(array $array)
'preset' => $this->getPreset(),
'types' => [],
'packageBump' => $this->isPackageBump(),
'packageLockCommit' => $this->isPackageLockCommit(),
'ignoreTypes' => $this->getIgnoreTypes(),
'ignorePatterns' => $this->getIgnorePatterns(),
'tagPrefix' => $this->getTagPrefix(),
Expand Down Expand Up @@ -325,8 +333,9 @@ public function fromArray(array $array)
->setIgnorePatterns($params['ignorePatterns'])
->setIgnoreTypes($params['ignoreTypes'])
->setTypes($params['preset'])
// Bump Package
// Package
->setPackageBump($params['packageBump'])
->setPackageLockCommit($params['packageLockCommit'])
// Document
->setHeaderTitle($params['headerTitle'])
->setHeaderDescription($params['headerDescription'])
Expand Down Expand Up @@ -812,6 +821,18 @@ public function setPackageBump(bool $packageBump): Configuration
return $this;
}

public function isPackageLockCommit(): bool
{
return $this->packageLockCommit;
}

public function setPackageLockCommit(bool $packageLockCommit): Configuration
{
$this->packageLockCommit = $packageLockCommit;

return $this;
}

/**
* Validate settings.
*
Expand Down

0 comments on commit 2fc8247

Please sign in to comment.