Skip to content

Commit

Permalink
docs(core): recipe to include all package.json files
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacplmann committed Nov 17, 2022
1 parent 99833a3 commit 44503c2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,12 @@
"id": "resolve-circular-dependencies",
"tags": ["explore-graph"],
"file": "shared/recipes/resolve-circular-dependencies"
},
{
"name": "Include All package.json Files as Projects",
"id": "include-all-packagejson",
"tags": [],
"file": "shared/recipes/include-all-packagejson"
}
]
}
Expand Down
11 changes: 11 additions & 0 deletions docs/shared/recipes/include-all-packagejson.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Include All package.json Files as Projects

As of Nx 15.0.11, we include in the graph any `package.json` file that is referenced in the `workspaces` property of the root `package.json` file. (`lerna.json` for Lerna repos or `pnpm-workspaces.yml` for pnpm repos)

If you would prefer to add all `package.json` files as projects, add the following configuration to the `nx.json` file:

```json {% filename="nx.json" %}
{
"plugins": ["nx/plugins/package-json"]
}
```
6 changes: 4 additions & 2 deletions docs/shared/reference/project-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,11 @@ You can also remove a dependency as follows:
{% /tab %}
{% /tabs %}
### Ignoring a project
### Including package.json files as projects in the graph
Nx will add projects with a `package.json` file that are referenced (1) in the `workspaces` property of the root `package.json`, (2) in `pnpm-workspace.yml` or (3) in `lerna.json`. If you want to ignore a particular project that those tools reference, add the directory to your `.nxignore` file.
Any `package.json` file that is references by the `workspaces` property in the root `package.json` file will be included as a project in the graph. If you are using Lerna, projects defined in `lerna.json` will be included. If you are using pnpm, projects defined in `pnpm-workspace.yml` will be included.
If you want to ignore a particular `package.json` file, exclude it from those tools. For example, you can add `!packages/myproject` to the `workspaces` property.
### Ignoring package.json scripts
Expand Down

0 comments on commit 44503c2

Please sign in to comment.