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

nest-doctor

v0.0.3

Published

A companion to improve developer experience when using [NestJS](https://nestjs.com/). It aims to help maintain the modules/dependency management containers by reading the cryptic error messages that nest provides, matching it against your code, and provid

Downloads

5

Readme

Nest Doctor

A companion to improve developer experience when using NestJS. It aims to help maintain the modules/dependency management containers by reading the cryptic error messages that nest provides, matching it against your code, and providing a suggestion on how to fix it (or at least extra information to make it easier to debug).

Demo

nest-doctor

Instalation

npm install -D nest-doctor

Usage

It works as a wrapper around the nest CLI watcher that you would normally use for development. You can run it directly on your project's folder or replace the start:dev script on package.json, such as:

{
  //...
  "scripts": {
    //...
    "start:dev": "nest-doctor",
    //...
  },
  //...
}

You can also enable auto-applying the suggested fix with the --auto flag. So your nest-doctor usage would be:

nest-doctor --auto

The --auto flag will not break the boundaries between modules, meaning it will not export a provider from a module without checking with the developer first. To overwrite that behaviour, use the --reckless flag instead.

Cases

There are, currently, two cases the doctor takes care of. More will come in the future.

Missing a dependency in the same module

When you create a new provider but forget to add it to your module's provider array before requiring it somewhere else within the same module.

Missing a dependency from a different module

When you start depending on a provider that is in another module, but the module that provides it is not imported on your current module.

Caveats

The doctor is still in alpha stage and breaking changes are expected.

It works by doing static analysis of your code, so it is only aware of dependencies that can be solved by reading the code, not executing it. Dependencies that are dynamically added (ex.: conditionally added after reading a flag from a config file) are not able to be resolved and the doctor will simply suggest to add it statically.

The static analysis at this moment is still pretty basic, so it expects that your providers and imports are mapped with array literals. This means that you cannot declare the array in a variable and then use it on your module definition.

It also does not follow spread operators or other form of array merges, so it might just suggest you to add the dependency even if it already exists or just fail to parse your module definition.

Most of these limitations are expected to be handled as the project matures, but some of them are just limitations of static analysis and will probably remain.