This repository keeps one local Nx inference plugin for the Go CLI sidecar.
TypeScript workspaces declare their types:check scripts explicitly, and
Turbo orchestrates repository build, generation, quality, live, and auxiliary
workflows. Nx is retained for dependency-graph inspection.
Source: tools/nx-plugins/src/go.plugin.ts
The plugin matches apps/*/go.mod and adds the Go sidecar's build and lint
targets to the Nx project graph. The default project name is cli-go and the
default binary output is supabase-go.
| Target | Command | Cached |
|---|---|---|
build |
go build -o supabase-go . |
No |
lint:check |
golangci-lint run --timeout 5m |
Yes |
lint:fix |
golangci-lint run --fix |
No |
These are the plugin's inferred defaults. The explicit package scripts take
precedence in the final Nx target configuration. Turbo's cache policy for
ordinary builds and task workflows is defined in turbo.json.
The same Go lint commands are also declared in apps/cli-go/package.json so
they can be invoked directly and by Turbo quality workflows.
To see the Go project's inferred Nx targets and their configuration:
nx show project cli-goUse Turbo for task execution; use Nx only to inspect the dependency graph:
pnpm run build
pnpm run generate
pnpm run test:live
nx show project supabaseType checks are explicit package scripts, while formatting, linting, and unused-code analysis are root-owned scripts. Run all repository quality checks with Turbo from the root:
pnpm run check:all
pnpm run fix:all- Create a new file at
tools/nx-plugins/src/<name>.plugin.ts. - Export a
createNodesV2function typed asCreateNodesV2from@nx/devkit. - Choose a glob pattern for files that signal a project should receive the target.
- Return
[configFilePath, { projects: { [projectRoot]: { targets } } }]tuples for each matching file. - Register the plugin in
nx.jsonunder thepluginsarray.
import type { CreateNodesV2 } from "@nx/devkit";
import { dirname } from "node:path";
export const createNodesV2: CreateNodesV2 = [
"apps/*/tool.config",
(configFiles, _options, _context) =>
configFiles.map((configPath) => {
const projectRoot = dirname(configPath);
return [
configPath,
{
projects: {
[projectRoot]: {
targets: {
"tool:check": {
command: "tool check",
options: { cwd: "{projectRoot}" },
},
},
},
},
},
];
}),
];// nx.json
{
"plugins": ["./tools/nx-plugins/src/go.plugin.ts", "./tools/nx-plugins/src/my-tool.plugin.ts"]
}- Use the package's existing configuration as the detection signal. Avoid introducing a separate marker file when the tool's own config is available.
- Prefer fine-grained inputs so cache invalidation follows the tool's actual inputs.
- Include external tool dependencies in
inputswhen the inferred target is cached. - Keep Nx plugins focused on dependency-graph inference and inspection; declare routine package scripts directly when pnpm and Turbo are the consuming interfaces.