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

nx-etc

v2.0.1

Published

This repo will hold some utilities that can be used in addition to Nx.

Downloads

3

Readme

Nx-etc

This repo will hold some utilities that can be used in addition to Nx.

Partial checkouts

Problem description

When working with a monorepo style of development, all apps are in a single repository. In Nx land, there are two important building blocks, apps and libs. Apps are deployable artifacts that are build up out of a number of different libs. A lib can be a feature module, some reusable code, component library, ...

When developing with such a repo, it can get hard to get an overview over all these different files. Let's say that I'm working on app1, I don't want to open up all the other apps in the monorepo in my IDE. But, due to the flat structure of apps in a single directory, it is impossible to avoid this.

Reasons I want to avoid this is:

  • Performance. My IDE will eventually not be able to handle this anymore, if the monorepo grows too big.
  • File lookup. If I want to open a file, I might use the lookup system in IDE's to do so. When I look for 'app.component.ts' while working on 'app1', it would be cool to only have a single result instead of one for every app in the repo.
  • Clarity. It easily becomes hard to see what libs are used by an app.

Solution

Sparse checkouts

Git supports a feature called sparse checkouts. In this scenario, you can create a file called 'sparse-checkout' where, using some globs, you can instruct git which folders to checkout and which ones to 'hide'. This means the folders are not visible on the file system!

Dependency graph scripts from Nx

Nx exposes some script that can help us build, test, lint, ... only affected apps or generate a dependency graph of the entire monorepo. Using these scripts, you can find out all the dependencies of a certain app.

Combination of these features

Combining both features, the nx-etc 'checkout' functionality will checkout out only the files linked to a certain app.

How to use

Install nx-etc

yarn add --dev nx-etc

or

npm install --save-dev nx-etc

Note: We avoid having this installed globally, as we do with (almost) any package.

Enable sparse checkouts

First of all, you need to enable sparse checkouts. Do this using

git config core.sparseCheckout true

Using the lib

To checkout one project use:

npx nx-etc checkout ${appName}

Note: When checking out an app, with dependant libs, the other libs and apps will be hidden! See below to checkout everything again.

To checkout multiple projects use:

npx nx-etc checkout ${appName1} ${appName2}

To checkout everything use:

npx nx-etc checkout

Video tutorial

https://player.vimeo.com/video/295018577