Repository navigation
Conversation
|
Thanks for implementing this! Having a I reviewed the implementation and have a few suggestions before merging:
The existing tests are a good starting point, particularly the confirmation and other-module preservation tests. I support the feature, but I think these edge cases should be addressed before merging. Thanks! |
|
One additional consideration: I think we should prevent removing a module if another installed module depends on it. For example, if the Expected behaviorGiven the following modules: text Where:
The expected behavior should be:
Suggested implementationBefore removing a module, could we:
For example: text Additional considerationI'd also recommend checking transitive dependencies. For example: text Removing The dependency check should rely on the declared Composer dependencies rather than runtime module discovery alone. This ensures that even modules that aren't currently loaded are still considered. I think this safeguard is important to prevent accidentally breaking other modules and to make My recommendation is to make dependency checking mandatory rather than an optional flag. A module manager should protect the integrity of the application's dependency graph by default. Thanks! |
|
Thanks for the detailed review. The edge cases and dependency
safeguard are clear. Before changing the scope, should the transitive
dependency check and simulated Composer write failures be included in
this PR, or would you prefer the broader dependency-graph validation
to be handled separately?
|
…:remove
The working directory is now restored even when the application composer.json cannot be read or written.
Removing the last package of a section used to leave an empty JSON list behind ("require-dev": []), which Composer rejects. The section now goes away with its last package.
Adds tests for a module listed in require-dev, and for modules whose composer.json is missing or invalid.
I'd prefer to keep this PR focused on the core The transitive dependency check is worth addressing, but I think broader dependency-graph validation deserves its own scope and dedicated tests. The same goes for simulated Composer write failures — they're useful for validating failure handling, but I'd rather avoid expanding this PR unless they're necessary to guarantee the current implementation is safe. Let's get the essential removal flow merged first, then tackle the broader dependency handling separately. |
Closes #71
What it does
php artisan modules:remove {name}reverses whatmake:modulesets up:composer.jsonname) fromrequire/require-devin the applicationcomposer.jsoncomposer update <package>command to run afterwardsIt asks for confirmation before deleting anything (
--forceskips it; declining or running non-interactively without--forceaborts with exit code 1). Unknown module names fail with exit code 1.The
app-modules/*path repository is left alone, since it's shared by every module.Tests
Added
ModulesRemoveTest(removal, other modules untouched, confirmation accepted/declined, unknown module). Full suite passes (136 tests).Thanks @adam-dziuk for letting me pick this up.