npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mono-to-multirepo

v0.0.2

Published

experimental - do not use

Downloads

5

Readme

experimental - do not use

In the course of developing an application, you author a number of modules that each encapsulate some functionality that could be useful in other contexts. You want to publish these modules as independent packages on NPM.

To publish such a a module to NPM, you could add an appropriate package.json file to the module's sub directory within your applition's source, and npm publish from there. If you had multiple modules that published to NPM like this, they might use one another as dependencies, and keeping package version information up to date amongst the packages would be tedious. You update package-A to version 2, package-B depends on package-A so you need to bump package-A dependecy version in package-B. And package-C might depend on package-B and so on.

Lerna is software that solves this versioning complexity.

With a Lerna setup, we can be productive deveolping our application and publishing application modules as packages as a side effect. But we are missing something. How do we get feedback on our NPM packages?

Typically, an NPM package has Github repositiory associated dedicated to it. Some popular projects, such as Babel, use Lerna successfully. The Babel Github project stores the source for various individually installable NPM packages. If you find a bug, you can report it to the Babel monorepo Github project. It's a Babel-focused mono-repo.

Contrast the Babel use case with our application use case. Our application is not a library like Babel. The packages we publish are a side-effect of our application development. Many packages might not have anything to do with eachother other than happening to be used in the same application. The application's issue reports should be focused on business logic and UI bugs, not some minutia about NPM package APIs. It's likely that our application's Github repository isn't even public. Then there would be no way for the broader developer community to report bugs on our NPM packages or submit pull requests.

So let's consider another way to publish NPM packages while developing an application that affords us individual repositories for each NPM pacakge.

For the module you wanted to publish to NPM, you would move its code out of the application's source, and into a new Github repository. From there, you would configure it for publishing to NPM and run npm publish. Then from the application, I would re-integrate my module via npm install mymodule.

Now developers can integrate my module into their projects via npm install also. And the module has its own Github repo project developers for submit pull requests and issue reports. Great!

But there is a substantial drawback. If I modify my module, in order for that change to affect my application, I need to npm publish from the module directory, and then I need to npm update from my application repo. If I need to change branches or rollback in my application repo, I would need to npm install to be sure my published module is on the correct version for that commit. When I have multiple packages that use eachother as dependencies, versioning would be nightmare.

This workflow is substantially worse than the Lerna workflow, but at least we have individual public Github projects for each package, so the community can submit issues and pull requests.

How do we get the best of both worlds? We want the turn-key multi-package versioning of Lerna, but want each package to have its own repository.

Enter mono-to-multirepo.

With mono-to-multirepo, you write your application as you would with Lerna. Publish to NPM with Lerna. Commit your source as a monorepo. Then you publish your various packages from within your monorepo to individual Github repos. Essential, for each package's folder, mono-to-multirepo clones a an associated Github repo, deletes the repos contents at its head, copies over the contents of the package's folder, git commits and pushes.