You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When started integrating this with real projects, it appeared that having a processor per question did not make sense as
a) processing could affect other processing
b) the code was extremely hard to read because different processing took place elsewhere
We can simplify the Customizer to do the following:
Init config
1.1 Init properties like cwd, io, fs
1.2 Find and read the config file
1.3 Validate expected config file methods and callbacks. Make sure that both questions() and process() are added (or the config file does not make sense).
Ask questions and get answers
2.1 Call default value callback to get the state from the env - NEW (allows to use Customizer for existing projects)
2.2 Call each question from the map of questions callbacks
2.3 Add simplest validator utilities - NEW (allows to validate general use cases like php package name) - would be a copy from Str2Name.
Process answers
3.1 Use a single process() callback passed from config. This will allow to handle everything in a single place.
Cleanup
3.1 Allow to provide cleanup() callback in the config file. If the callback returns FALSE - the rest of the cleanup is cancelled. Any changes to composer.json would need to be written back to the file within the callback.
3.2 Run generic cleanup to remove entires from composer.json. The composer.json contents will be re-read before making changes (to pickup modifications possible done in cleanup() callback).
3.3 Update composer deps (if run as a plugin file).
The text was updated successfully, but these errors were encountered:
When started integrating this with real projects, it appeared that having a processor per question did not make sense as
a) processing could affect other processing
b) the code was extremely hard to read because different processing took place elsewhere
We can simplify the Customizer to do the following:
1.1 Init properties like
cwd
,io
,fs
1.2 Find and read the config file
1.3 Validate expected config file methods and callbacks. Make sure that both
questions()
andprocess()
are added (or the config file does not make sense).2.1 Call default value callback to get the state from the env - NEW (allows to use Customizer for existing projects)
2.2 Call each question from the map of questions callbacks
2.3 Add simplest validator utilities - NEW (allows to validate general use cases like php package name) - would be a copy from
Str2Name
.3.1 Use a single
process()
callback passed from config. This will allow to handle everything in a single place.3.1 Allow to provide
cleanup()
callback in the config file. If the callback returnsFALSE
- the rest of the cleanup is cancelled. Any changes tocomposer.json
would need to be written back to the file within the callback.3.2 Run generic cleanup to remove entires from
composer.json
. Thecomposer.json
contents will be re-read before making changes (to pickup modifications possible done incleanup()
callback).3.3 Update composer deps (if run as a plugin file).
The text was updated successfully, but these errors were encountered: