Easiest way to extract and share code between projects?

We’re working in a team of 4 developers, we have 2 big separate repositories, but in the past we’ve been copy pasting code that is required in both (for example interfaces, structures).

Yesterday I succeeded in creating a repository for the shared code, adding it to Github Packages and require it using npm install.

However now when someone makes a change to this separate package, a new release has to be made, package.json has to be updated, and I feel like this is going to cause issues in the long run.

Is there a proven method of going about this?

Yeah, but that’s kind of just how it is. But isn’t that how it should be? Imagine if you made a breaking change to the shared repo, would you want the consuming repos to automatically update? I’d rather update them manually so I would know to test everything.

I think the key is communication. I think you need to document exactly what is in the common repo and agree with both consuming teams how the items in the common repo will work, perhaps writing out “contracts”. And making it very clear when changes are happening to what elements in which versions so they know what to check. I think the key here is communication.