Skip to content
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

Feature Request: Git Submodule option #163

Open
DellanX opened this issue Aug 31, 2023 · 6 comments
Open

Feature Request: Git Submodule option #163

DellanX opened this issue Aug 31, 2023 · 6 comments

Comments

@DellanX
Copy link

DellanX commented Aug 31, 2023

The ask

Could there be some equivalent command to packager:git that uses submodules.
I think this would be duplicating the command but replacing git clone with git submodule add

Context

I am working on multiple packages that has a lot of UI views, and the frontend folks on my team with don't know laravel very well. By using submodules, I can wrap our package development environment into a laravel instance with a .gitmodules file.

I use the packager:git command to setup composer for myself, but am looking for a way to make it so that they can develop without me launching a private packagist repository.

@Jeroen-G
Copy link
Owner

I'm not really working on this package at the moment but your idea sounds nice and could maybe be a flag to pass with the existing git command. If you're able to create a PR I'd be happy to review it!

@dave-mills
Copy link

@DellanX your post is perfect timing for me! I'm also working on a setup to let us develop multiple packages with a lot of front-end assets, and was starting down the route of submodules...

If you're going to work on a PR for this, great! If not, I'll try and put something together next week as I'd like to use this package along with a submodule setup.

@DellanX
Copy link
Author

DellanX commented Aug 31, 2023

I think the feature is pretty easy to add and will give it a shot over the next few days. I've never worked with commands before, so it may take a bit of tinkering.

@DellanX
Copy link
Author

DellanX commented Aug 31, 2023

Okay, created a fork, and implemented a change.
There was already a few speed bumps I'll need to solve:

  1. Path format. Right now the submodule path is absolute (/var/www/html/packages/vendor/package).
    while everyone on my side uses sail, I could see this becoming an issue for a non-sail developer.
    I'm adding an optional config setting to allow defining the packages directory.
  2. Removing a package.
    The directory can't just be deleted, it'll need to identify that a submodule is present, and run git rm <path>

@dave-mills
Copy link

I'm adding an optional config setting to allow defining the packages directory.

As a non-sail dev, thank you! :)

@DellanX
Copy link
Author

DellanX commented Oct 25, 2023

As a heads up, I stopped working on this a bit ago. But I can drop what I discovered here:

  1. The change to add support for git submodule was pretty easy, you can look at my repo here: https://github.com/DellanX/laravel-packager
  2. The difficulties with this functionality are making sure that the submodule is tracked correctly, as the conveyer isn't really compatible.

To handle naming the submodule correctly, the easiest way to publish the packager config file, and set the path to 'packages'
Perhaps a function can later be added to conveyor to get the entire path relative to the project directory.

To handle removing packages... never really got there. You'll likely need to execute git rm somewhere in the Remove Command. (I added it a few times, but it struggled. Perhaps the force flag is required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants