PHPackages                             moxio/captainhook-yarn-deduplicate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. moxio/captainhook-yarn-deduplicate

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

moxio/captainhook-yarn-deduplicate
==================================

Captain Hook Plugin to check for unnecessary duplication in yarn.lock using yarn-deduplicate

v1.0.0(5y ago)225.7k—3.8%MITPHPPHP ^7.2 || ^8.0

Since Dec 23Pushed 5y ago10 watchersCompare

[ Source](https://github.com/Moxio/captainhook-yarn-deduplicate)[ Packagist](https://packagist.org/packages/moxio/captainhook-yarn-deduplicate)[ RSS](/packages/moxio-captainhook-yarn-deduplicate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/f0e16c61af53504715d2c4b7ccfbaec8f2f6a447322e2eec7f7394d6268396fe/68747470733a2f2f706f7365722e707567782e6f72672f6d6f78696f2f6361707461696e686f6f6b2d7961726e2d64656475706c69636174652f762f737461626c65)](https://packagist.org/packages/moxio/captainhook-yarn-deduplicate)

moxio/captainhook-yarn-deduplicate
==================================

[](#moxiocaptainhook-yarn-deduplicate)

This project is a plugin for [CaptainHook](https://github.com/captainhookphp/captainhook) to check your `yarn.lock` file for duplicate packages using [yarn-deduplicate](https://github.com/atlassian/yarn-deduplicate). The commit is blocked when one or more duplicate packages are found. You can then fix these manually by running `yarn-deduplicate`.

Installation
------------

[](#installation)

Install as a development dependency using composer:

```
$ composer require --dev moxio/captainhook-yarn-deduplicate

```

Usage
-----

[](#usage)

Add yarn-deduplicate validation as a `pre-commit` to your `captainhook.json` configuration file:

```
{
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Moxio\\CaptainHook\\YarnDeduplicate\\YarnDuplicationCheckAction"
            }
        ]
    }
}
```

The check is only run when committing changes to `yarn.lock`. It will thus not detect pre-existing duplications as long as there are no changes to the Yarn lockfile.

The action expects [yarn-deduplicate](https://github.com/atlassian/yarn-deduplicate) to be installed as a local NPM package (i.e. available at `node_modules/.bin/yarn-deduplicate`).

### Conditional usage

[](#conditional-usage)

If you want to perform duplication checks only when yarn-deduplicate is installed (i.e. available at `node_modules/.bin/yarn-deduplicate`), you can add a corresponding condition to the action:

```
{
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Moxio\\CaptainHook\\YarnDeduplicate\\YarnDuplicationCheckAction",
                "conditions": [
                    {
                        "exec": "\\Moxio\\CaptainHook\\YarnDeduplicate\\Condition\\YarnDeduplicateInstalled"
                    }
                ]
            }
        ]
    }
}
```

This may be useful in scenarios where you have a shared CaptainHook configuration file that is [included](https://captainhookphp.github.io/captainhook/configure.html#includes) both in projects that use yarn-deduplicate and projects that don't. If yarn-deduplicate is installed, the action is run. In projects without yarn-deduplicate, the validation is skipped.

Versioning
----------

[](#versioning)

This project adheres to [Semantic Versioning](http://semver.org/).

Contributing
------------

[](#contributing)

Contributions to this project are welcome. Please make sure that your code follows the [PSR-12](https://www.php-fig.org/psr/psr-12/) extended coding style.

License
-------

[](#license)

This project is released under the MIT license.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~243 days

Total

3

Last Release

1852d ago

Major Versions

v0.2.0 → v1.0.02021-04-22

PHP version history (2 changes)v0.1.0PHP ^7.2

v1.0.0PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/815524?v=4)[Arnout Boks](/maintainers/aboks)[@aboks](https://github.com/aboks)

![](https://avatars.githubusercontent.com/u/4497863?v=4)[Moxio](/maintainers/moxio)[@Moxio](https://github.com/Moxio)

---

Top Contributors

[![aboks](https://avatars.githubusercontent.com/u/815524?v=4)](https://github.com/aboks "aboks (8 commits)")

---

Tags

captainhookgitgit-hooksyarnyarn-deduplicategitpre-commitcaptainhookyarnyarn-deduplicate

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/moxio-captainhook-yarn-deduplicate/health.svg)

```
[![Health](https://phpackages.com/badges/moxio-captainhook-yarn-deduplicate/health.svg)](https://phpackages.com/packages/moxio-captainhook-yarn-deduplicate)
```

###  Alternatives

[captainhook/captainhook

PHP git hook manager

1.1k6.8M370](/packages/captainhook-captainhook)[ramsey/conventional-commits

A PHP library for creating and validating commit messages according to the Conventional Commits specification. Includes a CaptainHook action!

1931.2M122](/packages/ramsey-conventional-commits)[czproject/git-php

Library for work with Git repository in PHP.

5544.9M81](/packages/czproject-git-php)[sebastianfeldmann/git

PHP git wrapper

466.9M18](/packages/sebastianfeldmann-git)[marcocesarato/php-conventional-changelog

Generate changelogs and release notes from a project's commit messages and metadata and automate versioning with semver.org and conventionalcommits.org

2511.3M109](/packages/marcocesarato-php-conventional-changelog)[moxio/captainhook-eslint

Captain Hook Plugin to validate files using ESLint

1147.9k](/packages/moxio-captainhook-eslint)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
