{"id":23116105,"url":"https://github.com/moxio/captainhook-yarn-deduplicate","last_synced_at":"2025-06-17T11:09:28.753Z","repository":{"id":52643515,"uuid":"229721298","full_name":"Moxio/captainhook-yarn-deduplicate","owner":"Moxio","description":"Captain Hook Plugin to check for unnecessary duplication in yarn.lock using yarn-deduplicate","archived":false,"fork":false,"pushed_at":"2021-04-22T14:55:34.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-13T19:03:12.501Z","etag":null,"topics":["captainhook","git","git-hooks","yarn","yarn-deduplicate"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Moxio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-23T09:37:12.000Z","updated_at":"2021-04-22T14:53:10.000Z","dependencies_parsed_at":"2022-08-23T12:20:32.703Z","dependency_job_id":null,"html_url":"https://github.com/Moxio/captainhook-yarn-deduplicate","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Moxio/captainhook-yarn-deduplicate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcaptainhook-yarn-deduplicate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcaptainhook-yarn-deduplicate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcaptainhook-yarn-deduplicate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcaptainhook-yarn-deduplicate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Moxio","download_url":"https://codeload.github.com/Moxio/captainhook-yarn-deduplicate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcaptainhook-yarn-deduplicate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260346875,"owners_count":22995151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["captainhook","git","git-hooks","yarn","yarn-deduplicate"],"created_at":"2024-12-17T04:11:14.408Z","updated_at":"2025-06-17T11:09:23.740Z","avatar_url":"https://github.com/Moxio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/moxio/captainhook-yarn-deduplicate/v/stable)](https://packagist.org/packages/moxio/captainhook-yarn-deduplicate)\n\nmoxio/captainhook-yarn-deduplicate\n==================================\nThis project is a plugin for [CaptainHook](https://github.com/captainhookphp/captainhook) to check your `yarn.lock` file\nfor duplicate packages using [yarn-deduplicate](https://github.com/atlassian/yarn-deduplicate). The commit is blocked\nwhen one or more duplicate packages are found. You can then fix these manually by running `yarn-deduplicate`.\n\nInstallation\n------------\nInstall as a development dependency using composer:\n```\n$ composer require --dev moxio/captainhook-yarn-deduplicate\n```\n\nUsage\n-----\nAdd yarn-deduplicate validation as a `pre-commit` to your `captainhook.json` configuration file:\n```json\n{\n    \"pre-commit\": {\n        \"enabled\": true,\n        \"actions\": [\n            {\n                \"action\": \"\\\\Moxio\\\\CaptainHook\\\\YarnDeduplicate\\\\YarnDuplicationCheckAction\"\n            }\n        ]\n    }\n}\n```\n\nThe check is only run when committing changes to `yarn.lock`. It will thus not detect pre-existing duplications as\nlong as there are no changes to the Yarn lockfile.\n\nThe action expects [yarn-deduplicate](https://github.com/atlassian/yarn-deduplicate) to be installed as a local NPM\npackage (i.e. available at `node_modules/.bin/yarn-deduplicate`).\n\n### Conditional usage\nIf you want to perform duplication checks only when yarn-deduplicate is installed (i.e. available at\n`node_modules/.bin/yarn-deduplicate`), you can add a corresponding condition to the action:\n```json\n{\n    \"pre-commit\": {\n        \"enabled\": true,\n        \"actions\": [\n            {\n                \"action\": \"\\\\Moxio\\\\CaptainHook\\\\YarnDeduplicate\\\\YarnDuplicationCheckAction\",\n                \"conditions\": [\n                    {\n                        \"exec\": \"\\\\Moxio\\\\CaptainHook\\\\YarnDeduplicate\\\\Condition\\\\YarnDeduplicateInstalled\"\n                    }\n                ]\n            }\n        ]\n    }\n}\n```\nThis may be useful in scenarios where you have a shared CaptainHook configuration file that is\n[included](https://captainhookphp.github.io/captainhook/configure.html#includes) both in projects that use\nyarn-deduplicate and projects that don't. If yarn-deduplicate is installed, the action is run. In projects without\nyarn-deduplicate, the validation is skipped.\n\nVersioning\n----------\nThis project adheres to [Semantic Versioning](http://semver.org/).\n\nContributing\n------------\nContributions to this project are welcome. Please make sure that your code follows the\n[PSR-12](https://www.php-fig.org/psr/psr-12/) extended coding style.\n\nLicense\n-------\nThis project is released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxio%2Fcaptainhook-yarn-deduplicate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoxio%2Fcaptainhook-yarn-deduplicate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxio%2Fcaptainhook-yarn-deduplicate/lists"}