在Shopify使用React Native包重用代码

At Shopify, we develop a bunch of different React Native mobile apps: Shop, Inbox, Point of Sale, Shopify Mobile, and Local Delivery. These apps represent different business domains, but they often have shared pieces of functionality like login or foundational blocks they build upon. Wouldn’t it be great to leverage development speed and focus on important product features by reusing code other teams have already written? Sure, but it might be a big and time consuming effort that discourages teams. Usually, contributing to a new repo is more tedious and error prone in comparison to contributing to an existing repository. The developer needs to create a new repository, set up continuous integration (CI) and distribution pipelines, and add configs for Jest, ESint, and Babel. It might be unclear where to start and what to do.

在Shopify,我们开发了一系列不同的React Native移动应用:ShopInboxPoint of SaleShopify MobileLocal Delivery。这些应用程序代表了不同的业务领域,但它们往往有共同的功能,如登录或基础模块。通过重复使用其他团队已经写好的代码,利用开发速度并专注于重要的产品功能,这不是很好吗?当然,但这可能是一个巨大的、耗费时间的努力,使团队感到沮丧。通常情况下,贡献一个新的版本库与贡献一个现有的版本库相比,更加繁琐和容易出错。开发者需要创建一个新的版本库,设置持续集成(CI)和分发管道,并为Jest、ESint和Babel添加配置。可能不清楚该从哪里开始,该做什么。

My team, React Native Foundations, decided to invest in simplifying the process for developers at Shopify. In this post, I'll walk you through the process of extracting those shared elements, the setup we adopted, the challenges we encountered, and future lines of improvement.

我的团队,React Native Foundations,决定投资简化Shopify的开发人员的流程。在这篇文章中,我将带领大家了解提取这些共享元素的过程,我们采用的设置,我们遇到的挑战,以及未来的改进路线。

Our Considerations: Monorepo vs Multi-Repo

我们的考虑。单一项目与多重项目

When we set out to extract elements from the product repositories, we explored two approaches: multi-repo and monorepo. For us, it was important that the solution had low maintenance costs, allowing us to be consistent without much effort. Of the two, monorepo was the one that helped us achieve that.

当我们着手从产品库中提取元素时,我们探索了两种方法:多库和单库。对我们来说,重要的是解决方案要有较低的维护成本,让我们不费吹灰之力就能保持一致。在这两种方法中,monorepo是帮助我们实现这一目标的方法。

Having one monorepo to support reduces maintenance ...

开通本站会员,查看完整译文。

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.154.0. UTC+08:00, 2026-02-23 23:33
浙ICP备14020137号-1 $访客地图$