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

commonality-checks-recommended

v0.0.40

Published

Checks that encourage best practices for most multi-package monorepos.

Downloads

2,150

Readme

commonality-checks-recommended

These checks that benefit most multi-package projects. This package also provides some composable checks that can be used to enforce existing conventions within your project.

Installation

npm install commonality-checks-recommended

Usage

{
  "$schema": "https://commonality.co/config.json",
  "checks": {
    "*": [
      "recommended/has-codeowner",
      "recommended/has-readme",
      "recommended/sorted-dependencies"
    ]
  }
}

Static checks

These checks don't require any configuration and can be used directly within your project configuration (.commonality/config.json).

Learn more

recommended/has-codeowner

⚠️ Warning

Ensures that a package has at least one codeowner as determined by the CODEOWNERS file. It is important to have a codeowner for each package to ensure that there is a responsible person for the maintenance and updates of the package.

{
  "checks": [
    "*": [
      "recommended/has-codeowner"
    ]
  ]
}

recommended/has-readme

⚠️ Warning

Ensures that a package has a README.md file.

Auto-fix:

A README.md file will be created in the package directory with the title and description of the package as well as an installation script.

{
  "checks": [
    "*": [
      "recommended/has-readme"
    ]
  ]
}

recommended/valid-package-name

Error

Ensures that the package name in a package's package.json file is valid. This will prevent unforeseen issues when publishing packages.

{
  "checks": [
    "*": [
      "recommended/valid-package-name"
    ]
  ]
}

recommended/sorted-dependencies

⚠️ Warning

Ensures that the dependencies in a package's package.json file are sorted alphabetically. Some package managers will sort dependencies automatically on dependency installation, sorting ahead of time will decrease the size of diffs.

Auto-fix:

dependencies, devDependencies, and peerDependencies will be sorted in alphabetical order.

{
  "checks": [
    "*": [
      "recommended/sorted-dependencies"
    ]
  ]
}

recommended/extends-repository-field

Error

Ensures that the repository field in the package.json of a package extends the repository field at the root of your project. If there is no repository field in your project's root package.json then this check will always pass.

Auto-fix:

A repository field will be added to the package's package.json with the correct path to the package.

{
  "checks": [
    "*": [
      "recommended/extends-repository-field"
    ]
  ]
}

recommended/consistent-external-version

Error

Ensures that the external dependencies of a package match the most common or highest version across all packages.

Auto-fix:

Dependency versions will be updated to match the most common or highest version of a dependency across all packages in the workspace.

{
  "checks": [
    "*": [
      "recommended/consistent-external-version"
    ]
  ]
}

recommended/unique-dependency-types

⚠️ Warning

Ensures that a dependency should only be in one of dependencies, devDependencies, or optionalDependencies in the package.json of a package.

Auto-fix:

If a dependency is a dependency it will be removed from devDependencies and optionalDependencies. If a depdnency is a devDependency and an optionalDependency it will be removed from dependencies.

{
  "checks": [
    "*": [
      "recommended/unique-dependency-types"
    ]
  ]
}

recommended/matching-dev-peer-versions

⚠️ Warning

Ensures that every peerDependency is also listed as `devDependency`` with a version range that is a subset of the peerDependency. This will align local development to the experience external consumers will have when installing the package.

Auto-fix:

The version range for a devDependency will be updated to match it's matching peerDependency.

{
  "checks": [
    "*": [
      "recommended/matching-dev-peer-versions"
    ]
  ]
}

Composable checks

Use these checks to create new checks customized to your current conventions and workflows.

Learn more

has-json-file

Error

Ensures that a JSON file exists with the specified content.

Auto-fix:

If the JSON file does not exist or does not contain the expected content, it will be created or merged with the specified content.

import { hasJson } from 'commonality-checks-recommended';

export default hasJson('package.json', {
  scripts: {
    build: 'tsc --build',
    dev: 'tsc --watch'
  }
})
{
  "checks": [
    "buildable": [
      "has-build-scripts"
    ]
  ]
}

has-text-file

Error

Ensures that a text file exists with the specified content.

Auto-fix:

If the text file does not exist or does not contain the expected content, it will be created or appended to with the specified content.

import { hasText } from 'commonality-checks-recommended';

export default hasText('.npmignore', ["dist"])
{
  "checks": [
    "publishable": [
      "has-npm-ignore"
    ]
  ]
}