New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use Grunt #1003
Comments
My little grain of salt... just so we can choice the right JS tasker, between |
@michaeltorbert here are all the tasks that need to be performed:
Do you want me to push changes only for task 1 above or also for 3? If for both, do you want me to create one single PR for both or would you prefer 2 different PRs? |
@contactashish13 I think it's better if the grunt plugins are in the WP plugin repo. |
@michaeltorbert i would suggest they be in a separate repository because they are going to be shared by the free and pro plugins. Also grunt tasks are not part of the plugin's functionality and this will unnecessarily complicate the grunt scripts. Could you also respond to my question about the PRs? |
@contactashish13 How would it complicate the grunt scripts? That should change them any. -Let's hold off on any PRs until we've finished deciding exactly what to do. |
@michaeltorbert is there a particular reason you want to keep grunt as part of the source code of the plugins despite it not adding any functionality to the plugin per se? |
@contactashish13 What happens when something only applies to one? Or when we stop having Pro be effectively a fork of free? |
@michaeltorbert Even if it applies only to one, it just seems more organized (following the separation of concerns paradigm) if these plugins are kept outside. What if tomorrow you want to give a grunt specialist access? You will have to give access to the entire plugin repo and not just grunt plugins. |
@contactashish13 If we need a grunt specialist, I'm happy to give him access to what he needs. :) |
@contactashish13 Why do we need a new repo for this? I have used grunt and gulp many times in the past and didn't had the need for an extra repo. I know this repo might need some restructuring, but aside from that a new repo just for grunt makes no sense to me. |
@amostajo I can't comment on those projects but in the projects that I have used grunt on, this is how the grunt specific part of package.json looks for every project
this loads all the grunt plugins from the mentioned repo and uses load-project-config (https://github.com/cedaro/load-project-config) to load each grunt plugin into the task list. I don't find mixing grunt plugins with WP plugin a very organized method but if that's the way we want to go, I can work with that. |
@michaeltorbert could you please let me know if there are still doubts about the implementation? If not, I can start working on this. |
@contactashish13 You can go ahead and implement it in your fork of the repository and I'll take a look. |
@contactashish13 What tasks are stored in the separeated repo? |
Do you have an example? |
@michaeltorbert I have been looking at load-project-config and seems to be a NodeJS that has no support nor documentation what so ever. Last update done was on June 2016 and in order to understand what the package does and how to use it is, you have to do some reverse engineering to the main file. This is clearly not a normal setup on any project, seems to be something specific done by a couple of people to setup their projects, we should use 3rd party packages that has at least documentation so any developer on the team can jump in and understand how to use them. @contactashish13 This is an example of a JS package I, Social Shares, made 2 years ago, which uses grunt. You can see on the |
@amostajo Looks good. |
@contactashish13 similar thing on a greater scale project such as jQuery-UI, look at their Please provide an example to see what are you trying to accomplish, thanks. |
@amostajo the approach used by jquery-ui and your previous project assume that the grunt tasks were to be used as-is. If any modification needs to be made to the task, the JS file that defines the code of the task needs to be stored somewhere. That is when https://github.com/cedaro/load-project-config is useful and, in the projects I have used, some tasks have been customized. Maybe it would be better for us to decide on what grunt tasks are required for this plugin and whether their in-the-wild code is good enough and does not need any customization. That will help decide the course of action. |
@contactashish13 sounds very reasonable. What tasks are required @michaeltorbert ? |
@amostajo I don't know, what did you and @contactashish13 have in mind? |
@michaeltorbert I though you and @contactashish13 had something in mind already... The tasks that come to my mind are:
Those tasks come to my mind atm. |
@amostajo I didn't have anything specific in mind. We can make a list of everything, and maybe start off slow. :) |
@amostajo the chat came about because I saw that the code for pro was hard to read because the indentation was a bit messy and in some places even the curly braces were out of whack and I wondered if it would not be better to use grunt to prettify the code and also enforce PHPCS/WPCS. So the tasks that come to my mind are phpcs/wpcs/phplint |
@michaeltorbert I've checked in a few things relevant to this. For the time being, I'm using only 5 plugins - PHP coding standards, beautifier, linter and JS linter and uglifier. This takes care of 90% of what we might require. Have checked in:
Here is how to configure grunt and its dependencies:
We can discuss this further once you review the PR: #1325 |
PR: #1591 This PR ignores whether phpdoc comments have been provided or not and only addressed code issues. @michaeltorbert Can you please check if this fall through is deliberate as there was no |
@michaeltorbert can we try to conclude on this so that going forward all PRs should have been run through grunt? |
@contactashish13 What happens for PRs that haven't been run through grunt, ie when a guest contributor creates a PR? |
@michaeltorbert they will have to be run through grunt before merging. |
@michaeltorbert wrt our conversation on Slack, I had already mentioned #1003 (comment) :) Another alternate way to go about handling guest PRs is by running grunt through travis only on the master branch. I'm not a big fan of this as, I believe, the master build publishes the wp.org and should be a fire-and-forget deployment. If we put grunt only there, someone will have to monitor that build and, if it fails (which it most likely will if grunt has not run on the PR before), pull the branch on a local dev, run grunt, fix issue, then merge again. Now this merge should never be on the master branch and should be on a dev/release branch. So this just increases the turn around time. I would, instead, prefer that guest PRs (not that they are so numerous any ways) be merged locally which they already are for testing and code review, run grunt, fix issues and then merge to dev. This is a much safer process. Again, using grunt is painful only the first time around, like what @EkoJR has been doing for #1607 (wpcs is just one part of the fix). Once the code base is fixed (which it hasn't since it was born), incremental changes will be seamless. @EkoJR can you please confirm you have tested the droplet and things run for you smoothly there? |
I don't want to crash the party, but can anyone explain to me why these things can't be done with a few plugins in PHPStorm? |
Got notified about this, just dropping a little grain of salt here... @arnaudbroes forcing the entire development and team members to only work with one IDE is not a good idea, more knowing that IDEs such as PHPStorm are not very efficient with the computer's resources (RAM and CPU consumption). This is why it is better to have a solution, like grunt or gulp, which is cross-platform and can be used with any IDE. It has become pretty much a standard now days to use dependency injection and java taskers to maintain and develop repositories. Regards |
@contactashish13 |
@michaeltorbert that can be automated through travis and a droplet as well. @EkoJR can you please confirm #1003 (comment)? |
@contactashish13 As far as I know, I already confirmed it back on the 1st of October (2018) via Slack |
@EkoJR cool, I couldn't find it anywhere. @michaeltorbert everything has been set up and tested by me and Ben. I think you need to test as well if you haven't already (the instructions are on slack). After that we need to actually implement it as part of our regular dev cycle. |
@michaeltorbert as discussed on the call, can you please test? The details were mentioned on slack some time ago. Can you also create a new branch called grunt so that it can be used for the grunted changes? @EkoJR can you run grunt and then create a PR for @michaeltorbert to merge (to that grunt branch) so that this part of the process is clear? |
@contactashish13 I don't need to test it if you're confident, and Ben has also tested. We can go ahead and move forward with this. Make sure there are clear guidelines/instructions on the dev process moving forward. ie you are Ben or whomever needs to run grunt at some point like we talked about on new PRs. |
PR #2171 contains the files that were changed by grunt. The changes might seem all over the place but if you look at the files and the changes, you will see that there are no breaking changes. Unit tests also confirm that independently but human eyes would be better to satisfy oneselves 😄 I have created a new branch on the main repo called The current changes are mostly cosmetic changes to improve the overall readability of the code. Many rules dealing with proper code commenting have been excluded for the time being and can be (/will be) activated later to ensure code comments are in place as well. @michaeltorbert @EkoJR @wpsmort please check and let me know if you find anything missing. The next steps, after validation of this. could be:
|
from private PM
"for phplinting and php coding standards...
it uses NodeJS and runs locally. It does quite a few things - running PHPCS, minimizing CSS/JS, optimizing images, running text-domain validations, preparing the POT file and even ensures phpunit test cases are run in case they are configured. PHPStorm makes the integrator responsible for a lot of these things whereas by using grunt, this responsibility can be distributed to the contributors 😄 I find it useful because I don't have to worry about checking in improper code. I mentioned it because I see lots of code that does not conform to coding standards. I can set it up if you want."
The text was updated successfully, but these errors were encountered: