Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Introduction of a utils module #1483

Open
hails opened this issue Jan 20, 2022 · 4 comments
Open

Introduction of a utils module #1483

hails opened this issue Jan 20, 2022 · 4 comments
Labels

Comments

@hails
Copy link
Contributor

hails commented Jan 20, 2022

As pointed out in #1481, we have multiple projects in the monorepo and we could leverage a utils module with reusable functions shared across the repo.
I personally don't have anything specific in mind but I thought it would be nice to get the conversation started.

@simoneb
Copy link
Member

simoneb commented Jan 20, 2022

I like the idea, which would allow us to show how to create a package which can be used by multiple other packages.

@mcollina
Copy link
Contributor

Let's build this as an independent piece as much as possible, we might consider extracting it and publishing on npm.

@simoneb
Copy link
Member

simoneb commented Jan 20, 2022

@mcollina I don't think this module would contain anything that's useful outside of this monorepo really, and the main benefit of having this inside the monorepo is to show how to have one package of the monorepo used across other packages, be them either FE or BE

@kurtmilam
Copy link
Member

kurtmilam commented Jan 20, 2022

We have a utils package in our titus-based solution that contains a number of different functions and constants that we reuse across different services. We've split our titus up in to a pkg-srv directory, holding the services that we deploy, and a pkg-lib directory that holds libraries we plan to publish to private npm (although we're vendoring the libraries in there for now).

Currently, we have a general-purpose utils library and a collection of reusable React Native components in our pkg-lib folder. This has been working pretty well for us, so far, and it's great for code reuse. We have plenty of individual functions in utils that are used in all three of our services (front end, back end and database manager).

We'll be adding new services soon, and will continue to reuse code from the shared libraries. I do agree that it would be nice to have a working example of creating a reusable module that will be published to a private registry and consumed by multiple services in the monorepo.

Here's a representation of our project structure directory, starting at the project root:

/
  ...(lots of stuff)
  pkg-lib/ (contains all reusable packages that we deploy to a private registry)
    utils/ (reusable utility module)
    ui/ (reusable react native components)
  pgk-srv/ (contains all services that we deploy)
    db-mgr/
    backend/
    frontend/
  pkg-experiments/
    ... just a place to drop poc libraries and services that we don't (yet) plan to deploy or publish to a registry)

Basically, we split the packages directory into 3 separate directories, which is also working well for us, although we're not doing much in experiments now that we've moved past the MVP phase.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants