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

@wayofdev/commitlint-config

v4.0.0

Published

A shareable commitlint configuration for projects.

Downloads

254

Readme

Shareable Commitlint Config

📄 About

A shareable commitlint configuration for enforcing consistent commit messages in your projects.

→ Purpose

  • Provides a set of rules to ensure that all commits in your project follow a consistent structure.
  • Consistent commit messages are important for project collaboration, maintainability, and project history.
  • The commitlint configuration helps ensure that all commits in your project follow a consistent structure, making it easier for your team to understand what changes were made and why.

💿 Installation

This package should be added to the root of your monorepo, where you have a file commitlint.config.js and a package.json file. Within your monorepo, you should have a structure with directories for your apps and packages, such as:

.
├── commitlint.config.js (root)
├── package.json (root)
├── apps
│   └── my-first-app
│       ├── package.json
│       └── ... (other app files)
└── packages
    └── my-first-package
        ├── package.json
        └── ... (other package files)
  1. To use this configuration, you'll need to install this package as a devDependency in your monorepository's root:

    pnpm add -wD @commitlint/cli @wayofdev/commitlint-config
  2. To configure the commitlint.config.js file, include the following line:

    module.exports = {
      extends: ["@wayofdev/commitlint-config"],
    }

    This extends the @wayofdev/commitlint-config and uses its pre-defined configuration.

    Alternatively the configuration can be defined in a commitlint.config.js, .commitlintrc.js, .commitlintrc, .commitlintrc.json, .commitlintrc.yml file

  3. Install Husky in your monorepository as devDependency. Husky is a handy git hook helper available on npm.

    # Install as dev-dependency into root of monorepo
    $ pnpm add -wD husky is-ci
       
    # Activate hooks
    $ pnpm husky install
  4. Add commit-msg hook:

    npx husky add .husky/commit-msg 'pnpm commitlint --edit "${1}"'
  5. Add scripts to package.json

    pnpm pkg set scripts.lint:commits="pnpm commitlint --from HEAD~1 --to HEAD --verbose"
       
    pnpm pkg set scripts.prepare="is-ci || husky install"

💻 Usage

→ Test simple usage

For a first simple usage test of commitlint you can do the following:

# using pnpm
$ pnpm commitlint --from HEAD~1 --to HEAD --verbose

# or, using npx
$ npx commitlint --from HEAD~1 --to HEAD --verbose

# or, if script was added
$ pnpm lint:commits

This will check your last commit and return an error if invalid or a positive output if valid.

→ Test the hook

You can test the hook by simply committing. If the commit message is valid, the commit will go through, otherwise you will see an error message.

Here's an example of what the error message would look like if your commit message doesn't meet the required format:

$ git commit -m "foo: this will fail"
husky > commit-msg (node v10.1.0)
No staged files match any of provided globs.
⧗   input: foo: this will fail
✖   type must be one of [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test] [type-enum]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

husky > commit-msg hook failed (add --no-verify to bypass)

If your commit message meets the required format, you should see a message like this:

$ git commit -m "feat: add new feature"
husky > commit-msg (node v10.1.0)
[master 9d41607] feat: add new feature
 1 file changed, 1 insertion(+)

🧩 Extending

This shows, how config can be extended with your custom rules.

commitlint.config.js

module.exports = {
  extends: ["@wayofdev/commitlint-config"],
  rules: {
    "body-leading-blank": [2, "always"],
  },
}

🤝 License

Licence

🧱 Credits and Useful Resources

Based on:

Related projects:

Guides:

🙆🏼‍♂️ Author Information

This repository was created in 2023 by lotyp / wayofdev.

🙌 Want to Contribute?

Thank you for considering contributing to the wayofdev community! We are open to all kinds of contributions. If you want to:

  • 🤔 Suggest a feature
  • 🐛 Report an issue
  • 📖 Improve documentation
  • 👨‍💻 Contribute to the code

You are more than welcome. Before contributing, kindly check our guidelines.