{"id":20549865,"url":"https://github.com/itsthatguy/group-dependencies","last_synced_at":"2025-07-14T10:42:08.549Z","repository":{"id":24608894,"uuid":"102039737","full_name":"itsthatguy/group-dependencies","owner":"itsthatguy","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-11T22:31:03.000Z","size":405,"stargazers_count":14,"open_issues_count":15,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T00:13:44.573Z","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":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itsthatguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-31T19:58:38.000Z","updated_at":"2024-10-10T08:04:37.000Z","dependencies_parsed_at":"2023-01-14T01:17:20.300Z","dependency_job_id":null,"html_url":"https://github.com/itsthatguy/group-dependencies","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsthatguy%2Fgroup-dependencies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsthatguy%2Fgroup-dependencies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsthatguy%2Fgroup-dependencies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsthatguy%2Fgroup-dependencies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsthatguy","download_url":"https://codeload.github.com/itsthatguy/group-dependencies/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487721,"owners_count":21112188,"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-16T02:21:37.297Z","updated_at":"2025-04-14T11:06:45.117Z","avatar_url":"https://github.com/itsthatguy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# group-dependencies\n![Node.js CI](https://github.com/itsthatguy/group-dependencies/workflows/Node.js%20CI/badge.svg) [![npm version](https://badge.fury.io/js/group-dependencies.svg)](https://badge.fury.io/js/group-dependencies)\n\n## What\n\n**npm** gives you two groups to specify dependencies (i.e. dev and prod).\nIn the real world, we have multiple dependency environments (e.g. test, build,\nproduction, development).\n\nLet’s say you run webpack on heroku to build your app. There are 2 options:\n1. Set `heroku config:set NPM_CONFIG_PRODUCTION=false` to install all dependencies (including testing dependencies)\n2. Put your build dependencies in `dependencies` (i.e. production environment)\n\nWith group-dependencies, you can declare your build dependencies in a separate\nproperty, `buildDependencies`, and install only those packages as needed, by\nadding to `\"scripts\": { \"heroku-postbuild\": deps install build\" }`\nto your `package.json`.\n\n## Installation\n\n```\nnpm install group-dependencies\n```\n\n## Usage\n\nFirst, add a new dependencies group to `package.json`:\n```js\n{\n  ...\n  \"devDependencies\": {\n    \"intercept-stdout\": \"^0.1.2\",\n    \"jest\": \"^20.0.4\",\n    \"strip-color\": \"^0.1.0\"\n  },\n  // our new group representing testing dependencies\n  \"testDependencies\": [\n    \"jest\"\n  ]\n  ...\n}\n```\n\nNow you can install _only_ the dependencies for this new group:\n\n```shell\n# This will install jest@^20.0.4:\ndeps install test\n```\n\n### Command\n```shell\n# Install dependencies in the named group\ndeps install [GROUP_NAME]\n```\n\n### How it works\n\nAny item added to the `[GROUP_NAME]Dependencies` property will be installed with\n`deps install [GROUP_NAME]`. If a matching package is found in `devDependencies`,\nthat version will be installed.\n\n```js\n// Here's the part that matters.\n\"buildDependencies\": [\n  \"webpack\",\n  \"@babel/preset-env\"\n]\n```\n\nThe decision to use this strategy, with an array, was made so that we can\nleverage a few things.\n1. In your development enviroment, let `npm` manage installing your dev dependencies.\n2. You only need to manage package versions in one location, reducing the overhead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsthatguy%2Fgroup-dependencies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsthatguy%2Fgroup-dependencies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsthatguy%2Fgroup-dependencies/lists"}