{"id":15716080,"url":"https://github.com/nossbigg/peerdeps-manager","last_synced_at":"2026-05-19T04:12:10.150Z","repository":{"id":57131950,"uuid":"405606569","full_name":"nossbigg/peerdeps-manager","owner":"nossbigg","description":"A simple CLI utility to install (and uninstall) your `node` peer dependencies to your dev dependencies.","archived":false,"fork":false,"pushed_at":"2022-03-18T12:18:20.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T16:46:06.222Z","etag":null,"topics":["devdependencies","nodejs","peerdependencies"],"latest_commit_sha":null,"homepage":"","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/nossbigg.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-09-12T10:04:56.000Z","updated_at":"2022-03-18T11:21:09.000Z","dependencies_parsed_at":"2022-08-31T20:00:41.236Z","dependency_job_id":null,"html_url":"https://github.com/nossbigg/peerdeps-manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nossbigg/peerdeps-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nossbigg%2Fpeerdeps-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nossbigg%2Fpeerdeps-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nossbigg%2Fpeerdeps-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nossbigg%2Fpeerdeps-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nossbigg","download_url":"https://codeload.github.com/nossbigg/peerdeps-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nossbigg%2Fpeerdeps-manager/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266689011,"owners_count":23969140,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["devdependencies","nodejs","peerdependencies"],"created_at":"2024-10-03T21:43:59.299Z","updated_at":"2026-05-19T04:12:05.125Z","avatar_url":"https://github.com/nossbigg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# peerdeps-manager\n\nA simple CLI utility to install (and uninstall) your `node` peer dependencies to your dev dependencies.\n\n## Why does this exist?\n\nBecause `npm` (`v4-6`) and `yarn` does not support installing peer depedencies (as of Sep 2021).\n\n- [Related npm issue](https://github.blog/2021-02-02-npm-7-is-now-generally-available/), [Related yarn issue](https://github.com/yarnpkg/yarn/issues/1503)\n\n_Note_: This tool is inspired by [`install-peerdeps`](https://github.com/nathanhleung/install-peerdeps) and does _roughly the same thing_, but with a declarative approach.\n\n## Usage\n\n- Install peerdeps-manager: `yarn add @nossbigg/peerdeps-manager -D` or `npm install @nossbigg/peerdeps-manager -D`\n- Add `.peerdeps-manager.config.js` to define tool config\n- Install dependencies defined in config: `peerdeps-manager set`\n- Uninstall dependencies defined in config: `peerdeps-manager unset`\n- Options to invoke `peerdeps-manager`:\n\n  - Invoke via sequential command:\n\n    ```bash\n    peerdeps-manager set \u0026\u0026 jest\n\n    // or\n\n    peerdeps-manager unset \u0026\u0026 create-react-app start\n    ```\n\n  - Invoke via [pre/post command hooks](https://docs.npmjs.com/cli/v7/using-npm/scripts#pre--post-scripts):\n\n    ```json\n    // package.json\n    {\n      \"scripts\": {\n        \"pretest\": \"peerdeps-manager set\",\n        \"test\": \"jest\"\n      }\n    }\n    ```\n\n### .peerdeps-manager.config.js config file\n\n`peerdeps-manager` requires a `.peerdeps-manager.config.js` config file from the root of the project for configuring the tool\n\nConfig file schema:\n\n```javascript\n// .peerdeps-manager.config.js\nconst config = {\n  // where you define your packages to install/uninstall during set/unset actions\n  // format: same as per provided to npm install/uninstall or yarn add/remove to maximize compatibility\n  set: { packages: [\"lodash.uniq\", \"lodash.template@4.0.6\"] },\n  unset: {\n    packages: [\"lodash.uniq\", \"lodash.template\"],\n    // automatically restores package.json to last git checked-in state, requires 'git' in CLI\n    // set to 'false' to disable this feature\n    doGitRestorePackageJson: true,\n  },\n};\n\nmodule.exports = config;\n```\n\n**Note on** `unset.doGitRestorePackageJson`:\n\n- [`npm uninstall`](https://docs.npmjs.com/cli/v7/commands/npm-uninstall)/[`yarn remove`](https://classic.yarnpkg.com/en/docs/cli/remove/) will remove a given package from all `dependencies` fields, including `peerDependencies`\n- However, after an `unset`, a library package author would like to preserve `peerDependencies`, in order to indicate what peer dependencies a given library must have in order to work correctly\n- Thus, for an ideal developer experience, during the `unset` step, `peerdeps-manager` will do a `git checkout package.json` **by default** in order to restore the `peerDependencies` that were lost due to uninstalling the temporary packages.\n- You can disable this feature by setting `doGitRestorePackageJson: false` (eg. if you are experimenting with your `package.json` and you do not want to lose your changes)\n\n_Related documentation:_\n\n- [`npm install`](https://docs.npmjs.com/cli/v6/commands/npm-install), [`npm uninstall`](https://docs.npmjs.com/cli/v6/commands/npm-uninstall)\n- [`yarn add`](https://yarnpkg.com/cli/add), [`yarn remove`](https://yarnpkg.com/cli/remove)\n\n_Supported package managers:_\n\n- `npm`\n- `yarn`\n\n## Use case\n\nAs a `react` component library maintainer, I would like to:\n\n1. Specify `react` and `react-dom` in my `peerDependencies`\n1. Uninstall `react` and `react-dom` in my `devDependencies` before running a webpack dev instance locally\n   - to ensure that my React component is working as expected.\n1. Install `react` and `react-dom` in my `devDependencies` before running my tests so that my test suite has the right dependencies to function and pass\n   - eg. `enzyme` and `react-testing-library` requires the aforementioned dependencies to work correctly\n1. Uninstall `react` and `react-dom` before publishing my package for it to work correctly\n\n## Developing\n\n1. Clone the repo\n1. Install its dependencies: `npm i` or `yarn`\n1. Make `peerdeps-manager` available to be locally symlinked:\n   - (in `./peerdeps-manager`) `npm link`\n1. Use `peerdeps-manager` in a project:\n   - (in other project directory) `npm install -D @nossbigg/peerdeps-manager`\n   - (in other project directory) `npm link @nossbigg/peerdeps-manager`\n1. Publish package: `npm publish --access public`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnossbigg%2Fpeerdeps-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnossbigg%2Fpeerdeps-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnossbigg%2Fpeerdeps-manager/lists"}