symfony / recipes

Symfony Recipes Repository
https://github.com/symfony/recipes/blob/flex/main/RECIPES.md
MIT License
956 stars 472 forks source link

Issue when updating symfony/asset-mapper recipe #1271

Closed javiereguiluz closed 6 months ago

javiereguiluz commented 7 months ago

I'm upgrading a project to Symfony 7 and when trying to update the symfony/asset-mapper recipe, I see this error:

The problem is here:

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

Instead of composer.json, it's trying to update the composerjson file.

And this is the diff file generated:

diff --git a/composerjson b/composerjson
index 98dd8cb..1029865 100644
--- a/composerjson
+++ b/composerjson
@@ -118,7 +118,8 @@
     "scripts": {
         "auto-scripts": {
             "cache:clear": "symfony-cmd",
-            "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
+            "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
+            "importmap:install": "symfony-cmd"
         },
         "post-install-cmd": [
             "@auto-scripts"
fabpot commented 7 months ago

@weaverryan maybe?

javiereguiluz commented 6 months ago

Let's close this issue. It's such an obvious problem that if other people suffered it, we would have received feedback about it. It was probably a weird temporary issue on my side. Thanks!

klkvsk commented 5 months ago

Found the source of this problem here: https://github.com/symfony/flex/blob/bec213c39511eda66663baa2ee7440c65f89c695/src/Configurator/ComposerScriptsConfigurator.php#L52

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

if root dir is ".", then "./composer.json" becomes "composerjson"