Improve scaffolding commands #201
Replies: 5 comments 6 replies
-
@RomainMazB very good suggestions here. I'll comment on each individually:
As long as @LukeTowers' suggestions from the original issue on October are integrated with the PR, I'm happy with that. Anything that makes it easy to translate will be good.
Your idea is on the right track. I would love, if it is indeed possible, for a command which scans available language strings in a plugin's files and creates placeholder translate files that can then be easily populated with the translations. If this is too flaky/difficult, even just a command that copies a main language file (say the
Love it - this is definitely a good idea.
Again, great idea. There's a bit of boilerplate code with the plugin tests that could definitely be made easier with a scaffold.
OMG YES. This shits me to tears - I'm half-tempted to write this myself. I had a handy helper command with the Dusk plugin which did this already for the Dusk tests, so I would imagine it would be easily portable for the normal plugin tests. |
Beta Was this translation helpful? Give feedback.
-
This is great and it will sure help people getting started. Along with comments. Two more thing that would have been nice
|
Beta Was this translation helpful? Give feedback.
-
Super cool suggetions/ideas. |
Beta Was this translation helpful? Give feedback.
-
Awesome ideas. |
Beta Was this translation helpful? Give feedback.
-
We started a "debate" into a PR mentioned in this discussion. Any feedback on how localized plugins development could be improved are welcome. |
Beta Was this translation helpful? Give feedback.
-
Requests:
create:plugin
commandcreate:tests
command--settings
option tocreate:model
command (Add create:settings command storm#37)run:tests
command (Add winter:test command #202)Background
All of us would agree that the scaffolding command is a great things in WinterCMS as it is into Laravel.
I've build many plugins this last weeks and used them widely, so I wanted to give my feedback on what could and should be improved from a "plugin-creator" point of view.
Also I'd like to get some other "plugin-creators" feedback here on how the features should be implemented
Translation keys into stubs
The first thing that should be improved is the translation keys into controllers. Most of them are already included into the core and translated in many language. I've modified the stubs here: wintercms/storm#35
All of us need this:
[EDIT] @mjauvin pointed me out that a related feature has not been merged in the past due to the fact that it would be hard for beginners to read and modify the view file.
This should live as an option of the
create:controller
command:Add composer.json file to
create:plugin
commandBecause the marketplace will widely rely on composer-installation (stop me if I'm wrong), the
create:plugin
file should create the composer.json file.Most of us has never published a package, easing the first step is a nice-to-have and will encourage us to do so.
The composer.json file can't contain any comment. To guide the users into publishing his package on packagist, the command-line should display into the terminal a link to this page which include a "how-to" section.
Generate the lang folder from command-line - PR open here: wintercms/storm#36
A thing which is missing into the scaffolding commands is definitely the lang folder, I keep creating it plugin after plugin.
Because many of us will use
create:plugin
command to create site-specific plugin which will never be translated or may not even need user-readable text (Eg: a tinyPlugin.php
file just to register to some event and process some logic), this should probably live into an option of thecreate:plugin
command:maybe this option could be filled with some extra locales that he want to translate himself:
the default would be the
en
and[current_installation_locale]
files.Using this option, it would generates the lang folder and locale files but also include keys into the
Plugin.php
file:The presence of the lang folder should also be detected into
create:model
,create:component
andcreate:reportwidget
commands to generate the stub files including translation keys.This would ease and so increase the number of translated plugins at a long term.
Add a
--settings
option tocreate:model
command - PR open here: wintercms/storm#37A thing that annoyed me is to create a basic model that I should almost modify totally to make it as a settings model.
The
create:model
command should accept a--settings
option that would generate a basic settings model and not create acreate_model_table.php
file.if possible, passing this option would make the model class name optional and would default to
Settings
so this command would be valid:Add a
create:tests
commandIt won't be the most used for sure but easing the creation of plugin-test will improve the community-plugins code quality at a long term and we'll all benefits from this.
This command line should generate the basic files including a passing test:
A shortcut to this could be included into
create:plugin
command, imagine ❤️ :Add a
run:tests
command - PR Open here: #202Additionally to the previous one, it was a bit annoying to go into each plugin folder to run the plugin's tests.
When I worked on some plugins that should work together, I had to make many:
../../../vendor/bin/phpunit
../../../vendor/bin/phpunit
This command should be possible to be ran from the root:
End-note
I could work on all these features as soon as most of us agree on the need of these and how they should be implemented. So please plugin-creators: Give us your feedback!
Do you think about anything that you would see implemented that I'm missing or should the commands I described be implemented in another way / syntax?
Beta Was this translation helpful? Give feedback.
All reactions