docs(core): recipe standalone to integrated
This commit is contained in:
parent
74338d1178
commit
ce42f04ae6
@ -3087,14 +3087,14 @@
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Other",
|
||||
"path": "/recipes/other",
|
||||
"id": "other",
|
||||
"name": "Managing Your Nx Repository",
|
||||
"path": "/recipes/managing-repository",
|
||||
"id": "managing-repository",
|
||||
"isExternal": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "Run Root-Level NPM Scripts with Nx",
|
||||
"path": "/recipes/other/root-level-scripts",
|
||||
"path": "/recipes/managing-repository/root-level-scripts",
|
||||
"id": "root-level-scripts",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
@ -3102,7 +3102,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Disable Graph Links Created from Analyzing Source Files",
|
||||
"path": "/recipes/other/analyze-source-files",
|
||||
"path": "/recipes/managing-repository/analyze-source-files",
|
||||
"id": "analyze-source-files",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
@ -3110,7 +3110,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Workspace Watching",
|
||||
"path": "/recipes/other/workspace-watching",
|
||||
"path": "/recipes/managing-repository/workspace-watching",
|
||||
"id": "workspace-watching",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
@ -3118,20 +3118,85 @@
|
||||
},
|
||||
{
|
||||
"name": "Advanced Update Process",
|
||||
"path": "/recipes/other/advanced-update",
|
||||
"path": "/recipes/managing-repository/advanced-update",
|
||||
"id": "advanced-update",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "JavaScript and TypeScript",
|
||||
"path": "/recipes/other/js-and-ts",
|
||||
"id": "js-and-ts",
|
||||
"name": "Convert from a Standalone Repository to an Integrated Repository",
|
||||
"path": "/recipes/managing-repository/standalone-to-integrated",
|
||||
"id": "standalone-to-integrated",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "JavaScript and TypeScript",
|
||||
"path": "/recipes/managing-repository/js-and-ts",
|
||||
"id": "js-and-ts",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
}
|
||||
],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Run Root-Level NPM Scripts with Nx",
|
||||
"path": "/recipes/managing-repository/root-level-scripts",
|
||||
"id": "root-level-scripts",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Disable Graph Links Created from Analyzing Source Files",
|
||||
"path": "/recipes/managing-repository/analyze-source-files",
|
||||
"id": "analyze-source-files",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Workspace Watching",
|
||||
"path": "/recipes/managing-repository/workspace-watching",
|
||||
"id": "workspace-watching",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Advanced Update Process",
|
||||
"path": "/recipes/managing-repository/advanced-update",
|
||||
"id": "advanced-update",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Convert from a Standalone Repository to an Integrated Repository",
|
||||
"path": "/recipes/managing-repository/standalone-to-integrated",
|
||||
"id": "standalone-to-integrated",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "JavaScript and TypeScript",
|
||||
"path": "/recipes/managing-repository/js-and-ts",
|
||||
"id": "js-and-ts",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Other",
|
||||
"path": "/recipes/other",
|
||||
"id": "other",
|
||||
"isExternal": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "React Native with Nx",
|
||||
"path": "/recipes/other/react-native",
|
||||
@ -3303,46 +3368,6 @@
|
||||
],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Run Root-Level NPM Scripts with Nx",
|
||||
"path": "/recipes/other/root-level-scripts",
|
||||
"id": "root-level-scripts",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Disable Graph Links Created from Analyzing Source Files",
|
||||
"path": "/recipes/other/analyze-source-files",
|
||||
"id": "analyze-source-files",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Workspace Watching",
|
||||
"path": "/recipes/other/workspace-watching",
|
||||
"id": "workspace-watching",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "Advanced Update Process",
|
||||
"path": "/recipes/other/advanced-update",
|
||||
"id": "advanced-update",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "JavaScript and TypeScript",
|
||||
"path": "/recipes/other/js-and-ts",
|
||||
"id": "js-and-ts",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"name": "React Native with Nx",
|
||||
"path": "/recipes/other/react-native",
|
||||
|
||||
@ -1184,7 +1184,7 @@
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/concepts/integrated-vs-package-based",
|
||||
"tags": ["intro"]
|
||||
"tags": ["intro", "repository-types"]
|
||||
},
|
||||
{
|
||||
"id": "mental-model",
|
||||
@ -1259,7 +1259,7 @@
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/concepts/integrated-vs-package-based",
|
||||
"tags": ["intro"]
|
||||
"tags": ["intro", "repository-types"]
|
||||
},
|
||||
"/concepts/mental-model": {
|
||||
"id": "mental-model",
|
||||
|
||||
@ -1342,10 +1342,10 @@
|
||||
"path": "/recipes/example-repos/dte",
|
||||
"tags": []
|
||||
},
|
||||
"/recipes/other": {
|
||||
"id": "other",
|
||||
"name": "Other",
|
||||
"description": "Other recipes you will find useful.",
|
||||
"/recipes/managing-repository": {
|
||||
"id": "managing-repository",
|
||||
"name": "Managing Your Nx Repository",
|
||||
"description": "Configuring the Repository Itself",
|
||||
"file": "",
|
||||
"itemList": [
|
||||
{
|
||||
@ -1355,7 +1355,7 @@
|
||||
"file": "shared/recipes/root-level-scripts",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/other/root-level-scripts",
|
||||
"path": "/recipes/managing-repository/root-level-scripts",
|
||||
"tags": ["run-tasks"]
|
||||
},
|
||||
{
|
||||
@ -1365,7 +1365,7 @@
|
||||
"file": "shared/recipes/analyze-source-files",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/other/analyze-source-files",
|
||||
"path": "/recipes/managing-repository/analyze-source-files",
|
||||
"tags": ["explore-graph"]
|
||||
},
|
||||
{
|
||||
@ -1375,7 +1375,7 @@
|
||||
"file": "shared/recipes/workspace-watching",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/other/workspace-watching",
|
||||
"path": "/recipes/managing-repository/workspace-watching",
|
||||
"tags": ["workspace-watching"]
|
||||
},
|
||||
{
|
||||
@ -1385,9 +1385,19 @@
|
||||
"file": "shared/recipes/advanced-update",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/other/advanced-update",
|
||||
"path": "/recipes/managing-repository/advanced-update",
|
||||
"tags": ["automate-updating-dependencies"]
|
||||
},
|
||||
{
|
||||
"id": "standalone-to-integrated",
|
||||
"name": "Convert from a Standalone Repository to an Integrated Repository",
|
||||
"description": "",
|
||||
"file": "shared/recipes/repo-types/standalone-to-integrated",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/managing-repository/standalone-to-integrated",
|
||||
"tags": ["repository-types"]
|
||||
},
|
||||
{
|
||||
"id": "js-and-ts",
|
||||
"name": "JavaScript and TypeScript",
|
||||
@ -1395,9 +1405,80 @@
|
||||
"file": "shared/guides/js-and-ts",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/other/js-and-ts",
|
||||
"path": "/recipes/managing-repository/js-and-ts",
|
||||
"tags": []
|
||||
},
|
||||
}
|
||||
],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/managing-repository",
|
||||
"tags": []
|
||||
},
|
||||
"/recipes/managing-repository/root-level-scripts": {
|
||||
"id": "root-level-scripts",
|
||||
"name": "Run Root-Level NPM Scripts with Nx",
|
||||
"description": "",
|
||||
"file": "shared/recipes/root-level-scripts",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/managing-repository/root-level-scripts",
|
||||
"tags": ["run-tasks"]
|
||||
},
|
||||
"/recipes/managing-repository/analyze-source-files": {
|
||||
"id": "analyze-source-files",
|
||||
"name": "Disable Graph Links Created from Analyzing Source Files",
|
||||
"description": "",
|
||||
"file": "shared/recipes/analyze-source-files",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/managing-repository/analyze-source-files",
|
||||
"tags": ["explore-graph"]
|
||||
},
|
||||
"/recipes/managing-repository/workspace-watching": {
|
||||
"id": "workspace-watching",
|
||||
"name": "Workspace Watching",
|
||||
"description": "",
|
||||
"file": "shared/recipes/workspace-watching",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/managing-repository/workspace-watching",
|
||||
"tags": ["workspace-watching"]
|
||||
},
|
||||
"/recipes/managing-repository/advanced-update": {
|
||||
"id": "advanced-update",
|
||||
"name": "Advanced Update Process",
|
||||
"description": "",
|
||||
"file": "shared/recipes/advanced-update",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/managing-repository/advanced-update",
|
||||
"tags": ["automate-updating-dependencies"]
|
||||
},
|
||||
"/recipes/managing-repository/standalone-to-integrated": {
|
||||
"id": "standalone-to-integrated",
|
||||
"name": "Convert from a Standalone Repository to an Integrated Repository",
|
||||
"description": "",
|
||||
"file": "shared/recipes/repo-types/standalone-to-integrated",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/managing-repository/standalone-to-integrated",
|
||||
"tags": ["repository-types"]
|
||||
},
|
||||
"/recipes/managing-repository/js-and-ts": {
|
||||
"id": "js-and-ts",
|
||||
"name": "JavaScript and TypeScript",
|
||||
"description": "",
|
||||
"file": "shared/guides/js-and-ts",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/managing-repository/js-and-ts",
|
||||
"tags": []
|
||||
},
|
||||
"/recipes/other": {
|
||||
"id": "other",
|
||||
"name": "Other",
|
||||
"description": "Other recipes you will find useful.",
|
||||
"file": "",
|
||||
"itemList": [
|
||||
{
|
||||
"id": "react-native",
|
||||
"name": "React Native with Nx",
|
||||
@ -1613,56 +1694,6 @@
|
||||
"path": "/recipes/other",
|
||||
"tags": []
|
||||
},
|
||||
"/recipes/other/root-level-scripts": {
|
||||
"id": "root-level-scripts",
|
||||
"name": "Run Root-Level NPM Scripts with Nx",
|
||||
"description": "",
|
||||
"file": "shared/recipes/root-level-scripts",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/other/root-level-scripts",
|
||||
"tags": ["run-tasks"]
|
||||
},
|
||||
"/recipes/other/analyze-source-files": {
|
||||
"id": "analyze-source-files",
|
||||
"name": "Disable Graph Links Created from Analyzing Source Files",
|
||||
"description": "",
|
||||
"file": "shared/recipes/analyze-source-files",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/other/analyze-source-files",
|
||||
"tags": ["explore-graph"]
|
||||
},
|
||||
"/recipes/other/workspace-watching": {
|
||||
"id": "workspace-watching",
|
||||
"name": "Workspace Watching",
|
||||
"description": "",
|
||||
"file": "shared/recipes/workspace-watching",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/other/workspace-watching",
|
||||
"tags": ["workspace-watching"]
|
||||
},
|
||||
"/recipes/other/advanced-update": {
|
||||
"id": "advanced-update",
|
||||
"name": "Advanced Update Process",
|
||||
"description": "",
|
||||
"file": "shared/recipes/advanced-update",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/other/advanced-update",
|
||||
"tags": ["automate-updating-dependencies"]
|
||||
},
|
||||
"/recipes/other/js-and-ts": {
|
||||
"id": "js-and-ts",
|
||||
"name": "JavaScript and TypeScript",
|
||||
"description": "",
|
||||
"file": "shared/guides/js-and-ts",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/recipes/other/js-and-ts",
|
||||
"tags": []
|
||||
},
|
||||
"/recipes/other/react-native": {
|
||||
"id": "react-native",
|
||||
"name": "React Native with Nx",
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
"file": "shared/recipes/root-level-scripts",
|
||||
"id": "root-level-scripts",
|
||||
"name": "Run Root-Level NPM Scripts with Nx",
|
||||
"path": "/recipes/other/root-level-scripts"
|
||||
"path": "/recipes/managing-repository/root-level-scripts"
|
||||
},
|
||||
{
|
||||
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
||||
@ -165,7 +165,7 @@
|
||||
"file": "shared/recipes/analyze-source-files",
|
||||
"id": "analyze-source-files",
|
||||
"name": "Disable Graph Links Created from Analyzing Source Files",
|
||||
"path": "/recipes/other/analyze-source-files"
|
||||
"path": "/recipes/managing-repository/analyze-source-files"
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
@ -304,7 +304,7 @@
|
||||
"file": "shared/recipes/advanced-update",
|
||||
"id": "advanced-update",
|
||||
"name": "Advanced Update Process",
|
||||
"path": "/recipes/other/advanced-update"
|
||||
"path": "/recipes/managing-repository/advanced-update"
|
||||
},
|
||||
{
|
||||
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
||||
@ -616,6 +616,22 @@
|
||||
"path": "/concepts/mental-model"
|
||||
}
|
||||
],
|
||||
"repository-types": [
|
||||
{
|
||||
"description": "",
|
||||
"file": "shared/concepts/integrated-vs-package-based",
|
||||
"id": "integrated-vs-package-based",
|
||||
"name": "Integrated Repos vs. Package-Based Repos vs. Standalone Apps",
|
||||
"path": "/concepts/integrated-vs-package-based"
|
||||
},
|
||||
{
|
||||
"description": "",
|
||||
"file": "shared/recipes/repo-types/standalone-to-integrated",
|
||||
"id": "standalone-to-integrated",
|
||||
"name": "Convert from a Standalone Repository to an Integrated Repository",
|
||||
"path": "/recipes/managing-repository/standalone-to-integrated"
|
||||
}
|
||||
],
|
||||
"create-your-own-plugin": [
|
||||
{
|
||||
"description": "",
|
||||
@ -963,7 +979,7 @@
|
||||
"file": "shared/recipes/workspace-watching",
|
||||
"id": "workspace-watching",
|
||||
"name": "Workspace Watching",
|
||||
"path": "/recipes/other/workspace-watching"
|
||||
"path": "/recipes/managing-repository/workspace-watching"
|
||||
},
|
||||
{
|
||||
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
||||
|
||||
@ -345,7 +345,7 @@
|
||||
"itemList": [
|
||||
{
|
||||
"name": "Integrated Repos vs. Package-Based Repos vs. Standalone Apps",
|
||||
"tags": ["intro"],
|
||||
"tags": ["intro", "repository-types"],
|
||||
"id": "integrated-vs-package-based",
|
||||
"file": "shared/concepts/integrated-vs-package-based"
|
||||
},
|
||||
@ -1316,9 +1316,9 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Other",
|
||||
"id": "other",
|
||||
"description": "Other recipes you will find useful.",
|
||||
"name": "Managing Your Nx Repository",
|
||||
"id": "managing-repository",
|
||||
"description": "Configuring the Repository Itself",
|
||||
"itemList": [
|
||||
{
|
||||
"name": "Run Root-Level NPM Scripts with Nx",
|
||||
@ -1344,11 +1344,24 @@
|
||||
"tags": ["automate-updating-dependencies"],
|
||||
"file": "shared/recipes/advanced-update"
|
||||
},
|
||||
{
|
||||
"name": "Convert from a Standalone Repository to an Integrated Repository",
|
||||
"id": "standalone-to-integrated",
|
||||
"tags": ["repository-types"],
|
||||
"file": "shared/recipes/repo-types/standalone-to-integrated"
|
||||
},
|
||||
{
|
||||
"name": "JavaScript and TypeScript",
|
||||
"id": "js-and-ts",
|
||||
"file": "shared/guides/js-and-ts"
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Other",
|
||||
"id": "other",
|
||||
"description": "Other recipes you will find useful.",
|
||||
"itemList": [
|
||||
{
|
||||
"name": "React Native with Nx",
|
||||
"id": "react-native",
|
||||
|
||||
@ -28,7 +28,7 @@ Nx creates a graph of all the dependencies between projects in your workspace us
|
||||
|
||||
Then `my-app` depends on `awesome-library`
|
||||
|
||||
This can be [turned on or off with the `analyzeSourceFiles` flag](../../recipes/other/analyze-source-files).
|
||||
This can be [turned on or off with the `analyzeSourceFiles` flag](../../recipes/managing-repository/analyze-source-files).
|
||||
|
||||
3. Manually created `implicitDependencies` in the project configuration file.
|
||||
|
||||
|
||||
@ -63,4 +63,4 @@ Note: You may want to keep the `migrations.json` until every branch that was cre
|
||||
|
||||
## Need to opt-out of some migrations?
|
||||
|
||||
Sometimes you need to temporarily opt-out from some migrations because your workspace is not ready yet. You can manually adjust the `migrations.json` or run the update with the `--interactive` flag to choose which migrations you accept. Find more details in our [Advanced Update Process](/recipes/other/advanced-update) guide.
|
||||
Sometimes you need to temporarily opt-out from some migrations because your workspace is not ready yet. You can manually adjust the `migrations.json` or run the update with the `--interactive` flag to choose which migrations you accept. Find more details in our [Advanced Update Process](/recipes/managing-repository/advanced-update) guide.
|
||||
|
||||
@ -136,7 +136,7 @@ If you want Nx to cache the task, but prefer to use npm (or pnpm/yarn) to run th
|
||||
}
|
||||
```
|
||||
|
||||
Learn more about root-level tasks [in our dedicated recipe page](/recipes/other/root-level-scripts).
|
||||
Learn more about root-level tasks [in our dedicated recipe page](/recipes/managing-repository/root-level-scripts).
|
||||
|
||||
## Defining the Task Pipeline
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ If you haven't used Nx before and used the Angular CLI, you probably ran `ng upd
|
||||
- Fix migrations that "almost work".
|
||||
- Commit a partially migrated state.
|
||||
- Change versions of packages to match org requirements.
|
||||
- [Opt out of Angular updates when updating Nx versions](/recipes/other/advanced-update#choosing-optional-package-updates-to-apply) as long as [the Angular version is still supported](/packages/angular/documents/angular-nx-version-matrix)
|
||||
- [Opt out of Angular updates when updating Nx versions](/recipes/managing-repository/advanced-update#choosing-optional-package-updates-to-apply) as long as [the Angular version is still supported](/packages/angular/documents/angular-nx-version-matrix)
|
||||
|
||||
`nx migrate` does this by splitting the process into two steps. `nx migrate latest` creates a `migrations.json` file with a list of all the migrations that are needed by Nx, Angular and other packages. You then have a chance to modify that file before running `nx migrate --run-migrations` to actually execute those migrations.
|
||||
|
||||
|
||||
95
docs/shared/recipes/repo-types/standalone-to-integrated.md
Normal file
95
docs/shared/recipes/repo-types/standalone-to-integrated.md
Normal file
@ -0,0 +1,95 @@
|
||||
# Convert from a Standalone Repository to an Integrated Repository
|
||||
|
||||
In many ways, a standalone repository is an integrated repository, but with one primary app located at the root of the repository. Both types of repos use plugins to generate code and to keep dependencies and config files up to date. Both types of repos use executors to hide away unneeded complexity.
|
||||
|
||||
You can always add another app to a standalone repository the same way you would in an integrated repo. But at some point, you may want to move the primary app out of the root of your repo because the repo is no longer primarily focused on that one app. There are other apps that are equally important and you want the folder structure to align with the new reality.
|
||||
|
||||
## Strategy
|
||||
|
||||
For this recipe, we'll assume that the root-level app is named `my-app`. The high-level process we'll go through to move the app involves four stages:
|
||||
|
||||
1. Create a new app named `temp` under `apps/temp`.
|
||||
2. Move source and config files from `my-app` into `apps/temp`.
|
||||
3. Delete the files for `my-app`.
|
||||
4. Rename `apps/temp` to `apps/my-app`
|
||||
|
||||
## 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`
|
||||
|
||||
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`
|
||||
|
||||
```shell
|
||||
nx g app temp
|
||||
```
|
||||
|
||||
4. 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.
|
||||
|
||||
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.
|
||||
|
||||
| Type of Config | Files |
|
||||
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| _Root-level_ | `.eslintignore`, `.eslintrc.base.json`, `.gitignore`, `.prettierignore`, `jest.config.ts`, `jest.preset.js`, `.prettierrc`, `nx.json`, `package.json`, `tsconfig.base.json` |
|
||||
| _Project-level_ | `.eslintrc.json`, `index.html`, `project.json`, `jest.config.app.ts`, `tsconfig.app.json`, `tsconfig.json`, `tsconfig.spec.json`, `vite.config.ts`, `webpack.config.js` |
|
||||
|
||||
{% callout title="jest.config.app.ts" type="note" %}
|
||||
`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`.
|
||||
|
||||
Here is a non-exhaustive list of properties that will need to be updated to have the correct path:
|
||||
|
||||
| Config File(s) | Properties to Check |
|
||||
| ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `project.json` | `$schema`, `sourceRoot`, `root`, `outputPath`, `reportsDirectory`, `cypressConfig`, `lintFilePatterns`, `index`, `main`, `tsConfig`, `assets`, `styles`, `jestConfig` |
|
||||
| `tsconfig.json`, `tsconfig.app.json`, `tsconfig.spec.json` | `extends`, `outDir`, `files` |
|
||||
| `.eslintrc.json` | `extends` |
|
||||
| `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.
|
||||
|
||||
```shell
|
||||
nx build temp
|
||||
nx test temp
|
||||
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.
|
||||
|
||||
```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`
|
||||
|
||||
```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.
|
||||
@ -193,12 +193,14 @@
|
||||
- [Using Apollo GraphQL](/recipes/example-repos/apollo-react)
|
||||
- [Large Repo and Caching](/recipes/example-repos/caching)
|
||||
- [Large Repo and DTE](/recipes/example-repos/dte)
|
||||
- [Managing Your Nx Repository](/recipes/managing-repository)
|
||||
- [Run Root-Level NPM Scripts with Nx](/recipes/managing-repository/root-level-scripts)
|
||||
- [Disable Graph Links Created from Analyzing Source Files](/recipes/managing-repository/analyze-source-files)
|
||||
- [Workspace Watching](/recipes/managing-repository/workspace-watching)
|
||||
- [Advanced Update Process](/recipes/managing-repository/advanced-update)
|
||||
- [Convert from a Standalone Repository to an Integrated Repository](/recipes/managing-repository/standalone-to-integrated)
|
||||
- [JavaScript and TypeScript](/recipes/managing-repository/js-and-ts)
|
||||
- [Other](/recipes/other)
|
||||
- [Run Root-Level NPM Scripts with Nx](/recipes/other/root-level-scripts)
|
||||
- [Disable Graph Links Created from Analyzing Source Files](/recipes/other/analyze-source-files)
|
||||
- [Workspace Watching](/recipes/other/workspace-watching)
|
||||
- [Advanced Update Process](/recipes/other/advanced-update)
|
||||
- [JavaScript and TypeScript](/recipes/other/js-and-ts)
|
||||
- [React Native with Nx](/recipes/other/react-native)
|
||||
- [Remix with Nx](/recipes/other/remix)
|
||||
- [Adding Images, Fonts, and Files](/recipes/other/adding-assets-react)
|
||||
|
||||
@ -365,6 +365,15 @@ const recipesUrls = {
|
||||
'/recipes/deployment/deploy-nextjs-to-vercel',
|
||||
'/recipes/other/azure-last-successful-commit':
|
||||
'/recipes/ci/azure-last-successful-commit',
|
||||
'/recipes/other/root-level-scripts':
|
||||
'/recipes/managing-repository/root-level-scripts',
|
||||
'/recipes/other/analyze-source-files':
|
||||
'/recipes/managing-repository/analyze-source-files',
|
||||
'/recipes/other/workspace-watching':
|
||||
'/recipes/managing-repository/workspace-watching',
|
||||
'/recipes/other/advanced-update':
|
||||
'/recipes/managing-repository/advanced-update',
|
||||
'/recipes/other/js-and-ts': '/recipes/managing-repository/js-and-ts',
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -1280,7 +1280,7 @@ async function generateMigrationsJsonAndUpdatePackageJson(
|
||||
? [
|
||||
`- You opted out of some migrations for now. Write the following command down somewhere to apply these migrations later:`,
|
||||
` nx migrate ${opts.targetVersion} --from ${opts.targetPackage}@${minVersionWithSkippedUpdates} --exclude-applied-migrations`,
|
||||
`- To learn more go to https://nx.dev/recipes/other/advanced-update`,
|
||||
`- To learn more go to https://nx.dev/recipes/managing-repository/advanced-update`,
|
||||
]
|
||||
: [
|
||||
`- To learn more go to https://nx.dev/core-features/automate-updating-dependencies`,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user