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

envdoctor

v0.0.3

Published

The framework for various tests / checks in the current environment

Downloads

3

Readme

envdoctor

⚠️ This is very early stage of the project. I've putted it together literally in few hours. Use on your own risk.

This is framework how to easily create set of test to ensure that environment is correctly setup.

It's kinda something like ESLint but to test your environment.

Install

yarn add envdoctor -D

How to use

First you have to create a configure file:

  • .doctorrc file in JSON or YAML format
  • .doctorrc.json file
  • .doctorrc.yaml, .doctorrc.yml, or .doctorrc.js file
  • doctor.config.js file exporting a JS object

Let's use .doctorrc.js as in example/ folder

module.exports = {
  extends: ["essentials"],
  rules: {
    "yarn-version": [2, "1.9.0"],
    "node-version": [2, "v8"]
  }
};

for essentials please install envdoctor-config-essentials package

Then we can add script into package.json

...
"scripts": {
  "doctor": "doctor"
},
...

Now you should be able to run

yarn run doctor

and you would get (if you pass the test :) )

✔ Check Node version
✔ Check Yarn version

Advanced configurations

extends

You can use either name (string) which should match installed package. We'll try to load envdoctor-config-<yourname> first, then it fallback to the full name.

You can also pass your own configuration as an object for example extends: ["essentials", require("./doctor")]. See /example implementation for more details.

rules

Every defined rule is automatically checked. You can change this with syntax

 "yarn-version": 0, // disable rule; [0], "off", "disable" acts the same

or you can change severity of the rule to "warn" by

 "yarn-version": [1, "1.9.0"], // you can also use "warn", ["warn] acts the same

Implementation of your own rule

This is actually really similar as example above

function ownRuleImplementation(arg) {
   return "Failed Hello " + arg;
}

ownRuleImplementation.description = "This is just example"

...

rules {
 "own-rule": [2, "World", ownRuleImplementation],
 ...
}

static description field could be also an function to get the same arguments as the check itself. Could be convenient for generic checks. (Check the testPort.js implementation in /example)

As you can see, if the function returns string, it means the check failed and the string is used as reason. To pass the check please return undefined, or boolean / true.

Implementation of your own configuration

Configuration is basically JSON object which defines the rules. Check the envdoctor-config-essentials implementation for example.