Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(core): list which package.jsons are included #13203

Merged
merged 4 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion docs/shared/concepts/integrated-vs-package-based.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ There are two styles of monorepos that you can build with Nx: integrated repos a

A package-based repo is a collection of packages that depend on each other via `package.json` files and nested `node_modules`. With this set up, you typically have a different set of dependencies for each project. Build tools like Jest and Webpack work as usual, since everything is resolved as if each package was in a separate repo and all of its dependencies were published to npm. It's very easy to move an existing package into a package-based repo, since you generally leave that package's existing build tooling untouched. Creating a new package inside the repo is just as difficult as spinning up a new repo, since you have to create all the build tooling from scratch.

Lerna, Yarn, Lage and Nx (without plugins) support this style.
Lerna, Yarn, Lage, [Turborepo](/more-concepts/turbo-and-nx) and Nx (without plugins) support this style.

## Integrated Repos

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)
isaacplmann marked this conversation as resolved.
Show resolved Hide resolved

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"]
}
```
7 changes: 4 additions & 3 deletions docs/shared/reference/project-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +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 every project with a `package.json` file in it to its project graph. If you want to ignore a particular
project, 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.
isaacplmann marked this conversation as resolved.
Show resolved Hide resolved

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