This article's objective is to facilitate the process of collaborating with PowerGrid.
To fork PowerGrid, you simply have to access the repository's page PowerGrid and click Fork:
As a result, you should have something similar to https://github.com/cpereiraweb/livewire-powergrid.
Note: If you are a member of different teams or organizations, you must select which account you will be forking to.
Select or create a new folder at your computer where you want to store project files:
Access the repository's folder:
cd livewire-powergrid
Create a new branch (For instance, my own name as the branch name):
git checkout -b cpereiraweb
You need to push this branch to the server. As a suggestion, create a TODO.md file at the project's root. Add it and commit.
touch TODO.md
git add .
git commit -m "Added TODO.md"
git push origin cpereiraweb # Use your branch name here, ok?
Open your Laravel's project and install the component as described in its documentation.
composer require power-components/livewire-powergrid
You will need to inform composer
that you want to use a developing version of this package and where is this version located.
This is very simple to do:
Open composer.json file and locate the PowerGrid requirement line:
"power-components/livewire-powergrid": "^1.0",
Following what I have done so far, I will configure the version which must be dev-
+your-branch-name
. Following our example: dev-cpereiraweb
:
"power-components/livewire-powergrid": "dev-cpereiraweb",
The second step is to inform where is the repository located. To do so, we add the section repositories
to the composer.json
file.
In this section you can inform either your Github repository URL or indicate its path on your local machine.
The example below uses the GitHub repository URL:
...
"spatie/laravel-ray": "^1.17",
"wulfheart/pretty_routes": "^0.2.0"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/cpereiraweb/livewire-powergrid.git"
}
],
"autoload": {
...
And, the next example shows the version with your local path:
...
"spatie/laravel-ray": "^1.17",
"wulfheart/pretty_routes": "^0.2.0"
},
"repositories": [
{
"type": "path",
"url": "Z:\\Code\\forks\\PowerComponents\\livewire-powergrid"
}
],
"autoload": {
...
Note: The example above shows a Windows OS path. If you are a WSL
, Docker
, Linux
or MacOS
user, you must adapt this path to your system's format.
For example: /home/cpereiraweb/code/forks/PowerComponents/livewire-powergrid
.
Now, just run composer update
command inside your Laravel project so composer can update its references. See below the result using the repository link:
The image shows the commits at my repository. First, I had installed the commit 219cdd8
. Now, at the image above you can see that it has been updated to the commit 65ae610
.
If you had your composer.json
configured to use a local path instead, you should have a result similar to this:
You may notice that the GitHub's version was removed and it was replaced by the local version. The commit indications are no longer displayed. With this configuration, I am not required to push
my fork nor run composer update
in my Laravel Project. It is a more dynamic process.
Now, just follow the regular flow of any Git project. Perform any changes to your own fork and push to Github.
Always run composer update
inside your Laravel project to update the codes used in your project.
That's it. Clean procedure and no MOP*.
*(MacGyver-oriented Programming)