nx_workspace

Native Nx workspace seed.

Description#

nx_workspace calls Nx's full project-graph API at graph load time, retaining external package nodes, and emits one task target per project and task pair. Dependency edges honor Nx's dependsOn, including the upstream ^ form and the object form.

Nx remains authoritative for project discovery, task configuration, named inputs, and executor semantics. Struo schedules and caches the tasks it emits without shelling back into nx run. Tasks whose executor is nx:run-commands (or its @nx/ / @nrwl/ aliases) or nx:run-script run their underlying command directly. Other executors run through the installed Nx runExecutor API with the resolved graph and default configuration, without Nx's scheduler or cache. Tasks named test become nx_test targets with cacheable suite-level batches through struo test.

The default task filter emits every build, test, and lint task in the graph, together with their transitive dependsOn tasks. For example, a build that depends on compile retains that task even though compile is not in the filter. Unrelated tasks remain excluded. Set targets to the empty list to include every task Nx reports.

Attributes#

AttributeTypeRequiredDefaultDescription
nodestringnonodeNode.js executable name, absolute path, or workspace-relative path
targetslist<string>no["build", "test", "lint"]Nx task names to emit with their transitive task dependencies; empty list includes every task
resolver_inputslist<string>nosrcsText inputs available while deriving the graph
graph_filestringnoOptional workspace-relative Nx project-graph JSON snapshot; include external package nodes for plugin execution. Struo reads it directly instead of invoking Nx
coverage_per_testboolnofalseForward isolated coverage opt-in to generated test targets running one native Jest or Vitest command
coverage_sourceslist<string>no[]Product source globs forwarded to coverage-enabled test targets
_default_test_rootslist<string>no[]Resolver-owned application and library test names selected by targetless struo test

Providers#

The target emits nx_workspace.

Capabilities#

CapabilityOutput groups
buildnone

Direct Use#

Install the workspace's Node.js dependencies with the project's package manager (npm, pnpm, yarn, or bun) so that node_modules/nx is present:

bash
npm install

Struo never installs Node.js dependencies or updates lock files.

Inspect the automatically derived graph:

bash
struo query workspace struo query targets --kind nx_task

No struo.toml is required. To configure the resolver explicitly, author a target equivalent to:

toml
[[target]] name = "nx" kind = "nx_workspace" srcs = ["nx.json", "package.json"] [target.attrs] resolver_inputs = ["nx.json", "package.json", "**/project.json", "**/package.json"]

Keep this seed as the only Struo target while Nx's graph describes the workspace. Add explicit targets beside it only for exceptional boundaries that Nx does not cover.

Sources#

  • nx graph defines the project graph consumed by the native integration.
  • Nx executors describe the per-task contract Struo translates.