Wednesday, 31 May 2017

Can I `git init` a node module and sync with an existing repo?

I have a parent project, which used to contain several dependencies as git submodules. This was great as I would often develop the submodules as I was developing the parent project, and the parent project was the perfect environment to test submodule changes in real time. Once I'd finished my changes to the submodule, I could just cd into it from the parent module, and commit/push all the changes to the submodule's remote when I was ready, after having already experimented with the changes in the parent project.

I have now decided I want to be cool, so have converted my dependencies into node modules, and got rid of git submodules entirely (but the dependencies still use Git and are hosted on Github).

I have lost one great benefit of my previous workflow, and that is the ability to develop my dependencies alongside the parent project - that is of course unless I initialise the node_module as a git repo setting the existing Github url as the remote. Right now I have to make changes to the node_module independently, make a new release, and update the package in the parent project, just to get my new changes into the parent project.

On paper I can't see any issues with what I want to do, but it definitely feels wrong, in many ways. Is there a better solution to my problem?



via Edmund Reed

No comments:

Post a Comment