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

commitlint-config-monorepo

v2.0.2

Published

Mixin commitlint config intended for monorepos

Downloads

7,838

Readme

commitlint-config-monorepo

A mixin commitlint config intended for monorepos. Makes (scope)s required and forces you to be explicit about which (scope) values are allowed. Intended to be used with another config as the base.

Differences from Conventional Commits

Invalid:

echo "fix: some message" # a (scope) is required

Valid:

echo "fix(docs): Sandbox re-renders as expected"

Getting started

note: see this gist for setting up commitlint and husky.

npm i -D commitlint-config-monorepo

In commitlint.config.js at the root of your repo:

module.exports = {
  extends: ["some-other-base-config", "monorepo"],
  rules: {
    // Override this rule to explicitly state your own (scope)s.
    "scope-enum": [
      2, // Throw error when (scope) is not one of these values.
      "always",
      [
        // This is the only default value baked into the config.
        "repo",
      ],
    ],
  },
};

Advanced Configuration

This configuration dynamically reads subdirectories of /packages and makes them valid (scope)s. Ex. if you have a subdirectory /packages/components/ this would make "components" a valid (scope).

const { readdirSync: readDirectory } = require("fs");
const DEFAULT_SCOPES = ["repo"];

const packageDirNames = readDirectory("./packages", { withFileTypes: true })
  .filter((entry) => entry.isDirectory())
  .map((dir) => dir.name);

const scopes = DEFAULT_SCOPES.concat(packageDirNames);

module.exports = {
  extends: ["monorepo"],
  rules: {
    "scope-enum": [2, "always", scopes],
  },
};

FAQ

Why not @commitlint/config-conventional?

  • This minimal ruleset is meant to be added to another config. Use it with @commitlint/config-conventional if you want!

  • Mandatory scope provides consistency and discourages haphazard commits that would apply to multiple scopes.

Why not use @commitlint/config-lerna-scopes or a similar pattern?

  • Being forced to be explicit about which scopes are allowed makes you more aware of them.

  • Desire to call out non-package scopes; ex. the config defaults to "repo" as a scope.

  • Lerna package names can sometimes be more verbose than is desirable in a commit message; '@my-org-name/projectname-packagename' is a common pattern, and @commitlint/config-lerna-scopes will only trim off '@my-org-name'