Skip to main content

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.

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 (Conditional) — Removed if the workspace role is not project. If the role is project but the value is not a string in name@version format, it is removed.
  • engines (Required) — If missing, it is created. When active Node.js LTS versions are available, engines.node is set to the computed constraint. If engines exists but engines.node is missing, the constraint is added.
  • engines.node tracking — When trackNodeLtsVersions is enabled, the recipe checks whether the current engines.node value 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 if os does not include linux. If missing but os includes linux, 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:

SettingTypeDescription
trackNodeLtsVersionsbooleanAutomatically sync engines.node to current Node.js LTS versions.

Usage

Options

FlagDescription
-d, --dry-runPreview changes without modifying files.
-r, --replace-fileOverwrite the original file instead of creating a .nova-backup copy.