Skip to content

Commit 6aae2a1

Browse files
authored
Update README.md
1 parent cb70371 commit 6aae2a1

File tree

1 file changed

+83
-25
lines changed

1 file changed

+83
-25
lines changed

300/300/README.md

Lines changed: 83 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -151,47 +151,94 @@ This will generate the following file and directory structure underneath the ```
151151

152152
**IMPORTANT**: Modify **nx.json** so it can connect with Nx Cloud.
153153

154-
Here’s a sample `nx.json` configuration that supports Nx Cloud for your workspace:
154+
To support the nested directory structure correctly in your ```/hatch-project/nx.json```, you should adjust the paths to reflect the correct locations within the nested workspace. Here’s a revised example:
155155

156156
```json
157157
{
158-
"npmScope": "hatch_project",
159-
"affected": {
160-
"defaultBase": "main"
158+
"$schema": "./node_modules/nx/schemas/nx-schema.json",
159+
"namedInputs": {
160+
"default": ["{projectRoot}/**/*", "sharedGlobals"],
161+
"production": [
162+
"default",
163+
"!{projectRoot}/.eslintrc.json",
164+
"!{projectRoot}/eslint.config.mjs",
165+
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
166+
"!{projectRoot}/tsconfig.spec.json",
167+
"!{projectRoot}/jest.config.[jt]s",
168+
"!{projectRoot}/src/test-setup.[jt]s",
169+
"!{projectRoot}/test-setup.[jt]s"
170+
],
171+
"sharedGlobals": ["{workspaceRoot}/.github/workflows/ci.yml"]
161172
},
162-
"tasksRunnerOptions": {
163-
"default": {
164-
"runner": "@nrwl/workspace/src/tasks-runner/default-task-runner",
173+
"nxCloudId": "67a3783761d0514ff26bf202",
174+
"plugins": [
175+
{
176+
"plugin": "@nx/webpack/plugin",
165177
"options": {
166-
"cacheableOperations": ["build", "test", "lint"],
167-
"localCache": true
178+
"buildTargetName": "build",
179+
"serveTargetName": "serve",
180+
"previewTargetName": "preview",
181+
"buildDepsTargetName": "build-deps",
182+
"watchDepsTargetName": "watch-deps"
183+
}
184+
},
185+
{
186+
"plugin": "@nx/eslint/plugin",
187+
"options": {
188+
"targetName": "lint"
189+
}
190+
},
191+
{
192+
"plugin": "@nx/playwright/plugin",
193+
"options": {
194+
"targetName": "e2e"
195+
}
196+
},
197+
{
198+
"plugin": "@nx/jest/plugin",
199+
"options": {
200+
"targetName": "test"
201+
}
202+
}
203+
],
204+
"targetDefaults": {
205+
"e2e-ci--**/*": {
206+
"dependsOn": ["^build"]
207+
}
208+
},
209+
"generators": {
210+
"@nx/react": {
211+
"application": {
212+
"babel": true,
213+
"style": "tailwind",
214+
"linter": "eslint",
215+
"bundler": "webpack"
216+
},
217+
"component": {
218+
"style": "tailwind"
219+
},
220+
"library": {
221+
"style": "tailwind",
222+
"linter": "eslint"
168223
}
169224
}
170225
},
171226
"projects": {
172227
"hatch_project": {
173228
"root": "src/hatch_project",
174229
"sourceRoot": "src/hatch_project/src",
175-
"projectType": "application",
176-
"targets": {
177-
"build": {
178-
"executor": "@nrwl/web:build",
179-
"options": {
180-
"outputPath": "dist/hatch_project",
181-
"index": "src/hatch_project/src/index.html",
182-
"main": "src/hatch_project/src/main.tsx",
183-
"polyfills": "src/hatch_project/src/polyfills.ts",
184-
"tsConfig": "src/hatch_project/tsconfig.app.json",
185-
"assets": ["src/hatch_project/src/favicon.ico", "src/hatch_project/src/assets"],
186-
"styles": ["src/hatch_project/src/styles.css"],
187-
"scripts": []
188-
}
189-
}
190-
}
230+
"projectType": "application"
191231
}
192232
}
193233
}
194234
```
235+
/hatch-project/nx.json
236+
237+
### Key Adjustments:
238+
- **`projects` section**: Explicitly defines the project structure, setting the `root` and `sourceRoot` to the correct paths within the nested directory.
239+
- Ensure that all paths reflect the actual structure of your workspace.
240+
241+
This configuration will help Nx Cloud properly identify and manage your nested workspace.
195242

196243
Notice that it prepends paths with ```src/``` (e.g., ```"root": "src/hatch_project",```) to allow for our **nested** directory structure.
197244

@@ -229,3 +276,14 @@ Finish the CI setup by visiting: https://cloud.nx.app/connect/lvaFjW0bDV # **Not
229276
## Nested app directories
230277

231278
You can have nested folders, no problems. 👍 Here's a [live example](https://github.com/codyslexia/nexa/tree/main/apps/graphql). You can see that apps/graphql/users is a nested directory where users is the actual project. There's also this [other example](https://github.com/nrwl/nx-incremental-large-repo/tree/master/libs/app0/lib1) from the ```nrwl``` family.
279+
280+
## Nx ignore
281+
282+
You can place a ```.nxignore``` in the root of the project directory, here ```/hatch-project/src/hatch_project/.nxignore```.
283+
284+
For example to ignore any files in ```.next```:
285+
286+
```
287+
.next
288+
```
289+
.nxignore

0 commit comments

Comments
 (0)