{"id":18773122,"url":"https://github.com/webfactory/yarn-unlock-indirect-dependencies","last_synced_at":"2025-04-13T09:07:43.940Z","repository":{"id":52250614,"uuid":"340302136","full_name":"webfactory/yarn-unlock-indirect-dependencies","owner":"webfactory","description":"Simplistic JavaScript to unlock indirect (transitive) Yarn dependencies","archived":false,"fork":false,"pushed_at":"2021-05-03T14:03:54.000Z","size":47,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T09:07:35.092Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webfactory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-19T08:17:53.000Z","updated_at":"2022-06-03T13:56:06.000Z","dependencies_parsed_at":"2022-08-30T19:50:49.986Z","dependency_job_id":null,"html_url":"https://github.com/webfactory/yarn-unlock-indirect-dependencies","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2Fyarn-unlock-indirect-dependencies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2Fyarn-unlock-indirect-dependencies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2Fyarn-unlock-indirect-dependencies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webfactory%2Fyarn-unlock-indirect-dependencies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webfactory","download_url":"https://codeload.github.com/webfactory/yarn-unlock-indirect-dependencies/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248688567,"owners_count":21145766,"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":[],"created_at":"2024-11-07T19:32:54.412Z","updated_at":"2025-04-13T09:07:43.914Z","avatar_url":"https://github.com/webfactory.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unlock 🔓 indirect `yarn` dependencies 🧶\n\n### Motivation\n\n`yarn` (of course) installs \"indirect\" or \"transitive\" dependencies for packages it installs, and it also writes these dependencies to the `yarn.lock` file.\n\nHowever, a later `yarn upgrade` will only check _direct_ dependencies. Only when a _direct_ dependency is upgraded to another version, its transitive dependencies are evaluated and upgraded as well.\n\nThis means, for example, that\n* when you install a package A that has a dependency on some other package B,\n* and B fixes a security issue and creates a new version for the fix,\n* `yarn upgrade` is _not_ going to update B for you\n* _until_ A releases a newer version and you upgrade to it.\n\nAs of writing, there is no direct way to make `yarn` upgrade indirect dependencies as well. This is discussed as a feature request in [yarnpkg/yarn#4986](https://github.com/yarnpkg/yarn#4986) (opened 11/2017).\n\nThe script in this repository tries to provide an easy-to-use workaround.\n\n### The Workaround\n\nThe script in this repository it will **remove all packages from the `yarn.lock` file** that are **not specified as direct dependencies**, i. e. in `dependencies`, `devDependencies`, `peerDependencies` or `optionalDependencies` of your `package.json` file.\n\nThe idea is that for packages that you don't specify as your own (direct) dependencies, you generally don't care what version gets installed. So, it should not make a difference for your own code to upgrade those dependencies in the background. Of course, there is a risk things breaking inside your dependencies. In a perfect world, where everyone specified and tagged their versions correctly, however, this should rarely happen.\n\n### Usage\n\nIn the directory containing your `yarn.lock` file, run via `npx`\n\n```bash\nnpx yarn-unlock-indirect-dependencies\n(... prints unlocked packages ...)\n```\n\nor globally install and run\n\n```bash\nnpm install -g yarn-unlock-indirect-dependencies\n# or\nyarn global add yarn-unlock-indirect-dependencies\n\nyarn-unlock-indirect-dependencies\n(... prints unlocked packages ...)\n```\n\nthen run install to finish the process\n\n```bash\nyarn install\n```\n\nThe first step will remove indirect dependencies from the `yarn.lock` file, and the subsequent `yarn install` will take care of resolving and updating the indirect dependencies again.\n\nYou can optionally provide a path to your project's directory if the command is run outside of the the project.\n\n```bash\nyarn-unlock-indirect-dependencies path/to/your/project\n```\n\nDon't forget to commit the updated `yarn.lock` file to version control.\n\n### Credits, Copyright and License\n\nThis script was initially suggested by @dacioromero in [this comment](https://github.com/yarnpkg/yarn/issues/4986#issuecomment-598746788).\n\nThis repository is provided by webfactory GmbH, Bonn, Germany. We're a software development agency with a focus on PHP (mostly [Symfony](http://github.com/symfony/symfony)). If you're a developer looking for new challenges, we'd like to hear from you!\n\n- \u003chttps://www.webfactory.de\u003e\n- \u003chttps://twitter.com/webfactory\u003e\n\nCopyright 2021 webfactory GmbH, Bonn. Code released under [the MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfactory%2Fyarn-unlock-indirect-dependencies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebfactory%2Fyarn-unlock-indirect-dependencies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfactory%2Fyarn-unlock-indirect-dependencies/lists"}