@skyf0xx/hedgehog-core-full-stack-app 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/agents/backend-eng.md
CHANGED
|
@@ -32,9 +32,9 @@ build exactly what its ALLOWED SCOPE names, one layer at a time, gated by
|
|
|
32
32
|
- **PostgreSQL** via Docker Compose — never a natively-installed Postgres.
|
|
33
33
|
|
|
34
34
|
Use `nx-run-tasks` (build/lint/test/typecheck), `nx-workspace` (inspecting
|
|
35
|
-
project/target config), `nx-generate` (
|
|
36
|
-
`link-workspace-packages`
|
|
37
|
-
needed.
|
|
35
|
+
project/target config), `nx-generate` (running the packet's
|
|
36
|
+
`tools/generators:<layer>` command), and `link-workspace-packages`
|
|
37
|
+
(wiring a new package into a consumer) as needed.
|
|
38
38
|
|
|
39
39
|
**Every layer you own starts from its generator in `tools/generators/`** —
|
|
40
40
|
one per layer (`schema`, `contract`, `repository`, `service`,
|
package/agents/front-end-eng.md
CHANGED
|
@@ -30,9 +30,9 @@ before the next starts.
|
|
|
30
30
|
routes directly.
|
|
31
31
|
|
|
32
32
|
Use `nx-run-tasks` (build/lint/test/typecheck), `nx-workspace` (inspecting
|
|
33
|
-
project/target config), `nx-generate` (
|
|
34
|
-
`link-workspace-packages`
|
|
35
|
-
needed.
|
|
33
|
+
project/target config), `nx-generate` (running the packet's
|
|
34
|
+
`tools/generators:<layer>` command), and `link-workspace-packages`
|
|
35
|
+
(wiring a new package into a consumer) as needed.
|
|
36
36
|
|
|
37
37
|
**Both layers you own start from their generator in `tools/generators/`** —
|
|
38
38
|
`hook` lands `packages/hooks`'s shell, `nx.tags`, the query hook set, and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyf0xx/hedgehog-core-full-stack-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Hedgehog's full-stack-app core: an Nx/pnpm/NestJS/Next.js workspace, backend-first domain module build discipline, and the agents and skills that drive it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: link-workspace-packages
|
|
3
|
-
description: 'Link workspace packages in the Hedgehog pnpm monorepo. USE WHEN: (1) you just created or generated new packages and need to wire up their dependencies, (2) code imports from a sibling package and needs it added as a dependency, (3) you get resolution errors for workspace packages
|
|
3
|
+
description: 'Link workspace packages in the Hedgehog pnpm monorepo. USE WHEN: (1) you just created or generated new packages and need to wire up their dependencies, (2) code imports from a sibling package and needs it added as a dependency, (3) you get resolution errors for workspace packages like "cannot find module", "failed to resolve import", "TS2307", or "cannot resolve". DO NOT patch around with tsconfig paths or manual package.json edits - use pnpm''s workspace commands to fix actual linking.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Link Workspace Packages
|
|
7
7
|
|
|
8
|
+
Adapted from Nx's stock workspace-linking skill for this core's own
|
|
9
|
+
package names — plain, unscoped (`db`, `contracts`, `hooks`, `config`,
|
|
10
|
+
plus each module's `libs/<module>/repository` and
|
|
11
|
+
`libs/<module>/service`), not `@org/*`-scoped.
|
|
12
|
+
|
|
8
13
|
Add dependencies between packages in the workspace using pnpm's `workspace:` protocol — symlinks are only created when a dependency is explicitly declared this way.
|
|
9
14
|
|
|
10
15
|
## Workflow
|
|
11
16
|
|
|
12
|
-
1. Identify consumer package (the one importing)
|
|
13
|
-
2. Identify provider package(s) (being imported)
|
|
17
|
+
1. Identify consumer package (the one importing) — e.g. `apps/api`
|
|
18
|
+
2. Identify provider package(s) (being imported) — e.g. a module's `libs/<module>/service`
|
|
14
19
|
3. Add the dependency:
|
|
15
20
|
|
|
16
21
|
```bash
|
|
17
22
|
# From consumer directory
|
|
18
|
-
pnpm add
|
|
23
|
+
pnpm add <module>-service --workspace
|
|
19
24
|
|
|
20
25
|
# Or with --filter from anywhere
|
|
21
|
-
pnpm add
|
|
26
|
+
pnpm add <module>-service --filter api --workspace
|
|
22
27
|
```
|
|
23
28
|
|
|
24
29
|
Result in `package.json`:
|
|
25
30
|
|
|
26
31
|
```json
|
|
27
|
-
{ "dependencies": { "
|
|
32
|
+
{ "dependencies": { "<module>-service": "workspace:*" } }
|
|
28
33
|
```
|
|
29
34
|
|
|
30
|
-
4. Verify the symlink was created in the consumer's `node_modules
|
|
35
|
+
4. Verify the symlink was created in the consumer's `node_modules/<package>`
|
|
31
36
|
|
|
32
37
|
## Debugging "Cannot find module"
|
|
33
38
|
|
|
@@ -1,165 +1,73 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: nx-generate
|
|
3
|
-
description:
|
|
4
|
-
subagent: general-purpose
|
|
5
|
-
context: fork
|
|
3
|
+
description: Run one of this core's own Nx generators to scaffold a domain-module layer. INVOKE when a claimed packet's LAYER SHAPE section names a `tools/generators:<layer>` command to run.
|
|
6
4
|
---
|
|
7
5
|
|
|
8
6
|
# Run Nx Generator
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
- Do anything else that an nx generator exists for
|
|
18
|
-
|
|
19
|
-
## Key Principles
|
|
20
|
-
|
|
21
|
-
1. **Always use `--no-interactive`** - Prevents prompts that would hang execution
|
|
22
|
-
2. **Read the generator source code** - The schema alone is not enough; understand what the generator actually does
|
|
23
|
-
3. **Match existing repo patterns** - Study similar artifacts in the repo and follow their conventions
|
|
24
|
-
4. **Verify with lint/test/build/typecheck etc.** - Generated code must pass verification, using whatever targets are appropriate for this workspace (CI config is a good guide for which ones are critical).
|
|
8
|
+
Adapted from Nx's stock `nx-generate` skill for this core's closed set of
|
|
9
|
+
generators: `tools/generators/` holds exactly one generator per domain
|
|
10
|
+
module layer (`schema`, `contract`, `repository`, `service`, `controller`,
|
|
11
|
+
`hook`, `screen`), and every layer's task packet already names which one
|
|
12
|
+
to run and with what flags — there is no generator discovery or matching
|
|
13
|
+
step here. `hedgehog-loop`'s "Scaffolding a layer" section owns the full
|
|
14
|
+
flag contract; this skill covers only the mechanics of invoking one.
|
|
25
15
|
|
|
26
16
|
## Steps
|
|
27
17
|
|
|
28
|
-
### 1.
|
|
29
|
-
|
|
30
|
-
Use the Nx CLI to discover available generators:
|
|
31
|
-
|
|
32
|
-
- List all generators for a plugin: `pnpm nx list @nx/react`
|
|
33
|
-
- View available plugins: `pnpm nx list`
|
|
34
|
-
|
|
35
|
-
This includes plugin generators (e.g., `@nx/react:library`) and local workspace generators.
|
|
36
|
-
|
|
37
|
-
### 2. Match Generator to User Request
|
|
38
|
-
|
|
39
|
-
Identify which generator(s) could fulfill the user's needs. Consider what artifact type they want, which framework is relevant, and any specific generator names mentioned.
|
|
40
|
-
|
|
41
|
-
**IMPORTANT**: When both a local workspace generator and an external plugin generator could satisfy the request, **always prefer the local workspace generator**. Local generators are customized for the specific repo's patterns.
|
|
42
|
-
|
|
43
|
-
If no suitable generator exists, you can stop using this skill. However, the burden of proof is high—carefully consider all available generators before deciding none apply.
|
|
44
|
-
|
|
45
|
-
### 3. Get Generator Options
|
|
46
|
-
|
|
47
|
-
Use the `--help` flag to understand available options:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
pnpm nx g @nx/react:library --help
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Pay attention to required options, defaults that might need overriding, and options relevant to the user's request.
|
|
54
|
-
|
|
55
|
-
### Library Buildability
|
|
56
|
-
|
|
57
|
-
**Default to non-buildable libraries** unless there's a specific reason for buildable.
|
|
58
|
-
|
|
59
|
-
| Type | When to use | Generator flags |
|
|
60
|
-
| --------------------------- | ----------------------------------------------------------------- | ----------------------------------- |
|
|
61
|
-
| **Non-buildable** (default) | Internal monorepo libs consumed by apps | No `--bundler` flag |
|
|
62
|
-
| **Buildable** | Publishing to npm, cross-repo sharing, stable libs for cache hits | `--bundler=vite` or `--bundler=swc` |
|
|
63
|
-
|
|
64
|
-
Non-buildable libs:
|
|
65
|
-
|
|
66
|
-
- Export `.ts`/`.tsx` source directly
|
|
67
|
-
- Consumer's bundler compiles them
|
|
68
|
-
- Faster dev experience, less config
|
|
18
|
+
### 1. Run the packet's command
|
|
69
19
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- Have their own build target
|
|
73
|
-
- Useful for stable libs that rarely change (cache hits)
|
|
74
|
-
- Required for npm publishing
|
|
75
|
-
|
|
76
|
-
**If unclear, ask the user:** "Should this library be buildable (own build step, better caching) or non-buildable (source consumed directly, simpler setup)?"
|
|
77
|
-
|
|
78
|
-
### 4. Read Generator Source Code
|
|
79
|
-
|
|
80
|
-
**This step is critical.** The schema alone does not tell you everything. Reading the source code helps you:
|
|
81
|
-
|
|
82
|
-
- Know exactly what files will be created/modified and where
|
|
83
|
-
- Understand side effects (updating configs, installing deps, etc.)
|
|
84
|
-
- Identify behaviors and options not obvious from the schema
|
|
85
|
-
- Understand how options interact with each other
|
|
86
|
-
|
|
87
|
-
To find generator source code:
|
|
88
|
-
|
|
89
|
-
- For plugin generators: Use `node -e "console.log(require.resolve('@nx/<plugin>/generators.json'));"` to find the generators.json, then locate the source from there
|
|
90
|
-
- If that fails, read directly from `node_modules/<plugin>/generators.json`
|
|
91
|
-
- For local generators: Typically in `tools/generators/` or a local plugin directory. Search the repo for the generator name.
|
|
92
|
-
|
|
93
|
-
After reading the source, reconsider: Is this the right generator? If not, go back to step 2.
|
|
94
|
-
|
|
95
|
-
> **⚠️ `--directory` flag behavior can be misleading.**
|
|
96
|
-
> It should specify the full path of the generated library or component, not the parent path that it will be generated in.
|
|
97
|
-
>
|
|
98
|
-
> ```bash
|
|
99
|
-
> # ✅ Correct - directory is the full path for the library
|
|
100
|
-
> nx g @nx/react:library --directory=libs/my-lib
|
|
101
|
-
> # generates libs/my-lib/package.json and more
|
|
102
|
-
>
|
|
103
|
-
> # ❌ Wrong - this will create files at libs and libs/src/...
|
|
104
|
-
> nx g @nx/react:library --name=my-lib --directory=libs
|
|
105
|
-
> # generates libs/package.json and more
|
|
106
|
-
> ```
|
|
107
|
-
|
|
108
|
-
### 5. Examine Existing Patterns
|
|
109
|
-
|
|
110
|
-
Before generating, examine the target area of the codebase:
|
|
111
|
-
|
|
112
|
-
- Look at similar existing artifacts (other libraries, applications, etc.)
|
|
113
|
-
- Identify naming conventions, file structures, and configuration patterns
|
|
114
|
-
- Note which test runners, build tools, and linters are used
|
|
115
|
-
- Configure the generator to match these patterns
|
|
116
|
-
|
|
117
|
-
### 6. Dry-Run to Verify File Placement
|
|
118
|
-
|
|
119
|
-
**Always run with `--dry-run` first** to verify files will be created in the correct location:
|
|
20
|
+
The claimed packet's LAYER SHAPE section prints the exact command,
|
|
21
|
+
already filled in with `--module` and `--fields`. Run it as given:
|
|
120
22
|
|
|
121
23
|
```bash
|
|
122
|
-
|
|
24
|
+
nx g ./tools/generators:<layer> --module=<module> [--fields='<name:type,...>'] [--toggleField=<boolField>]
|
|
123
25
|
```
|
|
124
26
|
|
|
125
|
-
|
|
27
|
+
Always pass `--no-interactive` if the command is going to run
|
|
28
|
+
unattended and might otherwise prompt.
|
|
126
29
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
### 7. Run the Generator
|
|
130
|
-
|
|
131
|
-
Execute the generator:
|
|
30
|
+
### 2. Dry-run first when the placement is unfamiliar
|
|
132
31
|
|
|
133
32
|
```bash
|
|
134
|
-
|
|
33
|
+
nx g ./tools/generators:<layer> --module=<module> --dry-run --no-interactive
|
|
135
34
|
```
|
|
136
35
|
|
|
137
|
-
|
|
36
|
+
Most of the time the generator's target paths are already well
|
|
37
|
+
understood (they're fixed by layer, per `hedgehog-loop`), so this step is
|
|
38
|
+
optional — reach for it when something about the module name or flags is
|
|
39
|
+
unusual enough to want to see the file list before it lands.
|
|
138
40
|
|
|
139
|
-
###
|
|
41
|
+
### 3. Read the generator source if a flag's effect is unclear
|
|
140
42
|
|
|
141
|
-
|
|
43
|
+
The generator's own source lives in `tools/generators/<layer>/generator.ts`
|
|
44
|
+
next to its `schema.json`. Read it before guessing at what a flag does —
|
|
45
|
+
the schema alone doesn't show side effects (barrel wiring, tag
|
|
46
|
+
assignment, module registration).
|
|
142
47
|
|
|
143
|
-
|
|
144
|
-
- Adjust imports, exports, or configurations
|
|
145
|
-
- Integrate with existing code patterns
|
|
48
|
+
### 4. Author the entity-specific delta
|
|
146
49
|
|
|
147
|
-
|
|
50
|
+
The generator lands the layer's skeleton — package shell, `nx.tags`,
|
|
51
|
+
port-discipline file suffixes, barrel wiring, and (for `screen`)
|
|
52
|
+
placeholder sections. It does not write the module's field-specific
|
|
53
|
+
logic, business rules, or UX. Author that on top, per the packet's
|
|
54
|
+
INTENT and RELEVANT RULES.
|
|
148
55
|
|
|
149
|
-
|
|
56
|
+
**Important:** if a generated test file needs replacing rather than
|
|
57
|
+
extending, write a meaningful replacement — an empty test suite fails
|
|
58
|
+
`nx test`.
|
|
150
59
|
|
|
151
|
-
|
|
60
|
+
### 5. Wire the new package into the workspace
|
|
152
61
|
|
|
153
|
-
|
|
154
|
-
pnpm nx
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
Then verify the generated code works. Keep in mind that the changes you make with a generator or subsequent modifications might impact various projects so it's usually not enough to only run targets for the artifact you just created.
|
|
62
|
+
A layer that's the first arrival in its package needs
|
|
63
|
+
`pnpm install && pnpm nx sync` before verify can see it — see
|
|
64
|
+
`hedgehog-loop`'s "First arrival in a package" for which layers this
|
|
65
|
+
applies to and the override that widens scope for it. The
|
|
66
|
+
`link-workspace-packages` skill covers adding a dependency between two
|
|
67
|
+
existing packages.
|
|
160
68
|
|
|
161
|
-
|
|
162
|
-
pnpm nx run-many -t build,lint,test,typecheck
|
|
163
|
-
```
|
|
69
|
+
### 6. Verify
|
|
164
70
|
|
|
165
|
-
|
|
71
|
+
Run whatever the packet's VERIFICATION command specifies. `nx-run-tasks`
|
|
72
|
+
covers running build/lint/test/typecheck directly if you need to check
|
|
73
|
+
something the packet's own command doesn't cover.
|
|
@@ -3,6 +3,11 @@ name: nx-run-tasks
|
|
|
3
3
|
description: Helps with running tasks in an Nx workspace. USE WHEN the user wants to execute build, test, lint, serve, or run any other tasks defined in the workspace.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
Adapted from Nx's stock task-running skill for this workspace's own
|
|
7
|
+
targets (`build`, `lint`, `test`, `typecheck`, `serve`) and projects
|
|
8
|
+
(`api`, `web`, `mobile` when the Mobile add-on is on, plus each domain
|
|
9
|
+
module's `libs/<module>/*`).
|
|
10
|
+
|
|
6
11
|
Run tasks via `pnpm nx` (see the `nx-workspace` skill for the pnpm-only convention and for checking which targets a project has before running one).
|
|
7
12
|
|
|
8
13
|
For more details on any command, run it with `--help` (e.g. `pnpm nx run-many --help`, `pnpm nx affected --help`).
|
|
@@ -13,7 +18,7 @@ For more details on any command, run it with `--help` (e.g. `pnpm nx run-many --
|
|
|
13
18
|
pnpm nx run <project>:<task>
|
|
14
19
|
```
|
|
15
20
|
|
|
16
|
-
where `project` is the project name defined in `package.json` or `project.json` (if present).
|
|
21
|
+
where `project` is the project name defined in `package.json` or `project.json` (if present) — e.g. `pnpm nx run api:test`, `pnpm nx run web:build`.
|
|
17
22
|
|
|
18
23
|
## Run multiple tasks
|
|
19
24
|
|
|
@@ -25,9 +30,9 @@ You can pass a `-p` flag to filter to specific projects, otherwise it runs on al
|
|
|
25
30
|
|
|
26
31
|
Examples:
|
|
27
32
|
|
|
28
|
-
- `pnpm nx run-many -t test -p
|
|
29
|
-
- `pnpm nx run-many -t test --projects=*-
|
|
30
|
-
- `pnpm nx run-many -t test --projects=tag:
|
|
33
|
+
- `pnpm nx run-many -t test -p api web` — test specific projects
|
|
34
|
+
- `pnpm nx run-many -t test --projects=*-e2e` — test projects matching a pattern
|
|
35
|
+
- `pnpm nx run-many -t test --projects=tag:type:service` — test projects by tag (see `hedgehog-loop`'s "Port discipline" for this core's tag scheme)
|
|
31
36
|
|
|
32
37
|
## Run tasks for affected projects
|
|
33
38
|
|
|
@@ -5,7 +5,13 @@ description: "Explore and understand Nx workspaces. USE WHEN answering questions
|
|
|
5
5
|
|
|
6
6
|
# Nx Workspace Exploration
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Adapted from Nx's stock workspace-exploration skill for this core's own
|
|
9
|
+
project shape: `apps/api`, `apps/web`, `apps/mobile` (Mobile add-on only),
|
|
10
|
+
and per-module `libs/<module>/repository`, `libs/<module>/service`
|
|
11
|
+
alongside the shared `packages/db`, `packages/contracts`, `packages/hooks`,
|
|
12
|
+
`packages/config`. This skill provides read-only exploration; it never
|
|
13
|
+
generates or modifies anything — see `nx-generate` for scaffolding a
|
|
14
|
+
layer and `nx-run-tasks` for running build/lint/test/typecheck.
|
|
9
15
|
|
|
10
16
|
Run all commands via `pnpm nx` (Hedgehog workspaces are pnpm-only).
|
|
11
17
|
|
|
@@ -21,11 +27,12 @@ pnpm nx show projects
|
|
|
21
27
|
|
|
22
28
|
# Filter by pattern (glob)
|
|
23
29
|
pnpm nx show projects --projects "apps/*"
|
|
24
|
-
pnpm nx show projects --projects "
|
|
30
|
+
pnpm nx show projects --projects "packages/*"
|
|
25
31
|
|
|
26
|
-
# Filter by tag
|
|
27
|
-
|
|
28
|
-
pnpm nx show projects
|
|
32
|
+
# Filter by tag (see `hedgehog-loop`'s "Port discipline" for this core's
|
|
33
|
+
# type:service/type:adapter tag scheme)
|
|
34
|
+
pnpm nx show projects --projects "tag:type:service"
|
|
35
|
+
pnpm nx show projects -p 'tag:type:service,!tag:type:adapter'
|
|
29
36
|
|
|
30
37
|
# Filter by target (projects that have a specific target)
|
|
31
38
|
pnpm nx show projects --withTarget build
|
|
@@ -53,15 +60,15 @@ You can read the full project schema at `node_modules/nx/schemas/project-schema.
|
|
|
53
60
|
|
|
54
61
|
```bash
|
|
55
62
|
# Get full project configuration
|
|
56
|
-
pnpm nx show project
|
|
63
|
+
pnpm nx show project web --json
|
|
57
64
|
|
|
58
65
|
# Extract specific parts from the JSON
|
|
59
|
-
pnpm nx show project
|
|
60
|
-
pnpm nx show project
|
|
61
|
-
pnpm nx show project
|
|
66
|
+
pnpm nx show project web --json | jq '.targets'
|
|
67
|
+
pnpm nx show project web --json | jq '.targets.build'
|
|
68
|
+
pnpm nx show project web --json | jq '.targets | keys'
|
|
62
69
|
|
|
63
70
|
# Check project metadata
|
|
64
|
-
pnpm nx show project
|
|
71
|
+
pnpm nx show project web --json | jq '{name, root, sourceRoot, projectType, tags}'
|
|
65
72
|
```
|
|
66
73
|
|
|
67
74
|
## Target Information
|
|
@@ -70,21 +77,21 @@ Targets define what tasks can be run on a project.
|
|
|
70
77
|
|
|
71
78
|
```bash
|
|
72
79
|
# List all targets for a project
|
|
73
|
-
pnpm nx show project
|
|
80
|
+
pnpm nx show project web --json | jq '.targets | keys'
|
|
74
81
|
|
|
75
82
|
# Get full target configuration
|
|
76
|
-
pnpm nx show project
|
|
83
|
+
pnpm nx show project web --json | jq '.targets.build'
|
|
77
84
|
|
|
78
85
|
# Check target executor/command
|
|
79
|
-
pnpm nx show project
|
|
80
|
-
pnpm nx show project
|
|
86
|
+
pnpm nx show project web --json | jq '.targets.build.executor'
|
|
87
|
+
pnpm nx show project web --json | jq '.targets.build.command'
|
|
81
88
|
|
|
82
89
|
# View target options
|
|
83
|
-
pnpm nx show project
|
|
90
|
+
pnpm nx show project web --json | jq '.targets.build.options'
|
|
84
91
|
|
|
85
92
|
# Check target inputs/outputs (for caching)
|
|
86
|
-
pnpm nx show project
|
|
87
|
-
pnpm nx show project
|
|
93
|
+
pnpm nx show project web --json | jq '.targets.build.inputs'
|
|
94
|
+
pnpm nx show project web --json | jq '.targets.build.outputs'
|
|
88
95
|
|
|
89
96
|
# Find projects with a specific target
|
|
90
97
|
pnpm nx show projects --withTarget serve
|
|
@@ -130,7 +137,7 @@ pnpm nx show projects --json
|
|
|
130
137
|
Example output:
|
|
131
138
|
|
|
132
139
|
```json
|
|
133
|
-
["
|
|
140
|
+
["web", "api-e2e", "hooks", "contracts", "api", "orders", "orders-e2e"]
|
|
134
141
|
```
|
|
135
142
|
|
|
136
143
|
Common operations:
|
|
@@ -140,7 +147,7 @@ Common operations:
|
|
|
140
147
|
pnpm nx show projects --json | jq 'length'
|
|
141
148
|
|
|
142
149
|
# Filter by pattern
|
|
143
|
-
pnpm nx show projects --json | jq '.[] | select(
|
|
150
|
+
pnpm nx show projects --json | jq '.[] | select(endswith("-e2e"))'
|
|
144
151
|
|
|
145
152
|
# Get affected projects as array
|
|
146
153
|
pnpm nx show projects --affected --json | jq '.'
|
|
@@ -149,29 +156,29 @@ pnpm nx show projects --affected --json | jq '.'
|
|
|
149
156
|
### Project Details ("How do I build/test/lint project X?")
|
|
150
157
|
|
|
151
158
|
```bash
|
|
152
|
-
pnpm nx show project
|
|
159
|
+
pnpm nx show project web --json
|
|
153
160
|
```
|
|
154
161
|
|
|
155
162
|
Example output:
|
|
156
163
|
|
|
157
164
|
```json
|
|
158
165
|
{
|
|
159
|
-
"root": "apps/
|
|
160
|
-
"name": "
|
|
161
|
-
"sourceRoot": "apps/
|
|
166
|
+
"root": "apps/web",
|
|
167
|
+
"name": "web",
|
|
168
|
+
"sourceRoot": "apps/web/src",
|
|
162
169
|
"projectType": "application",
|
|
163
170
|
"tags": ["type:app", "scope:client"],
|
|
164
171
|
"targets": {
|
|
165
172
|
"build": {
|
|
166
|
-
"executor": "@nx/
|
|
167
|
-
"options": { "outputPath": "dist/apps/
|
|
173
|
+
"executor": "@nx/next:build",
|
|
174
|
+
"options": { "outputPath": "dist/apps/web" }
|
|
168
175
|
},
|
|
169
176
|
"serve": {
|
|
170
|
-
"executor": "@nx/
|
|
171
|
-
"options": { "buildTarget": "
|
|
177
|
+
"executor": "@nx/next:server",
|
|
178
|
+
"options": { "buildTarget": "web:build" }
|
|
172
179
|
},
|
|
173
180
|
"test": {
|
|
174
|
-
"executor": "@nx/
|
|
181
|
+
"executor": "@nx/vitest:vitest",
|
|
175
182
|
"options": {}
|
|
176
183
|
}
|
|
177
184
|
},
|
|
@@ -183,16 +190,16 @@ Common operations:
|
|
|
183
190
|
|
|
184
191
|
```bash
|
|
185
192
|
# Get target names
|
|
186
|
-
pnpm nx show project
|
|
193
|
+
pnpm nx show project web --json | jq '.targets | keys'
|
|
187
194
|
|
|
188
195
|
# Get specific target config
|
|
189
|
-
pnpm nx show project
|
|
196
|
+
pnpm nx show project web --json | jq '.targets.build'
|
|
190
197
|
|
|
191
198
|
# Get tags
|
|
192
|
-
pnpm nx show project
|
|
199
|
+
pnpm nx show project web --json | jq '.tags'
|
|
193
200
|
|
|
194
201
|
# Get project root
|
|
195
|
-
pnpm nx show project
|
|
202
|
+
pnpm nx show project web --json | jq -r '.root'
|
|
196
203
|
```
|
|
197
204
|
|
|
198
205
|
### Project Graph ("What depends on library Y?")
|
|
@@ -207,22 +214,22 @@ Example output:
|
|
|
207
214
|
{
|
|
208
215
|
"graph": {
|
|
209
216
|
"nodes": {
|
|
210
|
-
"
|
|
211
|
-
"name": "
|
|
217
|
+
"web": {
|
|
218
|
+
"name": "web",
|
|
212
219
|
"type": "app",
|
|
213
|
-
"data": { "root": "apps/
|
|
220
|
+
"data": { "root": "apps/web", "tags": ["type:app"] }
|
|
214
221
|
},
|
|
215
|
-
"
|
|
216
|
-
"name": "
|
|
222
|
+
"hooks": {
|
|
223
|
+
"name": "hooks",
|
|
217
224
|
"type": "lib",
|
|
218
|
-
"data": { "root": "
|
|
225
|
+
"data": { "root": "packages/hooks", "tags": ["type:hook"] }
|
|
219
226
|
}
|
|
220
227
|
},
|
|
221
228
|
"dependencies": {
|
|
222
|
-
"
|
|
223
|
-
{ "source": "
|
|
229
|
+
"web": [
|
|
230
|
+
{ "source": "web", "target": "hooks", "type": "static" }
|
|
224
231
|
],
|
|
225
|
-
"
|
|
232
|
+
"hooks": []
|
|
226
233
|
}
|
|
227
234
|
}
|
|
228
235
|
}
|
|
@@ -235,10 +242,10 @@ Common operations:
|
|
|
235
242
|
pnpm nx graph --print | jq '.graph.nodes | keys'
|
|
236
243
|
|
|
237
244
|
# Find dependencies of a project
|
|
238
|
-
pnpm nx graph --print | jq '.graph.dependencies["
|
|
245
|
+
pnpm nx graph --print | jq '.graph.dependencies["web"]'
|
|
239
246
|
|
|
240
247
|
# Find projects that depend on a library
|
|
241
|
-
pnpm nx graph --print | jq '.graph.dependencies | to_entries[] | select(.value[].target == "
|
|
248
|
+
pnpm nx graph --print | jq '.graph.dependencies | to_entries[] | select(.value[].target == "hooks") | .key'
|
|
242
249
|
```
|
|
243
250
|
|
|
244
251
|
## Troubleshooting
|