Sync Environment
Sync engines, os, cpu, libc, devEngines, and packageManager fields in workspace package.json files.
Summary
The sync-environment recipe ensures that runtime environment fields in each workspace's package.json follow consistent conventions.
When the trackNodeLtsVersions setting is enabled, it automatically updates the engines.node constraint to match all currently active Node.js LTS versions.
Why Use This Command?
- Keeps Node.js engine support aligned with the active LTS policy chosen for each workspace.
- Normalizes platform constraints so package managers receive consistent runtime metadata.
- Keeps the project root on one validated Corepack client while removing duplicate manager declarations from child workspaces.
- Warns about incomplete LTS coverage before an outdated engine range reaches consumers.
Requirements
- Node.js runtime — Use a supported Node.js LTS release with the Nova CLI available.
- Project config — Register the workspace and enable
recipes.package-json.<workspace>.sync-environmentinnova.config.json. - Workspace manifest — The configured workspace must contain a readable
package.jsonfile.
Behavior
For each eligible workspace, the recipe inspects environment and runtime fields and applies the following rules. See Workspace Rules for how tags are determined.
packageManager(Required forproject) — The project root accepts only an exactnpm@version,pnpm@version, oryarn@versionCorepack descriptor. A valid descriptor is preserved. A missing, ranged, partial, or unsupported value is replaced with the locally detected exact npm version in the same run. If npm version detection fails, Nova warns and leaves the field absent instead of guessing. Every non-project workspace has this field removed so the root remains the single source of truth.engines(Required) — If missing, it is created. When active Node.js LTS versions are available,engines.nodeis set to the computed constraint. Ifenginesexists butengines.nodeis missing, the constraint is added.engines.nodetracking — WhentrackNodeLtsVersionsis enabled, the recipe checks whether the currentengines.nodevalue covers all active LTS major versions using>=N,^N,~N,N.x, or*patterns. If coverage is incomplete, a warning is logged. The value is then synced to the computed constraint.os(Conditional) — Removed if the field is present but empty.cpu(Conditional) — Removed if the field is present but empty.libc(Required) — Removed ifosdoes not includelinux. If missing butosincludeslinux, it is added as["glibc"].devEngines(Conditional) — Removed if the field is present but empty.
Settings
Settings are configured per workspace in nova.config.json under the recipes key:
| Setting | Type | Description |
|---|---|---|
trackNodeLtsVersions | boolean | Automatically sync engines.node to current Node.js LTS versions. |
Usage
Options
| Flag | Description |
|---|---|
-d, --dry-run | Run without writing any files. |
-r, --replace-file | Overwrite the original file instead of creating a .nova-backup copy. |