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

fix jsonPath in ComposerScriptsConfigurator::update #1011

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from

Conversation

klkvsk
Copy link

@klkvsk klkvsk commented Feb 8, 2024

Fixes #1010

$jsonPath = ltrim(str_replace($recipeUpdate->getRootDir(), '', $json->getPath()), '/\\');

In case when root dir = ".", it replaces the dot in filename, and then applying the patch is broken with:

NOTE:
  The file composerjson was not updated because it doesn't exist in your app.

Change to using Path::makeRelative for proper result.

@@ -49,7 +50,7 @@ public function unconfigure(Recipe $recipe, $scripts, Lock $lock)
public function update(RecipeUpdate $recipeUpdate, array $originalConfig, array $newConfig): void
{
$json = new JsonFile(Factory::getComposerFile());
$jsonPath = ltrim(str_replace($recipeUpdate->getRootDir(), '', $json->getPath()), '/\\');
$jsonPath = Path::makeRelative($json->getPath(), $recipeUpdate->getRootDir());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flex has no dependencies other than composer-plugin-api, so it is not possible to use an external package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ComposerScriptsConfigurator can break "composer.json" filename in patch
2 participants