A
A
Andrei Smirnov2017-08-15 14:24:23
git
Andrei Smirnov, 2017-08-15 14:24:23

How to separate UI component library from applications?

There are two react-applications, then there will be two more and they all use the same set of self-written UI-controls on react.
To avoid code duplication, the task is to isolate all controls into a separate library, and in applications, accordingly, add references.
I would like the code of this library to live its own cycle, i.e. this would be a separate git submodule or repo. So that it has its own bundler, with tests and other things. But I don't want to post it as an npm package to the public (the customer will not approve).
I heard / read that Facebook refers to its react not as an npm package, but using relative paths to a separate repository (maybe I'm wrong).
The question is how to organize it correctly? Are there any articles with step by step instructions?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2017-08-15
@pinebit

npm can connect a private repository. ( rtfm )

{
  "dependencies": {
    "acme-ui-kit": "git+ssh://[email protected]/acme/ui-kit.git#v1.2.7",
  }
}

// EDIT: added explanations
Create a project, transfer all this UI module there.
Build it correctly, make it look like an npm package. Just don't publish it, but create a private git repository (on some bitbucket/gitlab/etc).
And then, in the necessary projects, connect this module in the way that I indicated above.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question