developing a monorepo without utilizing a package registry and installing through Bitbucket

My organization is working on creating a monorepo for react components to be used across multiple sites.

Currently, we have a repository called react-components on bitbucket and we are looking to convert it into a monorepo using lerna.js, with a structure like this:

packages
    package_1
         package.json
         dist
    package_2
         package.json
         dist

Instead of hosting our npm packages on a registry, we prefer using bitbucket and installing them from there.

Therefore, I would like to install each package into our websites via package.json in this format:

"@company_name/react_components": "git+ssh://[email protected]_name.com:7999/np/react-components.git#personal/jdaly/testBranch",

and import it like:

import package_1 from "@company_name/react_components"

Is it possible to set up a monorepo without using a package registry and simply import all the monorepo packages via a git link? I haven't found much information on this online.

I have followed this tutorial but it still involves importing modules/packages through a package registry rather than installing via a git link.

After building my packages, I push them to the repository and reference them in my website package.json like this:

"@company_name/react-components": "git+ssh://[email protected]_name.com:7999/np/react-components.git#personal/jdaly/firstCommit",

However, in the node_modules directory, the structure appears as:

node_modules
     @company_name
          react_components
               packages
                    package_1
                    package_2
                    package_3
               lerna.json
               package.json

When it should actually be:

node_modules
     @company_name
          react_components
                    package_1
                    package_2
                    package_3

Any assistance would be greatly appreciated.

Answer №1

If you come across this question by chance - here's the solution. To implement lerna and establish a monorepo setup, a package registry is essential. This could be NPM or a different tool such as which serves as a package registry that can be utilized locally.

Answer №2

Check out the steps below:

npm install git+ssh://<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="60070914200209140215030b05144e0f1207">[email protected]</a>/{user}/{repository}.git

References:

  • npm-install-modules-from-bitbucket-private-repositories
  • git-urls-as-dependencies
  • How-can-I-install-an-npm-package-from-my-bitbucket-repository

Answer №3

There is a solution that some may find suitable:

If you want to install packages from the same monorepo without using a registry, you can do so by referencing the folder within the same repository or a tarball created in a separate folder within the same repo.

Here are a couple of examples:

  • npm install ../package_1
  • npm install ../package_1.tgz

For more information, you can visit https://docs.npmjs.com/cli/install

Check out npm install <folder> and npm install <tarball file>

It's important to carefully consider before opting for this approach in production codebases that are meant to be long-lasting. While it's great for a quick fix without relying on a registry, consider...

  • How you will manage multiple versions as packages undergo major version changes that are not backward-compatible
  • How your packages will be incorporated into your build CI/CD pipeline

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Default close x button not functioning to close modal dialog

When I click the [X] button in my modal dialog box, it doesn't close. Here is an example of my code: $('#apply_Compensation_Leave').show(); This is the modal code: <div class="modal" id="apply_Compensation_Leave" tabindex="-1" role="di ...

Is react-particles-js still compatible for me to integrate?

I recently discovered that the package found here: https://www.npmjs.com/package/react-particles-js has been deprecated. Can I still utilize this package? The codes in question can be viewed at: https://codesandbox.io/s/particle-js-background-forked-woypk ...

The variable 'X' in Node.js is not been declared

I've been struggling with this problem, trying to fetch my most recent tweets as an array using the npm module https://github.com/noffle/latest-tweets. However, no matter how I approach it, I always encounter errors such as 'posts is not defined& ...

Guide to implementing client-side validation in MVC 4 without relying on the model

Currently, I am developing an ASP.NET MVC 4 project where I have decided not to utilize View Models. Instead, I am opting to work with the classes generated from the Entities for my Models. I am curious if there are alternative methods to achieve this. A ...

Easily generate a component directory complete with all essential files in just a few simple clicks

In my work with React and the typical app structure, I utilize a directory called src/components to store all of my React components. I am looking for a way to streamline the process of creating new components. I would like to be able to generate a compon ...

Submitting buttons by using a textbox array is a simple process

