Skip to content

Commit

Permalink
docs(core): list which package.jsons are included (#13203)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
  • Loading branch information
isaacplmann and FrozenPandaz authored Nov 17, 2022
1 parent 334f597 commit 204e64a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,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 only include any `package.json` file that is referenced in the `workspaces` property of the root `package.json` file in the graph. (`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"]
}
```
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 referenced 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

1 comment on commit 204e64a

@vercel
Copy link

@vercel vercel bot commented on 204e64a Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.