Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making my own framework and using it as an upstream for projects

Tags:

I’m a freelancer making websites for clients. I have my own devstack based on React and Node. Currently, when I’m developing a new site, I just copy the last project that I’ve programmed and modify routes, pages and so on. When I add some new functionality (update webpack 1 to 2 and so on), I then have to do it manually at each project (or I don’t do it at all).

I’d like to have a more professional approach to this. Can you recommend me some materials or attitudes towards it?

My current goal is this: Have a repo (private github and after verification give it public) with my devstack (framework). Everytime I start a new project, I fork it (so that it stays as upstream origin) and start developing. Everytime I change some core functionality or add something that I want to have in other projects too, I want to push it somehow to the devstack repo. I could also copy this code to the devstack manually, but I don’t want to write it twice, so a better approach would help.

How can I do that, is my idea good? Basically, some recommendation if it makes sence at all and some link to an article would help me enough. Thank you.

like image 515
user3696212 Avatar asked Dec 29 '16 03:12

user3696212


People also ask

How do you fork a project?

You can fork any repo by clicking the fork button in the upper right hand corner of a repo page. Click on the Fork button to fork any repo on github.com. Source: GitHub Guides.

How do you make a fork?

Creating a fork on GitHub is as easy as clicking the “fork” button on the repository page. The fork will then appear in the list of your repositories on GitHub where you can clone it to your local machine and edit it. Once you are done editing, you push your commits back to the fork on GitHub.

What does fork mean in GitHub?

A fork is a copy of a repository that you manage. Forks let you make changes to a project without affecting the original repository. You can fetch updates from or submit changes to the original repository with pull requests.

What happens when you fork a repo?

A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

What is a framework and why build one?

Why build a framework? Frameworks generally answer the question of consistency, reusability and speed in future development. They are useful for companies / agencies that want to build something custom tailored to their needs.

What is the best way to adopt a project management framework?

An easy way to adopt a project management framework is to use a PM tool like Workamajig. Workamajig’s integrated approach to project management ensures that your entire organization is on the same page at all times. Test it out on your own – just hit the link below to get started!

How to build your own framework or component library?

If you want to build your very own framework or component library, I recommend taking it slowly. Plan out every single component you want even draw them if you need. Think of a name, do you want a documentation site?

Do we need to build our own CSS framework?

We have already used CSS frameworks such as Bootstrap and Material. They are great frameworks. However, in some situations, they are not enough for us. We need other small specific libraries and more. As a result, dependencies of our projects may be huge. In this case, we may need to build our own CSS framework.


1 Answers

"Everytime I change some core functionality or add something that I want to have in other projects too, I want to push it somehow to the devstack repo."

Pushing to a devstack repo (the original one you have forked for all your project) is a good first step, but it won't magically "propagate" that new feature to all your other repos.

However, you can take advantage of the triangular workflow:

https://i.stack.imgur.com/Lx7do.png

  • fork (see "Fork a Repo") the repo devstack (that is what you are doing already for your projects)
  • clone that fork locally for a given project,

    git clone /url/my/fork myfork
    
  • add as remote upstream the original repo

    cd myfork
    git remote add upstream /url/to/devstack
    

From there, with git 2.9 or more, configure:

git config --global pull.rebase true
git config --global rebase.autoStash true

Finally, each time you want to update one of your repo to benefit from a feature pushed to devstack:

cd /path/to/one/of/mine/projects
git checkout mybranch
git fetch upstream
git rebase upstream/master
like image 96
VonC Avatar answered Sep 23 '22 02:09

VonC