M
M
markmariner2019-04-23 11:12:01
JavaScript
markmariner, 2019-04-23 11:12:01

How to organize work with several projects with a common code?

We develop 2 projects (and there will be more) on JS, Vue.js, use npm and store the code in git repositories.
It is necessary to move common components (templates of buttons, page parts and entire pages) to a separate repository in order to reuse them in all projects.
How to use these files in all projects? Create a subdirectory and link it to this shared repository? Create an npm package? How to do it?
Developers can make changes to common components, create new ones. To prevent changes from breaking other projects, it is necessary to organize a change check, perhaps pull requests and their check. How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Shitskov, 2019-04-23
@markmariner

It is necessary to move common components (button templates, page parts and entire pages) to a separate repository in order to reuse them in all projects.
How to use these files in all projects? Create a subdirectory and link it to this shared repository? Create an npm package? How to do it?

NPM packages. Store packages in your own repository, for example, Sonatype Nexus, version them.
Use, for example, Gitlab CE and MergeRequest. Disable pushing directly to master. Try to stick to some kind of branching model in your work, for example. Gitflow if mandatory review is required.
Similarly, using eg. GitlabCI can make your life easier by auto-building merged MRs for your components

A
aol-nnov, 2019-04-23
@aol-nnov

the choice is small: separate repositories, git submodules and monorepo
what to take is up to you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question