Best approach, design pattern for multiple games development

Hey there!

I’m creating multiple games with Phaser. I’ve made a few games already and plan to make more. I developed my own Phaser wrapper using a factory design pattern. I keep improving this wrapper/game engine. When I finish a game that likely won’t need changes, I move to a new project folder for the next game. This way, I can alter base classes without worrying about breaking changes.

Now, my client wants me to build a larger game that may incorporate elements from the previous games. Is there a way to display these old games in a new project without importing their code? Should I use an IFrame? Is there a better way to communicate with these games? What do you suggest?

This situation is more complex than I expected. I didn’t anticipate creating multiple games or reusing them in future projects. Now, I’m unsure how to incorporate these old games without altering their code to avoid potential issues.

To give you some more idea, lets say you have a big game where you want to allow the player to play a mini game, the mini game is something you built before, how would you show it in the main/big game ?

Thank you for your help!