Add Nx

AS
2d ago
+154-0

Summary

Adds Nx for incremental adoption, following Nx's start with an existing project flow. This is task-running + caching only: nx.json is added and nx is added as a devDependency. Existing scripts are left untouched and no plugins are added.

What changed

  • nx.json (new) — Nx workspace config with the build target marked cacheable.
  • package.json — adds an nx devDependency and an empty "nx": {} field. Scripts unchanged.
  • .gitignore — adds .nx/cache, .nx/workspace-data, .nx/migrate-runs.
  • Lockfile — updated by the nx init install step (or, for repos with no package.json, Nx adds a standalone .nx/ install: nx.json, .nx/nxw.js, nx, nx.bat).

Try it

nx build <project-name>     # run a task
nx build <project-name>     # again - instant cache hit
nx run-many -t build test   # run tasks across all projects
nx graph                    # visualize project dependencies

Verification

  • nx init ran non-interactively; --plugins=skip was honored (no plugins in nx.json).
  • Confirmed on a representative repo: nx run-many -t build succeeds, and a second run is a 100% cache hit.

Notes

  • No plugins, no restructuring, no CI changes.
  • Merge this branch to enable Nx; nothing else is required.

This PR was created by an AI agent (OpenHands) on behalf of @ashcoft.


Devin Review

Summary by Sourcery

Enable Nx for incremental task running and build caching while preserving the existing project structure and scripts.

New Features:

  • Add Nx workspace support with a cacheable build target and a committed cross-platform Nx launcher.

Enhancements:

  • Enable incremental task execution and caching without changing existing project scripts or adding plugins.

Chores:

  • Ignore local Nx cache and workspace data generated during development.

Summary by CodeRabbit

  • New Features
    • The Nx command now checks for required Node.js and npm installations and provides a clear message if either is missing.
    • Nx versions are synchronized automatically when the configured version differs from the installed version.
    • Build tasks use caching by default.
  • Bug Fixes
    • Installation failures are reported, and the previous installation settings are restored.

This change is Reviewable

RetriggerView in GreptileConfidence Score: 4/5

Fix the launcher paths before merging so checkouts containing spaces can start Nx.

Fix All in CodexFindings

  1. P1 Spaces break the launchers ▶
  2. P2 Editors cannot find the schema ▶
Fix with agent prompt
### Issue 1
nx:4-5
If the checkout path contains spaces, the Windows launcher splits the unquoted script path and Node cannot load the wrapper. The Unix launcher also fails when called through an absolute path containing spaces: both `$BASH_SOURCE` and the script path are unquoted. Quote the paths in both launchers.

### Issue 2
nx.json:5
`$schema` points to the root `node_modules` directory, but the wrapper installs Nx under `.nx/installation/node_modules`. Editors cannot load the schema or offer schema-based suggestions even after Nx is installed. Point `$schema` to `./.nx/installation/node_modules/nx/schemas/nx-schema.json`.

```suggestion
  "$schema": "./.nx/installation/node_modules/nx/schemas/nx-schema.json",
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds a standalone Nx installation and launchers without changing the existing CircleCI job.

  • The repository can run Nx through launchers that prepare its local installation.
  • Nx can reuse cached results for build targets.

Reviews (1) · Last reviewed commit: "chore: add Nx" · Reviewed by Greptile


Summary by cubic

Adds Nx for incremental task running and caching without changing existing scripts or adding plugins. The build target is now cacheable in nx.json, so repeated builds hit the cache instead of re-running work.

The new nx launcher (plus nx.bat for Windows) confirms Node and npm are available, installs the Nx version pinned in nx.json into a gitignored .nx/installation, and runs Nx; the first invocation performs a local npm install. No CI or workflow changes are required.