I need help figuring out why my buttons are not working on a page I'm creating with around 300 textboxes generated from a foreach loop. While I've successfully been able to write links into the textboxes, I am struggling to read the textboxes arr ...

Is there a way to bring together scrolling effects and mouse movement for a dynamic user

If you want to see a scrolling effect, check out this link here. For another animation on mouse move, click on this link(here). Combining both the scrolling effect and the image movement might seem challenging due to different styles used in each templat ...

Transform the structure of the JSON data object

When I use the fetch() request, a JSON file is displayed. Here's an example of what I receive from the database: [ { "id": 3086206, "title": "General specifications" }, { "id": 3086207, "title": "Features ...

Engage with Vue.js and traditional JavaScript (plain) in your projects

Exploring the integration of Vue with regular JavaScript has presented a challenge. While some solutions online propose moving all functions to a Vue component, this approach proves impractical for complex or large functions. The task now is finding a way ...

Combining two sorted arrays in javascript while eliminating duplicate elements

Hello everyone! I am new to this and would really appreciate some assistance. I am struggling with merging two arrays and removing duplicates. I know I might be over-complicating things, but I just can't figure it out. // Merging two sorted arrays // ...

Firefox and Internet Explorer do not support the functionality of HTML5 <audio> tags

My radio stream player code works perfectly on Chrome and iOS Safari, but I'm facing compatibility issues with Firefox and Internet Explorer 11. Here's a snippet from my index.php file: <script type="text/javascript" src="http://code.jquery. ...

Guide on adding the newest version of Jquery in asp.net 4.5 using <asp:scriptreference> tag

Looking to update the jQuery version in my web application. Currently, jQuery 1.7.1 is being loaded by default. I am aware that the following code is responsible for this. But how can I switch to loading jQuery 1.10 instead? <asp:ScriptManager runat ...

Adding the most recent NPM version to your Dockerfile installation

I am facing difficulty upgrading npm to the latest version in a Dockerfile, as I encounter an issue while trying to execute npm install -g npm@latest. Here is my Dockerfile configuration: FROM debian:bullseye ENV DEBIAN_FRONTEND noninteractive ENV CONDA_D ...

The Jquery .remove() function will only take effect after the second click

I am currently working on implementing a notifications feature using bootstrap popover. The issue I am facing is that after a user clicks on a notification, it should be removed. However, for some reason, it requires two clicks to actually remove the notif ...

Using Backbone: Leveraging a custom extended model when fetching a collection

Currently, I am working on developing a custom Wordpress theme using technologies like Javascript, Requirejs, and Backbonejs. As part of this process, in the index route, I have set up a new postsCollection app.postsCollection = new Posts.Collection(); to ...

Leveraging React to efficiently connect with friends on Firebase Realtime Database, enhancing the capability to include multiple connections

Currently, I am working on a project that involves React and Firebase's real-time database to create a friend network feature. The main challenge I'm facing is when a user enters an email into an input field. Upon submission, the system takes a s ...

Accessing an Accurate and Customized Menu Selection from an Old-School .ASP Loop Area

I am currently facing an issue with the note section in my form. Users with permissions can add information to a specific record, including deleting or editing their own notes. However, when I implemented a Jquery Modal Menu for confirming deletions, I enc ...

Looking to split the month and year input boxes when utilizing stripe version 7.2.0

Currently, I am utilizing ngx-stripe Version 7.2.0 to manage UI elements in Angular. I'm wondering if there is a method to split the Month and Year into separate text boxes within the UI of Angular 7 instead of having them combined into one field? ...

Tips for utilizing a printer to print HTML content in PHP

I've stored HTML content in a variable as shown below: $message ="<div> <table align='center'> <tr><td><h1>Tipo de Documentos Report</h1></td></tr> <tr><td>< ...

iOS 10.3.1 causing Ionic 2 (click) event to trigger twice

I am currently working on an Ionic 2 app and I am facing an issue with the click event. When I test the app on a device and click on a button, let's say to trigger an alert, the function executes once. However, if I click on the button again, the fun ...