PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, November 28, 2022

[FIXED] How can I organize a project to share code?

 November 28, 2022     git, module, typescript, version-control     No comments   

Issue

I'm writing some applications on top of a common core that I built, a sort of my-own-framework.

I would like to have this applications linked, so if I update a file in the common core, every application will be updated as well.

So I organized the code like this. I created a github project where in the main branch there is the common core files, and then every single branch is a different application. So if I update the common core, I can create a pull request from main to application branch and the common core will be updated.

Everything works fine like this, the only problem is when I have particular situations.

If I have to edit a common core file inside an application branch, because for example I need a different behaviour just for that application, I would like to have the opportunity to keep that single file of common core isolated and edited just inside the application branch, but the other files should be updated like before.

Instead, obviously in this situation I couldn't merge the pull request anymore, because the file inside the application branch is different from the one in the common core.

My projects are normally organized like this:

core/...
features/...
public/...
main.ts

core and public folders contain the common core files and normally these files are not changed. so I branch the common core repo, I add the features modules inside the folder and then I load all the modules (core and features) from the main.ts (it's a typescript web app). In public folder I have support files that should not change a lot. With this architecture, everything works fine, until I need to change a file in the public folder just for one application. If I change it, I wouldn't be able to merge the branch anymore and receive the updates from the common core files.

I tried before the approach with submodules, but I wasn't satisfied at all.

The goal is to be able to get continuous updates from the common core files, even though some of them are changed locally and should be "untracked" or something like that.

Do You have any idea on how to solve this problem or organize the code in a better way?

Thanks a lot


Solution

The last versions of git has sparse-checkout feature.

You can look here for more details.



Answered By - AlASAD WAIL
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing