Skip to content

Commit 1d6cedc

Browse files
committed
fix jsonPath in ComposerScriptsConfigurator::update
1 parent 8867a65 commit 1d6cedc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Configurator/ComposerScriptsConfigurator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ public function unconfigure(Recipe $recipe, $scripts, Lock $lock)
5050
public function update(RecipeUpdate $recipeUpdate, array $originalConfig, array $newConfig): void
5151
{
5252
$json = new JsonFile(Factory::getComposerFile());
53-
$jsonPath = Path::makeRelative($json->getPath(), $recipeUpdate->getRootDir());
53+
$jsonPath = $json->getPath();
54+
if (str_starts_with($jsonPath, $recipeUpdate->getRootDir())) {
55+
$jsonPath = substr($jsonPath, strlen($recipeUpdate->getRootDir()));
56+
}
57+
$jsonPath = ltrim($jsonPath, '/\\');
5458

5559
$recipeUpdate->setOriginalFile(
5660
$jsonPath,

0 commit comments

Comments
 (0)