We have a companywide architecture approach. However, this approach ommits Front-end.
Some examples of reusable components within Elsevier
You might have to have access/permission to the repository of the components in order to install and use it.
Although the teams that built shared components has made a good effort for making discoverable, right now, finding those doesn't come with ease if you aren't connected to the original team.
Another consequence of the actual state of the shared components is that in order to contribute we have to follow the same steps as mentioned above.
Decoupling or creating custom components are almost a "no-deal" situation, sometimes forcing the creation of another component in the scoped codebase adding up to the "scattered" problem.
This is a cloud service with paid features which enables publishing components libraries as public or private collections to be easily reused across teams.
Package.json file after running "npm install @bit/thiagodallacqua.react_todo_ts.header"
Use exactly as a module
import React from 'react';
import Header,
{ TodoInterface } from '@bit/thiagodallacqua.react_todo_ts.header';
import './App.css';
const todoArray: TodoInterface[] = [{
foo: {
id: '1',
items: [1, 2, 3]
}
}]
function App() {
return (
<div className="App">
<Header
onClick={() => console.log('Hello world')}
todoArray={todoArray}
/>
</div>
);
}
export default App;
Your codebase and the collection's are completely isolated, which means that you can use different stacks and it won't affect the usability of the reusable components.
You might have written the collection in TypeScript and enabling a series of types to be integrated with your component and the actual use case is in JavaScript, which will not affect the usage of the collection at all, you'll just miss the TypeScript types.
Collection build with TypeScript used on a Typescript project
As the project is also in Typescript, the compiler will know about the types and will help pointing out errors.
Collection build with TypeScript used on a Javascript project
As the project is are written in Javascript, the it won't know about the types and interfaces and won't have problems while using the component.
No extra weight will be added for the application when using a reusable component, you will bring just what is needed
That's all the setup for creating and publishing a component/collection to bit.dev
In case that the developer needs to create a custom version of a given reusable component all he/she needs to do is to decouple from their original collection and create a custom and local version with "bit import".
After that he/she can choose to publish this new version or just keep it local.
One current struggle that we are facing is to dispose one series of components prototypes for validations with another team as part of a collaborative work towards a new product.
A series of needs like tooling, environment, deployment blocks the progress of the flow to validate it quickly and we end up with a longer timeline.
We can use Bit to export those components privately and quickly validate it with little effort and almost as the component are being developed, so "0 latency" for the validation and collaboration.
Bit.dev is an open-sourced project, that also has paid features, that helps developers to build reusable component libraries, layout systems and improve the discoverability of those components for other teams and makes the use of it easier.
Creating, maintaining, and contributing are as easy as it should be.
It has the option of having a full CI cycle for each component + an out-of-the-box sandbox on their cloud platform.
Example: https://bit.dev/joshk/tic-tac-toe-game/utils/winner-calc
The intention to use Bit is to improve our actual process of creating reusable components, it will go on top of our current codebase, whenever a team decides to adopt it, no additional tooling/infrastructure is required to integrate it other than "npm install -g bit-bin" on a developer laptop and creating a bit.dev account.
Furthermore, as bit just an addition to our current solutions, it is possible to integrate it also on our existing tooling (JFrog and artifactory) to enhance it on our benefit. (https://blog.bitsrc.io/speeding-development-with-artifacotry-and-bit-397e25517fa6)
It seems that the only alternative in the wild that can be somehow compared to Bit is Lerna. But it doesn't provide all the functionalities from Bit.
Using Lerna we would also have to add a layer of infrastructure to use is as intended, meaning that we would require a longer and more complicated timeline for the adoption.
In the web, many researches has being conducted to analyse the approaches for sharing components.
Despite all the effort, taken by different teams to have a friendly and good setup for sharing components across teams/projects, this goal is currently not achieved.
Bit can be a good option to improve the creation, discoverability, and collaboration on shared components.
By using the could solution we get even more advantages like out-of-the-box CI at component-basis, sandbox and easier discoverability with the cloud component hub.
Compared to other solutions, Bit is a more complete option for sharing components across teams.