Skip to content

Handling of already existing files when requiring/removing a pack #428

Closed
@Lyrkan

Description

@Lyrkan

Hi there,

I've seen multiple issues opened on the Encore repository that were caused by an already existing package.json file when requiring the related pack (the most recent one being symfony/webpack-encore#411).

Since the recipe adds this file using the copy-from-recipe configurator it fails silently when the user already has one (which may not be an uncommon situation and means that Encore won't be installed).

Also annoying: if the user decides to remove the pack it will also remove the package.json file (which has probably been modified by then) without any warning.

The first issue could probably be handled by adding a message if copy-from-recipe wasn't able to copy a file for this reason, but:

  • I'm not sure that it will be enough for the users to know what they have to do (even though we could add something in the doc about it I'm afraid it won't be that obvious)
  • There may be some situations where that message would probably not be needed and have the opposite effect (people being worried about a warning message that they could safely ignore)

For the second problem, package.json could probably be ignored in the removeFiles method the same way it's currently done for the ".git" repository, but I'm not sure that adding something that specific to a recipe into Flex's code would be a good idea...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions