docs(core): remove workspaceLayout which is deprecated

This commit is contained in:
Juri 2025-03-18 14:00:29 +01:00 committed by Juri Strumpflohner
parent edf2c1ec0e
commit 59624c2add

View File

@ -33,32 +33,19 @@ For this recipe, we'll assume that the root-level app is named `my-app`. The hig
## Steps
1. Update the `workspaceLayout` property in `nx.json` to be:
```jsonc {% fileName="nx.json" %}
{
"workspaceLayout": {
"appsDir": "apps",
"libsDir": "libs"
}
}
```
This will make sure that new apps are created under `apps` and new libraries are created under `libs`.
2. If there is a `tsconfig.json` file in the root, rename it to `tsconfig.old.json`
1. If there is a `tsconfig.json` file in the root, rename it to `tsconfig.old.json`
This step is to make sure that a `tsconfig.base.json` file is generated by the app generator in the next step.
3. Create a new app using the appropriate plugin under `apps/temp`
2. Create a new app using the appropriate plugin under `apps/temp`
```shell
nx g app apps/temp
```
4. Move the `/src` (and `/public`, if present) folders to `apps/temp/`, overwriting the folders already there.
3. Move the `/src` (and `/public`, if present) folders to `apps/temp/`, overwriting the folders already there.
5. For each config file in `apps/temp`, copy over the corresponding file from the root of the repo.
4. For each config file in `apps/temp`, copy over the corresponding file from the root of the repo.
It can be difficult to know which files are root-level config files and which files are project-specific config files. Here is a non-exhaustive list of config files to help distinguish between the two.
@ -71,7 +58,7 @@ For this recipe, we'll assume that the root-level app is named `my-app`. The hig
`jest.config.app.ts` in the root should be renamed to `jest.config.ts` when moved to `apps/temp`. Also update the `jestConfig` option in `project.json` to point to `jest.config.ts` instead of `jest.config.app.ts`.
{% /callout %}
6. Update the paths of the project-specific config files that were copied into `apps/temp`.
5. Update the paths of the project-specific config files that were copied into `apps/temp`.
Here is a non-exhaustive list of properties that will need to be updated to have the correct path:
@ -83,7 +70,7 @@ For this recipe, we'll assume that the root-level app is named `my-app`. The hig
| `jest.config.ts` | `preset`, `coverageDirectory` |
| `vite.config.ts` | `cacheDir`, `root`, `dir` |
7. Doublecheck that all the tasks defined in the `apps/temp/project.json` file still work.
6. Doublecheck that all the tasks defined in the `apps/temp/project.json` file still work.
```shell
nx build temp
@ -91,23 +78,23 @@ For this recipe, we'll assume that the root-level app is named `my-app`. The hig
nx lint temp
```
8. Move the `/e2e/src` folder to `/apps/temp-e2e`, overwriting the folder already there
9. For each config file in `apps/temp-e2e`, copy over the corresponding file from the root of the repo. Update the paths for these files in the same way you did for the `my-app` config files.
10. Update the `/apps/temp-e2e/project.json` `implicitDependencies` to be `temp` instead of `my-app`
11. Doublecheck that all the tasks defined in the `apps/temp-e2e/project.json` file still work.
7. Move the `/e2e/src` folder to `/apps/temp-e2e`, overwriting the folder already there
8. For each config file in `apps/temp-e2e`, copy over the corresponding file from the root of the repo. Update the paths for these files in the same way you did for the `my-app` config files.
9. Update the `/apps/temp-e2e/project.json` `implicitDependencies` to be `temp` instead of `my-app`
10. Doublecheck that all the tasks defined in the `apps/temp-e2e/project.json` file still work.
```shell
nx lint temp-e2e
nx e2e temp-e2e
```
12. Delete all the project specific config files in the root and under `e2e`
13. Once the `project.json` file has been deleted in the root, rename `temp-e2e` to `my-app-e2e` and rename `temp` to `my-app`
11. Delete all the project specific config files in the root and under `e2e`
12. Once the `project.json` file has been deleted in the root, rename `temp-e2e` to `my-app-e2e` and rename `temp` to `my-app`
```shell
nx g move --projectName=temp-e2e --destination=my-app-e2e
nx g move --projectName=temp --destination=my-app
```
14. Update the `defaultProject` in `nx.json` if needed
15. Check again that all the tasks still work and that the `nx graph` displays what you expect.
13. Update the `defaultProject` in `nx.json` if needed
14. Check again that all the tasks still work and that the `nx graph` displays what you expect.